| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_PUBLIC_RENDERER_RENDER_VIEW_H_ | 5 #ifndef CONTENT_PUBLIC_RENDERER_RENDER_VIEW_H_ |
| 6 #define CONTENT_PUBLIC_RENDERER_RENDER_VIEW_H_ | 6 #define CONTENT_PUBLIC_RENDERER_RENDER_VIEW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 13 #include "content/public/common/top_controls_state.h" | 13 #include "content/public/common/top_controls_state.h" |
| 14 #include "ipc/ipc_sender.h" | 14 #include "ipc/ipc_sender.h" |
| 15 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" | 15 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" |
| 16 #include "third_party/WebKit/public/web/WebPageVisibilityState.h" | 16 #include "third_party/WebKit/public/web/WebPageVisibilityState.h" |
| 17 #include "ui/gfx/native_widget_types.h" | 17 #include "ui/gfx/native_widget_types.h" |
| 18 | 18 |
| 19 struct WebPreferences; | 19 struct WebPreferences; |
| 20 | 20 |
| 21 namespace WebKit { | 21 namespace blink { |
| 22 class WebFrame; | 22 class WebFrame; |
| 23 class WebNode; | 23 class WebNode; |
| 24 class WebPlugin; | 24 class WebPlugin; |
| 25 class WebString; | 25 class WebString; |
| 26 class WebURLRequest; | 26 class WebURLRequest; |
| 27 class WebView; | 27 class WebView; |
| 28 struct WebContextMenuData; | 28 struct WebContextMenuData; |
| 29 struct WebPluginParams; | 29 struct WebPluginParams; |
| 30 } | 30 } |
| 31 | 31 |
| 32 namespace gfx { | 32 namespace gfx { |
| 33 class Size; | 33 class Size; |
| 34 } | 34 } |
| 35 | 35 |
| 36 namespace content { | 36 namespace content { |
| 37 | 37 |
| 38 class ContextMenuClient; | 38 class ContextMenuClient; |
| 39 class RenderViewVisitor; | 39 class RenderViewVisitor; |
| 40 struct ContextMenuParams; | 40 struct ContextMenuParams; |
| 41 struct SSLStatus; | 41 struct SSLStatus; |
| 42 struct WebPluginInfo; | 42 struct WebPluginInfo; |
| 43 | 43 |
| 44 class CONTENT_EXPORT RenderView : public IPC::Sender { | 44 class CONTENT_EXPORT RenderView : public IPC::Sender { |
| 45 public: | 45 public: |
| 46 // Returns the RenderView containing the given WebView. | 46 // Returns the RenderView containing the given WebView. |
| 47 static RenderView* FromWebView(WebKit::WebView* webview); | 47 static RenderView* FromWebView(blink::WebView* webview); |
| 48 | 48 |
| 49 // Returns the RenderView for the given routing ID. | 49 // Returns the RenderView for the given routing ID. |
| 50 static RenderView* FromRoutingID(int routing_id); | 50 static RenderView* FromRoutingID(int routing_id); |
| 51 | 51 |
| 52 // Visit all RenderViews with a live WebView (i.e., RenderViews that have | 52 // Visit all RenderViews with a live WebView (i.e., RenderViews that have |
| 53 // been closed but not yet destroyed are excluded). | 53 // been closed but not yet destroyed are excluded). |
| 54 static void ForEach(RenderViewVisitor* visitor); | 54 static void ForEach(RenderViewVisitor* visitor); |
| 55 | 55 |
| 56 // Get the routing ID of the view. | 56 // Get the routing ID of the view. |
| 57 virtual int GetRoutingID() const = 0; | 57 virtual int GetRoutingID() const = 0; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 68 virtual gfx::Size GetSize() const = 0; | 68 virtual gfx::Size GetSize() const = 0; |
| 69 | 69 |
| 70 // Gets WebKit related preferences associated with this view. | 70 // Gets WebKit related preferences associated with this view. |
| 71 virtual WebPreferences& GetWebkitPreferences() = 0; | 71 virtual WebPreferences& GetWebkitPreferences() = 0; |
| 72 | 72 |
| 73 // Overrides the WebKit related preferences associated with this view. Note | 73 // Overrides the WebKit related preferences associated with this view. Note |
| 74 // that the browser process may update the preferences at any time. | 74 // that the browser process may update the preferences at any time. |
| 75 virtual void SetWebkitPreferences(const WebPreferences& preferences) = 0; | 75 virtual void SetWebkitPreferences(const WebPreferences& preferences) = 0; |
| 76 | 76 |
| 77 // Returns the associated WebView. May return NULL when the view is closing. | 77 // Returns the associated WebView. May return NULL when the view is closing. |
| 78 virtual WebKit::WebView* GetWebView() = 0; | 78 virtual blink::WebView* GetWebView() = 0; |
| 79 | 79 |
| 80 // Gets the focused node. If no such node exists then the node will be isNull. | 80 // Gets the focused node. If no such node exists then the node will be isNull. |
| 81 virtual WebKit::WebNode GetFocusedNode() const = 0; | 81 virtual blink::WebNode GetFocusedNode() const = 0; |
| 82 | 82 |
| 83 // Gets the node that the context menu was pressed over. | 83 // Gets the node that the context menu was pressed over. |
| 84 virtual WebKit::WebNode GetContextMenuNode() const = 0; | 84 virtual blink::WebNode GetContextMenuNode() const = 0; |
| 85 | 85 |
| 86 // Returns true if the parameter node is a textfield, text area, a content | 86 // Returns true if the parameter node is a textfield, text area, a content |
| 87 // editable div, or has an ARIA role of textbox. | 87 // editable div, or has an ARIA role of textbox. |
| 88 virtual bool IsEditableNode(const WebKit::WebNode& node) const = 0; | 88 virtual bool IsEditableNode(const blink::WebNode& node) const = 0; |
| 89 | 89 |
| 90 // Create a new NPAPI/Pepper plugin depending on |info|. Returns NULL if no | 90 // Create a new NPAPI/Pepper plugin depending on |info|. Returns NULL if no |
| 91 // plugin was found. | 91 // plugin was found. |
| 92 virtual WebKit::WebPlugin* CreatePlugin( | 92 virtual blink::WebPlugin* CreatePlugin( |
| 93 WebKit::WebFrame* frame, | 93 blink::WebFrame* frame, |
| 94 const WebPluginInfo& info, | 94 const WebPluginInfo& info, |
| 95 const WebKit::WebPluginParams& params) = 0; | 95 const blink::WebPluginParams& params) = 0; |
| 96 | 96 |
| 97 // Evaluates a string of JavaScript in a particular frame. | 97 // Evaluates a string of JavaScript in a particular frame. |
| 98 virtual void EvaluateScript(const string16& frame_xpath, | 98 virtual void EvaluateScript(const string16& frame_xpath, |
| 99 const string16& jscript, | 99 const string16& jscript, |
| 100 int id, | 100 int id, |
| 101 bool notify_result) = 0; | 101 bool notify_result) = 0; |
| 102 | 102 |
| 103 // Returns true if we should display scrollbars for the given view size and | 103 // Returns true if we should display scrollbars for the given view size and |
| 104 // false if the scrollbars should be hidden. | 104 // false if the scrollbars should be hidden. |
| 105 virtual bool ShouldDisplayScrollbars(int width, int height) const = 0; | 105 virtual bool ShouldDisplayScrollbars(int width, int height) const = 0; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 128 // Note: if you end up having clients outliving the RenderView, we should add | 128 // Note: if you end up having clients outliving the RenderView, we should add |
| 129 // a CancelContextMenuCallback function that takes a request id. | 129 // a CancelContextMenuCallback function that takes a request id. |
| 130 virtual int ShowContextMenu(ContextMenuClient* client, | 130 virtual int ShowContextMenu(ContextMenuClient* client, |
| 131 const ContextMenuParams& params) = 0; | 131 const ContextMenuParams& params) = 0; |
| 132 | 132 |
| 133 // Cancels a context menu in the event that the client is destroyed before the | 133 // Cancels a context menu in the event that the client is destroyed before the |
| 134 // menu is closed. | 134 // menu is closed. |
| 135 virtual void CancelContextMenu(int request_id) = 0; | 135 virtual void CancelContextMenu(int request_id) = 0; |
| 136 | 136 |
| 137 // Returns the current visibility of the WebView. | 137 // Returns the current visibility of the WebView. |
| 138 virtual WebKit::WebPageVisibilityState GetVisibilityState() const = 0; | 138 virtual blink::WebPageVisibilityState GetVisibilityState() const = 0; |
| 139 | 139 |
| 140 // Displays a modal alert dialog containing the given message. Returns | 140 // Displays a modal alert dialog containing the given message. Returns |
| 141 // once the user dismisses the dialog. | 141 // once the user dismisses the dialog. |
| 142 virtual void RunModalAlertDialog(WebKit::WebFrame* frame, | 142 virtual void RunModalAlertDialog(blink::WebFrame* frame, |
| 143 const WebKit::WebString& message) = 0; | 143 const blink::WebString& message) = 0; |
| 144 | 144 |
| 145 // The client should handle the navigation externally. | 145 // The client should handle the navigation externally. |
| 146 virtual void LoadURLExternally( | 146 virtual void LoadURLExternally( |
| 147 WebKit::WebFrame* frame, | 147 blink::WebFrame* frame, |
| 148 const WebKit::WebURLRequest& request, | 148 const blink::WebURLRequest& request, |
| 149 WebKit::WebNavigationPolicy policy) = 0; | 149 blink::WebNavigationPolicy policy) = 0; |
| 150 | 150 |
| 151 // Used by plugins that load data in this RenderView to update the loading | 151 // Used by plugins that load data in this RenderView to update the loading |
| 152 // notifications. | 152 // notifications. |
| 153 virtual void DidStartLoading() = 0; | 153 virtual void DidStartLoading() = 0; |
| 154 virtual void DidStopLoading() = 0; | 154 virtual void DidStopLoading() = 0; |
| 155 | 155 |
| 156 // Notifies the renderer that a paint is to be generated for the size | 156 // Notifies the renderer that a paint is to be generated for the size |
| 157 // passed in. | 157 // passed in. |
| 158 virtual void Repaint(const gfx::Size& size) = 0; | 158 virtual void Repaint(const gfx::Size& size) = 0; |
| 159 | 159 |
| 160 // Inject edit commands to be used for the next keyboard event. | 160 // Inject edit commands to be used for the next keyboard event. |
| 161 virtual void SetEditCommandForNextKeyEvent(const std::string& name, | 161 virtual void SetEditCommandForNextKeyEvent(const std::string& name, |
| 162 const std::string& value) = 0; | 162 const std::string& value) = 0; |
| 163 virtual void ClearEditCommands() = 0; | 163 virtual void ClearEditCommands() = 0; |
| 164 | 164 |
| 165 // Returns a collection of security info about |frame|. | 165 // Returns a collection of security info about |frame|. |
| 166 virtual SSLStatus GetSSLStatusOfFrame(WebKit::WebFrame* frame) const = 0; | 166 virtual SSLStatus GetSSLStatusOfFrame(blink::WebFrame* frame) const = 0; |
| 167 | 167 |
| 168 // Returns |renderer_preferences_.accept_languages| value. | 168 // Returns |renderer_preferences_.accept_languages| value. |
| 169 virtual const std::string& GetAcceptLanguages() const = 0; | 169 virtual const std::string& GetAcceptLanguages() const = 0; |
| 170 | 170 |
| 171 #if defined(OS_ANDROID) | 171 #if defined(OS_ANDROID) |
| 172 virtual void UpdateTopControlsState(TopControlsState constraints, | 172 virtual void UpdateTopControlsState(TopControlsState constraints, |
| 173 TopControlsState current, | 173 TopControlsState current, |
| 174 bool animate) = 0; | 174 bool animate) = 0; |
| 175 #endif | 175 #endif |
| 176 | 176 |
| 177 protected: | 177 protected: |
| 178 virtual ~RenderView() {} | 178 virtual ~RenderView() {} |
| 179 | 179 |
| 180 private: | 180 private: |
| 181 // This interface should only be implemented inside content. | 181 // This interface should only be implemented inside content. |
| 182 friend class RenderViewImpl; | 182 friend class RenderViewImpl; |
| 183 RenderView() {} | 183 RenderView() {} |
| 184 }; | 184 }; |
| 185 | 185 |
| 186 } // namespace content | 186 } // namespace content |
| 187 | 187 |
| 188 #endif // CONTENT_PUBLIC_RENDERER_RENDER_VIEW_H_ | 188 #endif // CONTENT_PUBLIC_RENDERER_RENDER_VIEW_H_ |
| OLD | NEW |