| 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 "Page.h" | 10 #include "Page.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 class AutocompletePopupMenuClient; | 43 class AutocompletePopupMenuClient; |
| 44 class SearchableFormData; | 44 class SearchableFormData; |
| 45 class WebHistoryItemImpl; | 45 class WebHistoryItemImpl; |
| 46 class WebDevToolsAgent; | 46 class WebDevToolsAgent; |
| 47 class WebDevToolsAgentImpl; | 47 class WebDevToolsAgentImpl; |
| 48 class WebViewDelegate; | 48 class WebViewDelegate; |
| 49 | 49 |
| 50 class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { | 50 class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { |
| 51 public: | 51 public: |
| 52 // WebView | 52 // WebWidget methods: |
| 53 virtual void close(); |
| 54 virtual WebKit::WebSize size() { return size_; } |
| 55 virtual void resize(const WebKit::WebSize& new_size); |
| 56 virtual void layout(); |
| 57 virtual void paint(WebKit::WebCanvas* canvas, |
| 58 const WebKit::WebRect& rect); |
| 59 virtual bool handleInputEvent(const WebKit::WebInputEvent& input_event); |
| 60 virtual void mouseCaptureLost(); |
| 61 virtual void setFocus(bool enable); |
| 62 virtual bool handleCompositionEvent(WebKit::WebCompositionCommand command, |
| 63 int cursor_position, |
| 64 int target_start, |
| 65 int target_end, |
| 66 const WebKit::WebString& text); |
| 67 virtual bool queryCompositionStatus(bool* enabled, |
| 68 WebKit::WebRect* caret_rect); |
| 69 virtual void setTextDirection(WebKit::WebTextDirection direction); |
| 70 |
| 71 // WebView methods: |
| 53 virtual bool ShouldClose(); | 72 virtual bool ShouldClose(); |
| 54 virtual void Close(); | |
| 55 virtual WebViewDelegate* GetDelegate(); | 73 virtual WebViewDelegate* GetDelegate(); |
| 56 virtual void SetDelegate(WebViewDelegate*); | 74 virtual void SetDelegate(WebViewDelegate*); |
| 57 virtual void SetUseEditorDelegate(bool value); | 75 virtual void SetUseEditorDelegate(bool value); |
| 58 virtual void SetTabKeyCyclesThroughElements(bool value); | 76 virtual void SetTabKeyCyclesThroughElements(bool value); |
| 59 virtual WebFrame* GetMainFrame(); | 77 virtual WebFrame* GetMainFrame(); |
| 60 virtual WebFrame* GetFocusedFrame(); | 78 virtual WebFrame* GetFocusedFrame(); |
| 61 virtual void SetFocusedFrame(WebFrame* frame); | 79 virtual void SetFocusedFrame(WebFrame* frame); |
| 62 virtual WebFrame* GetFrameWithName(const std::wstring& name); | 80 virtual WebFrame* GetFrameWithName(const std::wstring& name); |
| 63 virtual WebFrame* GetPreviousFrameBefore(WebFrame* frame, bool wrap); | 81 virtual WebFrame* GetPreviousFrameBefore(WebFrame* frame, bool wrap); |
| 64 virtual WebFrame* GetNextFrameAfter(WebFrame* frame, bool wrap); | 82 virtual WebFrame* GetNextFrameAfter(WebFrame* frame, bool wrap); |
| 65 virtual void Resize(const WebKit::WebSize& new_size); | |
| 66 virtual WebKit::WebSize GetSize() { return size(); } | |
| 67 virtual void Layout(); | |
| 68 virtual void Paint(skia::PlatformCanvas* canvas, const WebKit::WebRect& rect); | |
| 69 virtual bool HandleInputEvent(const WebKit::WebInputEvent* input_event); | |
| 70 virtual void MouseCaptureLost(); | |
| 71 virtual void SetFocus(bool enable); | |
| 72 virtual void ClearFocusedNode(); | 83 virtual void ClearFocusedNode(); |
| 73 virtual bool ImeSetComposition(int string_type, | |
| 74 int cursor_position, | |
| 75 int target_start, | |
| 76 int target_end, | |
| 77 const std::wstring& ime_string); | |
| 78 virtual bool ImeUpdateStatus(bool* enable_ime, | |
| 79 WebKit::WebRect* caret_rect); | |
| 80 virtual void SetTextDirection(WebTextDirection direction); | |
| 81 virtual void StopLoading(); | 84 virtual void StopLoading(); |
| 82 virtual void SetBackForwardListSize(int size); | 85 virtual void SetBackForwardListSize(int size); |
| 83 virtual void SetInitialFocus(bool reverse); | 86 virtual void SetInitialFocus(bool reverse); |
| 84 virtual bool DownloadImage(int id, const GURL& image_url, int image_size); | 87 virtual bool DownloadImage(int id, const GURL& image_url, int image_size); |
| 85 virtual void SetPreferences(const WebPreferences& preferences); | 88 virtual void SetPreferences(const WebPreferences& preferences); |
| 86 virtual const WebPreferences& GetPreferences(); | 89 virtual const WebPreferences& GetPreferences(); |
| 87 virtual void SetPageEncoding(const std::wstring& encoding_name); | 90 virtual void SetPageEncoding(const std::wstring& encoding_name); |
| 88 virtual std::wstring GetMainFrameEncodingName(); | 91 virtual std::wstring GetMainFrameEncodingName(); |
| 89 virtual void ZoomIn(bool text_only); | 92 virtual void ZoomIn(bool text_only); |
| 90 virtual void ZoomOut(bool text_only); | 93 virtual void ZoomOut(bool text_only); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 virtual void SetIgnoreInputEvents(bool new_value); | 126 virtual void SetIgnoreInputEvents(bool new_value); |
| 124 | 127 |
| 125 virtual WebDevToolsAgent* GetWebDevToolsAgent(); | 128 virtual WebDevToolsAgent* GetWebDevToolsAgent(); |
| 126 WebDevToolsAgentImpl* GetWebDevToolsAgentImpl(); | 129 WebDevToolsAgentImpl* GetWebDevToolsAgentImpl(); |
| 127 | 130 |
| 128 virtual void SetIsTransparent(bool is_transparent); | 131 virtual void SetIsTransparent(bool is_transparent); |
| 129 virtual bool GetIsTransparent() const; | 132 virtual bool GetIsTransparent() const; |
| 130 | 133 |
| 131 // WebViewImpl | 134 // WebViewImpl |
| 132 | 135 |
| 133 const WebKit::WebSize& size() const { return size_; } | |
| 134 | |
| 135 const WebKit::WebPoint& last_mouse_down_point() const { | 136 const WebKit::WebPoint& last_mouse_down_point() const { |
| 136 return last_mouse_down_point_; | 137 return last_mouse_down_point_; |
| 137 } | 138 } |
| 138 | 139 |
| 139 WebCore::Frame* GetFocusedWebCoreFrame(); | 140 WebCore::Frame* GetFocusedWebCoreFrame(); |
| 140 | 141 |
| 141 // Returns the currently focused Node or NULL if no node has focus. | 142 // Returns the currently focused Node or NULL if no node has focus. |
| 142 WebCore::Node* GetFocusedNode(); | 143 WebCore::Node* GetFocusedNode(); |
| 143 | 144 |
| 144 static WebViewImpl* FromPage(WebCore::Page* page); | 145 static WebViewImpl* FromPage(WebCore::Page* page); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 // Notifies the WebView that a load has been committed. | 190 // Notifies the WebView that a load has been committed. |
| 190 // is_new_navigation will be true if a new session history item should be | 191 // is_new_navigation will be true if a new session history item should be |
| 191 // created for that load. | 192 // created for that load. |
| 192 void DidCommitLoad(bool* is_new_navigation); | 193 void DidCommitLoad(bool* is_new_navigation); |
| 193 | 194 |
| 194 bool context_menu_allowed() const { | 195 bool context_menu_allowed() const { |
| 195 return context_menu_allowed_; | 196 return context_menu_allowed_; |
| 196 } | 197 } |
| 197 | 198 |
| 198 // Set the disposition for how this webview is to be initially shown. | 199 // Set the disposition for how this webview is to be initially shown. |
| 199 void set_window_open_disposition(WindowOpenDisposition disp) { | 200 void set_initial_navigation_policy(WebKit::WebNavigationPolicy policy) { |
| 200 window_open_disposition_ = disp; | 201 initial_navigation_policy_ = policy; |
| 201 } | 202 } |
| 202 WindowOpenDisposition window_open_disposition() const { | 203 WebKit::WebNavigationPolicy initial_navigation_policy() const { |
| 203 return window_open_disposition_; | 204 return initial_navigation_policy_; |
| 204 } | 205 } |
| 205 | 206 |
| 206 // Start a system drag and drop operation. | 207 // Start a system drag and drop operation. |
| 207 void StartDragging(const WebKit::WebDragData& drag_data); | 208 void StartDragging(const WebKit::WebDragData& drag_data); |
| 208 | 209 |
| 209 // Hides the autocomplete popup if it is showing. | 210 // Hides the autocomplete popup if it is showing. |
| 210 void HideAutoCompletePopup(); | 211 void HideAutoCompletePopup(); |
| 211 | 212 |
| 212 // Converts |x|, |y| from window coordinates to contents coordinates and gets | 213 // Converts |x|, |y| from window coordinates to contents coordinates and gets |
| 213 // the underlying Node for them. | 214 // the underlying Node for them. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 bool doing_drag_and_drop_; | 297 bool doing_drag_and_drop_; |
| 297 | 298 |
| 298 bool ignore_input_events_; | 299 bool ignore_input_events_; |
| 299 | 300 |
| 300 // Webkit expects keyPress events to be suppressed if the associated keyDown | 301 // Webkit expects keyPress events to be suppressed if the associated keyDown |
| 301 // event was handled. Safari implements this behavior by peeking out the | 302 // event was handled. Safari implements this behavior by peeking out the |
| 302 // associated WM_CHAR event if the keydown was handled. We emulate | 303 // associated WM_CHAR event if the keydown was handled. We emulate |
| 303 // this behavior by setting this flag if the keyDown was handled. | 304 // this behavior by setting this flag if the keyDown was handled. |
| 304 bool suppress_next_keypress_event_; | 305 bool suppress_next_keypress_event_; |
| 305 | 306 |
| 306 // The disposition for how this webview is to be initially shown. | 307 // The policy for how this webview is to be initially shown. |
| 307 WindowOpenDisposition window_open_disposition_; | 308 WebKit::WebNavigationPolicy initial_navigation_policy_; |
| 308 | 309 |
| 309 // Represents whether or not this object should process incoming IME events. | 310 // Represents whether or not this object should process incoming IME events. |
| 310 bool ime_accept_events_; | 311 bool ime_accept_events_; |
| 311 | 312 |
| 312 // True while dispatching system drag and drop events to drag/drop targets | 313 // True while dispatching system drag and drop events to drag/drop targets |
| 313 // within this WebView. | 314 // within this WebView. |
| 314 bool drag_target_dispatch_; | 315 bool drag_target_dispatch_; |
| 315 | 316 |
| 316 // Valid when drag_target_dispatch_ is true; the identity of the drag data | 317 // Valid when drag_target_dispatch_ is true; the identity of the drag data |
| 317 // copied from the WebDropData object sent from the browser process. | 318 // copied from the WebDropData object sent from the browser process. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 static const WebKit::WebInputEvent* current_input_event() { | 352 static const WebKit::WebInputEvent* current_input_event() { |
| 352 return g_current_input_event; | 353 return g_current_input_event; |
| 353 } | 354 } |
| 354 private: | 355 private: |
| 355 static const WebKit::WebInputEvent* g_current_input_event; | 356 static const WebKit::WebInputEvent* g_current_input_event; |
| 356 | 357 |
| 357 DISALLOW_COPY_AND_ASSIGN(WebViewImpl); | 358 DISALLOW_COPY_AND_ASSIGN(WebViewImpl); |
| 358 }; | 359 }; |
| 359 | 360 |
| 360 #endif // WEBKIT_GLUE_WEBVIEW_IMPL_H_ | 361 #endif // WEBKIT_GLUE_WEBVIEW_IMPL_H_ |
| OLD | NEW |