diff options
author | yaar@chromium.org <yaar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-29 23:16:17 +0000 |
---|---|---|
committer | yaar@chromium.org <yaar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-29 23:16:17 +0000 |
commit | b0950a734d693e2192b1e2e94381c4345387b330 (patch) | |
tree | a05449073fff162deedcec67838f60a2809efda0 /webkit/glue | |
parent | 0aaec000440c2453f20265a7b580efc4ad10b282 (diff) | |
download | chromium_src-b0950a734d693e2192b1e2e94381c4345387b330.zip chromium_src-b0950a734d693e2192b1e2e94381c4345387b330.tar.gz chromium_src-b0950a734d693e2192b1e2e94381c4345387b330.tar.bz2 |
WebView::DownloadImage refactored
The implementation was dependent on webkit_glue::image_resource_fetcher and had to be removed if we want to upstream WebView.
DownloadImage has been moved into RenderView::DownloadImage. WebViewImpl's set of ImageResourceFetchers has been ripped off and moved into RenderView.
Review URL: http://codereview.chromium.org/255006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27564 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r-- | webkit/glue/webview.h | 8 | ||||
-rw-r--r-- | webkit/glue/webview_delegate.h | 13 | ||||
-rw-r--r-- | webkit/glue/webview_impl.cc | 32 | ||||
-rw-r--r-- | webkit/glue/webview_impl.h | 12 |
4 files changed, 0 insertions, 65 deletions
diff --git a/webkit/glue/webview.h b/webkit/glue/webview.h index 53ab714..43af41e 100644 --- a/webkit/glue/webview.h +++ b/webkit/glue/webview.h @@ -137,14 +137,6 @@ class WebView : public WebKit::WebWidget { // ensure that a text field on the page is not eating keystrokes we send it. virtual void ClearFocusedNode() = 0; - // Requests the webview to download an image. When done, the delegate is - // notified by way of DidDownloadImage. Returns true if the request was - // successfully started, false otherwise. id is used to uniquely identify the - // request and passed back to the DidDownloadImage method. If the image has - // multiple frames, the frame whose size is image_size is returned. If the - // image doesn't have a frame at the specified size, the first is returned. - virtual bool DownloadImage(int id, const GURL& image_url, int image_size) = 0; - // Gets a WebSettings object that can be used to modify the behavior of this // WebView. The object is deleted by this class on destruction, so you must // not use it beyond WebView's lifetime. diff --git a/webkit/glue/webview_delegate.h b/webkit/glue/webview_delegate.h index 0773109..1acf4ac 100644 --- a/webkit/glue/webview_delegate.h +++ b/webkit/glue/webview_delegate.h @@ -183,19 +183,6 @@ class WebViewDelegate : public WebKit::WebViewClient { const std::string& frame_charset) { } - // ------------------------------------------------------------------------- - - // Notification that a request to download an image has completed. |errored| - // indicates if there was a network error. The image is empty if there was - // a network error, the contents of the page couldn't by converted to an - // image, or the response from the host was not 200. - // NOTE: image is empty if the response didn't contain image data. - virtual void DidDownloadImage(int id, - const GURL& image_url, - bool errored, - const SkBitmap& image) { - } - // InspectorClient --------------------------------------------------------- virtual void UpdateInspectorSettings(const std::wstring& raw_settings) { } diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc index 74a4c3f..63727cd 100644 --- a/webkit/glue/webview_impl.cc +++ b/webkit/glue/webview_impl.cc @@ -419,10 +419,6 @@ WebViewImpl::WebViewImpl(WebViewDelegate* delegate) WebViewImpl::~WebViewImpl() { DCHECK(page_ == NULL); - for (std::set<ImageResourceFetcher*>::iterator i = image_fetchers_.begin(); - i != image_fetchers_.end(); ++i) { - delete *i; - } } RenderTheme* WebViewImpl::theme() const { @@ -1376,16 +1372,6 @@ void WebViewImpl::SetInitialFocus(bool reverse) { } } -bool WebViewImpl::DownloadImage(int id, const GURL& image_url, - int image_size) { - if (!page_.get()) - return false; - image_fetchers_.insert(new ImageResourceFetcher( - image_url, main_frame(), id, image_size, - NewCallback(this, &WebViewImpl::OnImageFetchComplete))); - return true; -} - WebSettings* WebViewImpl::GetSettings() { if (!web_settings_.get()) web_settings_.reset(new WebSettingsImpl(page_->settings())); @@ -1810,15 +1796,6 @@ void WebViewImpl::StartDragging(const WebPoint& event_pos, client()->startDragging(event_pos, drag_data, mask); } -void WebViewImpl::OnImageFetchComplete(ImageResourceFetcher* fetcher, - const SkBitmap& image) { - if (delegate_) { - delegate_->DidDownloadImage(fetcher->id(), fetcher->image_url(), - image.isNull(), image); - } - DeleteImageResourceFetcher(fetcher); -} - void WebViewImpl::SetCurrentHistoryItem(WebCore::HistoryItem* item) { back_forward_list_client_impl_.SetCurrentHistoryItem(item); } @@ -1834,15 +1811,6 @@ void WebViewImpl::ObserveNewNavigation() { #endif } -void WebViewImpl::DeleteImageResourceFetcher(ImageResourceFetcher* fetcher) { - DCHECK(image_fetchers_.find(fetcher) != image_fetchers_.end()); - image_fetchers_.erase(fetcher); - - // We're in the callback from the ImageResourceFetcher, best to delay - // deletion. - MessageLoop::current()->DeleteSoon(FROM_HERE, fetcher); -} - void WebViewImpl::HideAutoCompletePopup() { if (autocomplete_popup_showing_) { autocomplete_popup_->hidePopup(); diff --git a/webkit/glue/webview_impl.h b/webkit/glue/webview_impl.h index bb9f077..165b6bd 100644 --- a/webkit/glue/webview_impl.h +++ b/webkit/glue/webview_impl.h @@ -98,7 +98,6 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { virtual void StopLoading(); virtual void SetBackForwardListSize(int size); virtual void SetInitialFocus(bool reverse); - virtual bool DownloadImage(int id, const GURL& image_url, int image_size); virtual WebKit::WebSettings* GetSettings(); virtual const std::wstring& GetInspectorSettings() const; virtual void SetInspectorSettings(const std::wstring& settings); @@ -265,10 +264,6 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { friend class WebView; // So WebView::Create can call our constructor friend class base::RefCounted<WebViewImpl>; - // ImageResourceFetcher::Callback. - void OnImageFetchComplete(webkit_glue::ImageResourceFetcher* fetcher, - const SkBitmap& bitmap); - WebViewImpl(WebViewDelegate* delegate); ~WebViewImpl(); @@ -325,18 +320,11 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { // Returns true if the view was scrolled. bool ScrollViewWithKeyboard(int key_code, int modifiers); - // Removes fetcher from the set of pending image fetchers and deletes it. - // This is invoked after the download is completed (or fails). - void DeleteImageResourceFetcher(webkit_glue::ImageResourceFetcher* fetcher); - // Converts |pos| from window coordinates to contents coordinates and gets // the HitTestResult for it. WebCore::HitTestResult HitTestResultForWindowPos( const WebCore::IntPoint& pos); - // ImageResourceFetchers schedule via DownloadImage. - std::set<webkit_glue::ImageResourceFetcher*> image_fetchers_; - // The point relative to the client area where the mouse was last pressed // down. This is used by the drag client to determine what was under the // mouse when the drag was initiated. We need to track this here in |