| 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 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "Page.h" | 12 #include "Page.h" |
| 13 | 13 |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 16 #include "skia/ext/platform_canvas.h" | 16 #include "skia/ext/platform_canvas.h" |
| 17 #include "webkit/api/public/WebPoint.h" | 17 #include "webkit/api/public/WebPoint.h" |
| 18 #include "webkit/api/public/WebSize.h" | 18 #include "webkit/api/public/WebSize.h" |
| 19 #include "webkit/api/public/WebString.h" | 19 #include "webkit/api/public/WebString.h" |
| 20 #include "webkit/api/public/WebView.h" |
| 20 #include "webkit/api/src/NotificationPresenterImpl.h" | 21 #include "webkit/api/src/NotificationPresenterImpl.h" |
| 21 #include "webkit/glue/back_forward_list_client_impl.h" | 22 #include "webkit/glue/back_forward_list_client_impl.h" |
| 22 #include "webkit/glue/chrome_client_impl.h" | 23 #include "webkit/glue/chrome_client_impl.h" |
| 23 #include "webkit/glue/context_menu_client_impl.h" | 24 #include "webkit/glue/context_menu_client_impl.h" |
| 24 #include "webkit/glue/dragclient_impl.h" | 25 #include "webkit/glue/dragclient_impl.h" |
| 25 #include "webkit/glue/editor_client_impl.h" | 26 #include "webkit/glue/editor_client_impl.h" |
| 26 #include "webkit/glue/inspector_client_impl.h" | 27 #include "webkit/glue/inspector_client_impl.h" |
| 27 #include "webkit/glue/webframe_impl.h" | 28 #include "webkit/glue/webframe_impl.h" |
| 28 #include "webkit/glue/webpreferences.h" | 29 #include "webkit/glue/webpreferences.h" |
| 29 #include "webkit/glue/webview.h" | |
| 30 | 30 |
| 31 namespace WebCore { | 31 namespace WebCore { |
| 32 class ChromiumDataObject; | 32 class ChromiumDataObject; |
| 33 class Frame; | 33 class Frame; |
| 34 class HistoryItem; | 34 class HistoryItem; |
| 35 class HitTestResult; | 35 class HitTestResult; |
| 36 class KeyboardEvent; | 36 class KeyboardEvent; |
| 37 class Page; | 37 class Page; |
| 38 class PlatformKeyboardEvent; | 38 class PlatformKeyboardEvent; |
| 39 class PopupContainer; | 39 class PopupContainer; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 51 } | 51 } |
| 52 | 52 |
| 53 namespace webkit_glue { | 53 namespace webkit_glue { |
| 54 class ImageResourceFetcher; | 54 class ImageResourceFetcher; |
| 55 } | 55 } |
| 56 | 56 |
| 57 class AutocompletePopupMenuClient; | 57 class AutocompletePopupMenuClient; |
| 58 class SearchableFormData; | 58 class SearchableFormData; |
| 59 class WebHistoryItemImpl; | 59 class WebHistoryItemImpl; |
| 60 class WebDevToolsAgentImpl; | 60 class WebDevToolsAgentImpl; |
| 61 class WebViewDelegate; | |
| 62 | 61 |
| 63 class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { | 62 class WebViewImpl : public WebKit::WebView, |
| 63 public base::RefCounted<WebViewImpl> { |
| 64 public: | 64 public: |
| 65 // WebWidget methods: | 65 // WebWidget methods: |
| 66 virtual void close(); | 66 virtual void close(); |
| 67 virtual WebKit::WebSize size() { return size_; } | 67 virtual WebKit::WebSize size() { return size_; } |
| 68 virtual void resize(const WebKit::WebSize& new_size); | 68 virtual void resize(const WebKit::WebSize& new_size); |
| 69 virtual void layout(); | 69 virtual void layout(); |
| 70 virtual void paint(WebKit::WebCanvas* canvas, | 70 virtual void paint(WebKit::WebCanvas* canvas, |
| 71 const WebKit::WebRect& rect); | 71 const WebKit::WebRect& rect); |
| 72 virtual bool handleInputEvent(const WebKit::WebInputEvent& input_event); | 72 virtual bool handleInputEvent(const WebKit::WebInputEvent& input_event); |
| 73 virtual void mouseCaptureLost(); | 73 virtual void mouseCaptureLost(); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 virtual WebKit::WebString inspectorSettings() const; | 137 virtual WebKit::WebString inspectorSettings() const; |
| 138 virtual void setInspectorSettings(const WebKit::WebString& settings); | 138 virtual void setInspectorSettings(const WebKit::WebString& settings); |
| 139 virtual WebKit::WebDevToolsAgent* devToolsAgent(); | 139 virtual WebKit::WebDevToolsAgent* devToolsAgent(); |
| 140 virtual WebKit::WebAccessibilityObject accessibilityObject(); | 140 virtual WebKit::WebAccessibilityObject accessibilityObject(); |
| 141 virtual void applyAutofillSuggestions( | 141 virtual void applyAutofillSuggestions( |
| 142 const WebKit::WebNode&, | 142 const WebKit::WebNode&, |
| 143 const WebKit::WebVector<WebKit::WebString>& suggestions, | 143 const WebKit::WebVector<WebKit::WebString>& suggestions, |
| 144 int defaultSuggestionIndex); | 144 int defaultSuggestionIndex); |
| 145 virtual void hideAutofillPopup(); | 145 virtual void hideAutofillPopup(); |
| 146 | 146 |
| 147 // WebView methods: | 147 // WebViewImpl |
| 148 virtual void SetIgnoreInputEvents(bool new_value); | 148 |
| 149 void SetIgnoreInputEvents(bool new_value); |
| 149 WebDevToolsAgentImpl* GetWebDevToolsAgentImpl(); | 150 WebDevToolsAgentImpl* GetWebDevToolsAgentImpl(); |
| 150 | 151 |
| 151 // WebViewImpl | |
| 152 | |
| 153 const WebKit::WebPoint& last_mouse_down_point() const { | 152 const WebKit::WebPoint& last_mouse_down_point() const { |
| 154 return last_mouse_down_point_; | 153 return last_mouse_down_point_; |
| 155 } | 154 } |
| 156 | 155 |
| 157 WebCore::Frame* GetFocusedWebCoreFrame(); | 156 WebCore::Frame* GetFocusedWebCoreFrame(); |
| 158 | 157 |
| 159 // Returns the currently focused Node or NULL if no node has focus. | 158 // Returns the currently focused Node or NULL if no node has focus. |
| 160 WebCore::Node* GetFocusedNode(); | 159 WebCore::Node* GetFocusedNode(); |
| 161 | 160 |
| 162 static WebViewImpl* FromPage(WebCore::Page* page); | 161 static WebViewImpl* FromPage(WebCore::Page* page); |
| 163 | 162 |
| 164 WebKit::WebViewClient* client() { | 163 WebKit::WebViewClient* client() { |
| 165 return delegate_; | 164 return client_; |
| 166 } | |
| 167 | |
| 168 // TODO(darin): Remove this method in favor of client(). | |
| 169 WebViewDelegate* delegate() { | |
| 170 return delegate_; | |
| 171 } | 165 } |
| 172 | 166 |
| 173 // Returns the page object associated with this view. This may be NULL when | 167 // Returns the page object associated with this view. This may be NULL when |
| 174 // the page is shutting down, but will be valid at all other times. | 168 // the page is shutting down, but will be valid at all other times. |
| 175 WebCore::Page* page() const { | 169 WebCore::Page* page() const { |
| 176 return page_.get(); | 170 return page_.get(); |
| 177 } | 171 } |
| 178 | 172 |
| 179 WebCore::RenderTheme* theme() const; | 173 WebCore::RenderTheme* theme() const; |
| 180 | 174 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 // Returns the provider of desktop notifications. | 244 // Returns the provider of desktop notifications. |
| 251 WebKit::NotificationPresenterImpl* GetNotificationPresenter(); | 245 WebKit::NotificationPresenterImpl* GetNotificationPresenter(); |
| 252 #endif | 246 #endif |
| 253 | 247 |
| 254 // Tries to scroll a frame or any parent of a frame. Returns true if the view | 248 // Tries to scroll a frame or any parent of a frame. Returns true if the view |
| 255 // was scrolled. | 249 // was scrolled. |
| 256 bool PropagateScroll(WebCore::ScrollDirection scroll_direction, | 250 bool PropagateScroll(WebCore::ScrollDirection scroll_direction, |
| 257 WebCore::ScrollGranularity scroll_granularity); | 251 WebCore::ScrollGranularity scroll_granularity); |
| 258 | 252 |
| 259 protected: | 253 protected: |
| 260 friend class WebView; // So WebView::Create can call our constructor | 254 friend class WebKit::WebView; // So WebView::Create can call our constructor |
| 261 friend class base::RefCounted<WebViewImpl>; | 255 friend class base::RefCounted<WebViewImpl>; |
| 262 | 256 |
| 263 WebViewImpl(WebViewDelegate* delegate); | 257 WebViewImpl(WebKit::WebViewClient* client); |
| 264 ~WebViewImpl(); | 258 ~WebViewImpl(); |
| 265 | 259 |
| 266 void ModifySelection(uint32 message, | 260 void ModifySelection(uint32 message, |
| 267 WebCore::Frame* frame, | 261 WebCore::Frame* frame, |
| 268 const WebCore::PlatformKeyboardEvent& e); | 262 const WebCore::PlatformKeyboardEvent& e); |
| 269 | 263 |
| 270 WebViewDelegate* delegate_; | 264 WebKit::WebViewClient* client_; |
| 271 | 265 |
| 272 webkit_glue::BackForwardListClientImpl back_forward_list_client_impl_; | 266 webkit_glue::BackForwardListClientImpl back_forward_list_client_impl_; |
| 273 ChromeClientImpl chrome_client_impl_; | 267 ChromeClientImpl chrome_client_impl_; |
| 274 ContextMenuClientImpl context_menu_client_impl_; | 268 ContextMenuClientImpl context_menu_client_impl_; |
| 275 DragClientImpl drag_client_impl_; | 269 DragClientImpl drag_client_impl_; |
| 276 EditorClientImpl editor_client_impl_; | 270 EditorClientImpl editor_client_impl_; |
| 277 InspectorClientImpl inspector_client_impl_; | 271 InspectorClientImpl inspector_client_impl_; |
| 278 | 272 |
| 279 WebKit::WebSize size_; | 273 WebKit::WebSize size_; |
| 280 | 274 |
| 281 WebKit::WebPoint last_mouse_position_; | 275 WebKit::WebPoint last_mouse_position_; |
| 282 scoped_ptr<WebCore::Page> page_; | 276 scoped_ptr<WebCore::Page> page_; |
| 283 | 277 |
| 284 // This flag is set when a new navigation is detected. It is used to satisfy | 278 // This flag is set when a new navigation is detected. It is used to satisfy |
| 285 // the corresponding argument to WebViewDelegate::DidCommitLoadForFrame. | 279 // the corresponding argument to WebFrameClient::didCommitProvisionalLoad. |
| 286 bool observed_new_navigation_; | 280 bool observed_new_navigation_; |
| 287 #ifndef NDEBUG | 281 #ifndef NDEBUG |
| 288 // Used to assert that the new navigation we observed is the same navigation | 282 // Used to assert that the new navigation we observed is the same navigation |
| 289 // when we make use of observed_new_navigation_. | 283 // when we make use of observed_new_navigation_. |
| 290 const WebCore::DocumentLoader* new_navigation_loader_; | 284 const WebCore::DocumentLoader* new_navigation_loader_; |
| 291 #endif | 285 #endif |
| 292 | 286 |
| 293 // A copy of the WebPreferences object we receive from the browser. | 287 // A copy of the WebPreferences object we receive from the browser. |
| 294 WebPreferences webprefs_; | 288 WebPreferences webprefs_; |
| 295 | 289 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 static const WebKit::WebInputEvent* current_input_event() { | 403 static const WebKit::WebInputEvent* current_input_event() { |
| 410 return g_current_input_event; | 404 return g_current_input_event; |
| 411 } | 405 } |
| 412 private: | 406 private: |
| 413 static const WebKit::WebInputEvent* g_current_input_event; | 407 static const WebKit::WebInputEvent* g_current_input_event; |
| 414 | 408 |
| 415 DISALLOW_COPY_AND_ASSIGN(WebViewImpl); | 409 DISALLOW_COPY_AND_ASSIGN(WebViewImpl); |
| 416 }; | 410 }; |
| 417 | 411 |
| 418 #endif // WEBKIT_GLUE_WEBVIEW_IMPL_H_ | 412 #endif // WEBKIT_GLUE_WEBVIEW_IMPL_H_ |
| OLD | NEW |