Bug 47394 - [chromium] Update ReadableDataObject/WritableDataObject interface for ChromiumDataObject change
Summary: [chromium] Update ReadableDataObject/WritableDataObject interface for Chromiu...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-07 19:16 PDT by Daniel Cheng
Modified: 2010-10-08 16:13 PDT (History)
2 users (show)

See Also:


Attachments
Patch (11.12 KB, patch)
2010-10-07 19:54 PDT, Daniel Cheng
tony: review-
Details | Formatted Diff | Diff
Patch (12.98 KB, patch)
2010-10-08 15:35 PDT, Daniel Cheng
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Cheng 2010-10-07 19:16:16 PDT
1. Condensing getURL()/setURL()/getHTML()/setHTML()/urlTitle()/htmlBaseURL() into urlTitle()/htmlBaseURL() and the corresponding setters.
2. Use ClipboardType instead of bools.
Comment 1 Daniel Cheng 2010-10-07 19:54:26 PDT
Created attachment 70196 [details]
Patch
Comment 2 Tony Chang 2010-10-08 10:10:29 PDT
Comment on attachment 70196 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=70196&action=review

> WebCore/platform/chromium/ReadableDataObject.h:54
> -    virtual String getHTML(String* baseURL) const;
> +    String urlTitle() const;
> +    KURL htmlBaseUrl() const;

I prefer the getHTML method because it makes the caller think about whether they need the base url or not.  I feel less strongly about the getURL method, but it's pretty easy to pass in NULL for the title so I'm not sure there's much benefit to splitting it up.

> WebCore/platform/chromium/WritableDataObject.h:59
> -    virtual void setURL(const String& url, const String& title);
> -    virtual void setHTML(const String& html, const KURL& baseURL);
> +    void setUrlTitle(const String& title);
> +    void setHtmlBaseUrl(const KURL& baseURL);

I prefer the old API where you can set everything in a single function call.  It makes it less likely that someone forgets to call setUrlTitle or setHtmlBaseUrl.  Also, in webkit, we tend to capitalize URL (e.g., KURL) and HTML (e.g., all the files in WebCore/html/).

> WebCore/platform/chromium/WritableDataObject.h:64
>      virtual String urlTitle() const;
>      virtual KURL htmlBaseURL() const;

Are these methods actually called?  Do they need to be virtual?
Comment 3 Daniel Cheng 2010-10-08 15:35:21 PDT
Created attachment 70302 [details]
Patch

(In reply to comment #2)
> (From update of attachment 70196 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=70196&action=review
> 
> > WebCore/platform/chromium/ReadableDataObject.h:54
> > -    virtual String getHTML(String* baseURL) const;
> > +    String urlTitle() const;
> > +    KURL htmlBaseUrl() const;
> 
> I prefer the getHTML method because it makes the caller think about whether they need the base url or not.  I feel less strongly about the getURL method, but it's pretty easy to pass in NULL for the title so I'm not sure there's much benefit to splitting it up.
> 
> > WebCore/platform/chromium/WritableDataObject.h:59
> > -    virtual void setURL(const String& url, const String& title);
> > -    virtual void setHTML(const String& html, const KURL& baseURL);
> > +    void setUrlTitle(const String& title);
> > +    void setHtmlBaseUrl(const KURL& baseURL);
> 
> I prefer the old API where you can set everything in a single function call.  It makes it less likely that someone forgets to call setUrlTitle or setHtmlBaseUrl.  Also, in webkit, we tend to capitalize URL (e.g., KURL) and HTML (e.g., all the files in WebCore/html/).
> 
> > WebCore/platform/chromium/WritableDataObject.h:64
> >      virtual String urlTitle() const;
> >      virtual KURL htmlBaseURL() const;
> 
> Are these methods actually called?  Do they need to be virtual?

They are called, but I forgot to devirtualize them. They are used when copying data from WebKit to the browser host.
I also went ahead and inlined all the simple setters/getters into the header.
Comment 4 WebKit Commit Bot 2010-10-08 16:13:49 PDT
Comment on attachment 70302 [details]
Patch

Clearing flags on attachment: 70302

Committed r69431: <http://trac.webkit.org/changeset/69431>
Comment 5 WebKit Commit Bot 2010-10-08 16:13:54 PDT
All reviewed patches have been landed.  Closing bug.