| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WEBKIT_GLUE_WEBVIEW_IMPL_H_ | 5 #ifndef WEBKIT_GLUE_WEBVIEW_IMPL_H_ |
| 6 #define WEBKIT_GLUE_WEBVIEW_IMPL_H_ | 6 #define WEBKIT_GLUE_WEBVIEW_IMPL_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "skia/ext/platform_canvas.h" | 12 #include "skia/ext/platform_canvas.h" |
| 13 #include "webkit/api/public/WebPoint.h" | 13 #include "webkit/api/public/WebPoint.h" |
| 14 #include "webkit/api/public/WebSize.h" | 14 #include "webkit/api/public/WebSize.h" |
| 15 #include "webkit/glue/back_forward_list_client_impl.h" | 15 #include "webkit/glue/back_forward_list_client_impl.h" |
| 16 #include "webkit/glue/image_resource_fetcher.h" |
| 16 #include "webkit/glue/webframe_impl.h" | 17 #include "webkit/glue/webframe_impl.h" |
| 17 #include "webkit/glue/webpreferences.h" | 18 #include "webkit/glue/webpreferences.h" |
| 18 #include "webkit/glue/webview.h" | 19 #include "webkit/glue/webview.h" |
| 19 | 20 |
| 20 MSVC_PUSH_WARNING_LEVEL(0); | 21 MSVC_PUSH_WARNING_LEVEL(0); |
| 21 #include "Page.h" | 22 #include "Page.h" |
| 22 #include "RenderTheme.h" | 23 #include "RenderTheme.h" |
| 23 MSVC_POP_WARNING(); | 24 MSVC_POP_WARNING(); |
| 24 | 25 |
| 25 namespace WebCore { | 26 namespace WebCore { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 36 class Widget; | 37 class Widget; |
| 37 } | 38 } |
| 38 | 39 |
| 39 namespace WebKit { | 40 namespace WebKit { |
| 40 class WebKeyboardEvent; | 41 class WebKeyboardEvent; |
| 41 class WebMouseEvent; | 42 class WebMouseEvent; |
| 42 class WebMouseWheelEvent; | 43 class WebMouseWheelEvent; |
| 43 } | 44 } |
| 44 | 45 |
| 45 class AutocompletePopupMenuClient; | 46 class AutocompletePopupMenuClient; |
| 46 class ImageResourceFetcher; | |
| 47 class SearchableFormData; | 47 class SearchableFormData; |
| 48 class WebHistoryItemImpl; | 48 class WebHistoryItemImpl; |
| 49 class WebDevToolsAgent; | 49 class WebDevToolsAgent; |
| 50 class WebDevToolsAgentImpl; | 50 class WebDevToolsAgentImpl; |
| 51 class WebViewDelegate; | 51 class WebViewDelegate; |
| 52 | 52 |
| 53 class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { | 53 class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { |
| 54 public: | 54 public: |
| 55 // WebView | 55 // WebView |
| 56 virtual bool ShouldClose(); | 56 virtual bool ShouldClose(); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 void set_window_open_disposition(WindowOpenDisposition disp) { | 204 void set_window_open_disposition(WindowOpenDisposition disp) { |
| 205 window_open_disposition_ = disp; | 205 window_open_disposition_ = disp; |
| 206 } | 206 } |
| 207 WindowOpenDisposition window_open_disposition() const { | 207 WindowOpenDisposition window_open_disposition() const { |
| 208 return window_open_disposition_; | 208 return window_open_disposition_; |
| 209 } | 209 } |
| 210 | 210 |
| 211 // Start a system drag and drop operation. | 211 // Start a system drag and drop operation. |
| 212 void StartDragging(const WebKit::WebDragData& drag_data); | 212 void StartDragging(const WebKit::WebDragData& drag_data); |
| 213 | 213 |
| 214 // ImageResourceFetcher callback. | |
| 215 void ImageResourceDownloadDone(ImageResourceFetcher* fetcher, | |
| 216 bool errored, | |
| 217 const SkBitmap& image); | |
| 218 | |
| 219 // Hides the autocomplete popup if it is showing. | 214 // Hides the autocomplete popup if it is showing. |
| 220 void HideAutoCompletePopup(); | 215 void HideAutoCompletePopup(); |
| 221 | 216 |
| 222 // Converts |x|, |y| from window coordinates to contents coordinates and gets | 217 // Converts |x|, |y| from window coordinates to contents coordinates and gets |
| 223 // the underlying Node for them. | 218 // the underlying Node for them. |
| 224 WebCore::Node* GetNodeForWindowPos(int x, int y); | 219 WebCore::Node* GetNodeForWindowPos(int x, int y); |
| 225 | 220 |
| 226 protected: | 221 protected: |
| 227 friend class WebView; // So WebView::Create can call our constructor | 222 friend class WebView; // So WebView::Create can call our constructor |
| 228 friend class base::RefCounted<WebViewImpl>; | 223 friend class base::RefCounted<WebViewImpl>; |
| 229 | 224 |
| 225 // ImageResourceFetcher::Callback. |
| 226 void OnImageFetchComplete(webkit_glue::ImageResourceFetcher* fetcher, |
| 227 const SkBitmap& bitmap); |
| 228 |
| 230 WebViewImpl(); | 229 WebViewImpl(); |
| 231 ~WebViewImpl(); | 230 ~WebViewImpl(); |
| 232 | 231 |
| 233 void ModifySelection(uint32 message, | 232 void ModifySelection(uint32 message, |
| 234 WebCore::Frame* frame, | 233 WebCore::Frame* frame, |
| 235 const WebCore::PlatformKeyboardEvent& e); | 234 const WebCore::PlatformKeyboardEvent& e); |
| 236 | 235 |
| 237 scoped_refptr<WebViewDelegate> delegate_; | 236 scoped_refptr<WebViewDelegate> delegate_; |
| 238 WebKit::WebSize size_; | 237 WebKit::WebSize size_; |
| 239 | 238 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 // Repaints the autofill popup. Should be called when the suggestions have | 272 // Repaints the autofill popup. Should be called when the suggestions have |
| 274 // changed. Note that this should only be called when the autofill popup is | 273 // changed. Note that this should only be called when the autofill popup is |
| 275 // showing. | 274 // showing. |
| 276 void RefreshAutofillPopup(); | 275 void RefreshAutofillPopup(); |
| 277 | 276 |
| 278 // Returns true if the view was scrolled. | 277 // Returns true if the view was scrolled. |
| 279 bool ScrollViewWithKeyboard(int key_code); | 278 bool ScrollViewWithKeyboard(int key_code); |
| 280 | 279 |
| 281 // Removes fetcher from the set of pending image fetchers and deletes it. | 280 // Removes fetcher from the set of pending image fetchers and deletes it. |
| 282 // This is invoked after the download is completed (or fails). | 281 // This is invoked after the download is completed (or fails). |
| 283 void DeleteImageResourceFetcher(ImageResourceFetcher* fetcher); | 282 void DeleteImageResourceFetcher(webkit_glue::ImageResourceFetcher* fetcher); |
| 284 | 283 |
| 285 // Converts |pos| from window coordinates to contents coordinates and gets | 284 // Converts |pos| from window coordinates to contents coordinates and gets |
| 286 // the HitTestResult for it. | 285 // the HitTestResult for it. |
| 287 WebCore::HitTestResult HitTestResultForWindowPos( | 286 WebCore::HitTestResult HitTestResultForWindowPos( |
| 288 const WebCore::IntPoint& pos); | 287 const WebCore::IntPoint& pos); |
| 289 | 288 |
| 290 // ImageResourceFetchers schedule via DownloadImage. | 289 // ImageResourceFetchers schedule via DownloadImage. |
| 291 std::set<ImageResourceFetcher*> image_fetchers_; | 290 std::set<webkit_glue::ImageResourceFetcher*> image_fetchers_; |
| 292 | 291 |
| 293 // The point relative to the client area where the mouse was last pressed | 292 // The point relative to the client area where the mouse was last pressed |
| 294 // down. This is used by the drag client to determine what was under the | 293 // down. This is used by the drag client to determine what was under the |
| 295 // mouse when the drag was initiated. We need to track this here in | 294 // mouse when the drag was initiated. We need to track this here in |
| 296 // WebViewImpl since DragClient::startDrag does not pass the position the | 295 // WebViewImpl since DragClient::startDrag does not pass the position the |
| 297 // mouse was at when the drag was initiated, only the current point, which | 296 // mouse was at when the drag was initiated, only the current point, which |
| 298 // can be misleading as it is usually not over the element the user actually | 297 // can be misleading as it is usually not over the element the user actually |
| 299 // dragged by the time a drag is initiated. | 298 // dragged by the time a drag is initiated. |
| 300 WebKit::WebPoint last_mouse_down_point_; | 299 WebKit::WebPoint last_mouse_down_point_; |
| 301 | 300 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 static const WebKit::WebInputEvent* current_input_event() { | 362 static const WebKit::WebInputEvent* current_input_event() { |
| 364 return g_current_input_event; | 363 return g_current_input_event; |
| 365 } | 364 } |
| 366 private: | 365 private: |
| 367 static const WebKit::WebInputEvent* g_current_input_event; | 366 static const WebKit::WebInputEvent* g_current_input_event; |
| 368 | 367 |
| 369 DISALLOW_COPY_AND_ASSIGN(WebViewImpl); | 368 DISALLOW_COPY_AND_ASSIGN(WebViewImpl); |
| 370 }; | 369 }; |
| 371 | 370 |
| 372 #endif // WEBKIT_GLUE_WEBVIEW_IMPL_H_ | 371 #endif // WEBKIT_GLUE_WEBVIEW_IMPL_H_ |
| OLD | NEW |