| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ | 5 #ifndef COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ |
| 6 #define COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ | 6 #define COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 blink::WebView* web_view() { return web_view_; } | 74 blink::WebView* web_view() { return web_view_; } |
| 75 | 75 |
| 76 // When loading a plugin document (i.e. a full page plugin not embedded in | 76 // When loading a plugin document (i.e. a full page plugin not embedded in |
| 77 // another page), we save all data that has been received, and replay it with | 77 // another page), we save all data that has been received, and replay it with |
| 78 // this method on the actual plugin. | 78 // this method on the actual plugin. |
| 79 void ReplayReceivedData(blink::WebPlugin* plugin); | 79 void ReplayReceivedData(blink::WebPlugin* plugin); |
| 80 | 80 |
| 81 void RestoreTitleText(); | 81 void RestoreTitleText(); |
| 82 | 82 |
| 83 // WebPlugin methods: | 83 // WebPlugin methods: |
| 84 virtual blink::WebPluginContainer* container() const; | 84 blink::WebPluginContainer* container() const override; |
| 85 virtual bool initialize(blink::WebPluginContainer*); | 85 bool initialize(blink::WebPluginContainer*) override; |
| 86 virtual void destroy(); | 86 void destroy() override; |
| 87 | 87 |
| 88 virtual v8::Local<v8::Object> v8ScriptableObject(v8::Isolate* isolate); | 88 v8::Local<v8::Object> v8ScriptableObject(v8::Isolate* isolate) override; |
| 89 | 89 |
| 90 virtual void layoutIfNeeded() override; | 90 void layoutIfNeeded() override; |
| 91 virtual void paint(blink::WebCanvas* canvas, | 91 void paint(blink::WebCanvas* canvas, const blink::WebRect& rect) override; |
| 92 const blink::WebRect& rect) override; | |
| 93 | 92 |
| 94 // Coordinates are relative to the containing window. | 93 // Coordinates are relative to the containing window. |
| 95 virtual void updateGeometry( | 94 void updateGeometry(const blink::WebRect& window_rect, |
| 96 const blink::WebRect& window_rect, | 95 const blink::WebRect& clip_rect, |
| 97 const blink::WebRect& clip_rect, | 96 const blink::WebRect& unobscured_rect, |
| 98 const blink::WebRect& unobscured_rect, | 97 const blink::WebVector<blink::WebRect>& cut_outs_rects, |
| 99 const blink::WebVector<blink::WebRect>& cut_outs_rects, | 98 bool is_visible) override; |
| 100 bool is_visible); | |
| 101 | 99 |
| 102 virtual void updateFocus(bool foucsed, blink::WebFocusType focus_type); | 100 void updateFocus(bool foucsed, blink::WebFocusType focus_type) override; |
| 103 virtual void updateVisibility(bool) {} | 101 void updateVisibility(bool) override {} |
| 104 | 102 |
| 105 virtual bool acceptsInputEvents(); | 103 bool acceptsInputEvents() override; |
| 106 virtual bool handleInputEvent(const blink::WebInputEvent& event, | 104 bool handleInputEvent(const blink::WebInputEvent& event, |
| 107 blink::WebCursorInfo& cursor_info); | 105 blink::WebCursorInfo& cursor_info) override; |
| 108 | 106 |
| 109 virtual void didReceiveResponse(const blink::WebURLResponse& response); | 107 void didReceiveResponse(const blink::WebURLResponse& response) override; |
| 110 virtual void didReceiveData(const char* data, int data_length); | 108 void didReceiveData(const char* data, int data_length) override; |
| 111 virtual void didFinishLoading(); | 109 void didFinishLoading() override; |
| 112 virtual void didFailLoading(const blink::WebURLError& error); | 110 void didFailLoading(const blink::WebURLError& error) override; |
| 113 | 111 |
| 114 // Called in response to WebPluginContainer::loadFrameRequest | 112 // Called in response to WebPluginContainer::loadFrameRequest |
| 115 virtual void didFinishLoadingFrameRequest(const blink::WebURL& url, | 113 void didFinishLoadingFrameRequest(const blink::WebURL& url, |
| 116 void* notifyData) {} | 114 void* notifyData) override {} |
| 117 virtual void didFailLoadingFrameRequest(const blink::WebURL& url, | 115 void didFailLoadingFrameRequest(const blink::WebURL& url, |
| 118 void* notify_data, | 116 void* notify_data, |
| 119 const blink::WebURLError& error) {} | 117 const blink::WebURLError& error) override {} |
| 120 | 118 |
| 121 // WebViewClient methods: | 119 // WebViewClient methods: |
| 122 virtual bool acceptsLoadDrops(); | 120 bool acceptsLoadDrops() override; |
| 123 | 121 |
| 124 virtual void setToolTipText(const blink::WebString&, | 122 void setToolTipText(const blink::WebString&, |
| 125 blink::WebTextDirection); | 123 blink::WebTextDirection) override; |
| 126 | 124 |
| 127 virtual void startDragging(blink::WebLocalFrame* frame, | 125 void startDragging(blink::WebLocalFrame* frame, |
| 128 const blink::WebDragData& drag_data, | 126 const blink::WebDragData& drag_data, |
| 129 blink::WebDragOperationsMask mask, | 127 blink::WebDragOperationsMask mask, |
| 130 const blink::WebImage& image, | 128 const blink::WebImage& image, |
| 131 const blink::WebPoint& point); | 129 const blink::WebPoint& point) override; |
| 132 | 130 |
| 133 // TODO(ojan): Remove this override and have this class use a non-null | 131 // TODO(ojan): Remove this override and have this class use a non-null |
| 134 // layerTreeView. | 132 // layerTreeView. |
| 135 virtual bool allowsBrokenNullLayerTreeView() const; | 133 bool allowsBrokenNullLayerTreeView() const override; |
| 136 | 134 |
| 137 // WebWidgetClient methods: | 135 // WebWidgetClient methods: |
| 138 virtual void didInvalidateRect(const blink::WebRect&); | 136 void didInvalidateRect(const blink::WebRect&) override; |
| 139 virtual void didUpdateLayoutSize(const blink::WebSize&); | 137 void didUpdateLayoutSize(const blink::WebSize&) override; |
| 140 virtual void didChangeCursor(const blink::WebCursorInfo& cursor); | 138 void didChangeCursor(const blink::WebCursorInfo& cursor) override; |
| 141 virtual void scheduleAnimation(); | 139 void scheduleAnimation() override; |
| 142 | 140 |
| 143 // WebFrameClient methods: | 141 // WebFrameClient methods: |
| 144 virtual void didClearWindowObject(blink::WebLocalFrame* frame); | 142 void didClearWindowObject(blink::WebLocalFrame* frame) override; |
| 145 | 143 |
| 146 // This method is defined in WebPlugin as well as in WebFrameClient, but with | 144 // This method is defined in WebPlugin as well as in WebFrameClient, but with |
| 147 // different parameters. We only care about implementing the WebPlugin | 145 // different parameters. We only care about implementing the WebPlugin |
| 148 // version, so we implement this method and call the default in WebFrameClient | 146 // version, so we implement this method and call the default in WebFrameClient |
| 149 // (which does nothing) to correctly overload it. | 147 // (which does nothing) to correctly overload it. |
| 150 virtual void didReceiveResponse(blink::WebLocalFrame* frame, | 148 void didReceiveResponse(blink::WebLocalFrame* frame, |
| 151 unsigned identifier, | 149 unsigned identifier, |
| 152 const blink::WebURLResponse& response); | 150 const blink::WebURLResponse& response) override; |
| 153 | 151 |
| 154 private: | 152 private: |
| 155 friend class base::DeleteHelper<WebViewPlugin>; | 153 friend class base::DeleteHelper<WebViewPlugin>; |
| 156 WebViewPlugin(content::RenderView* render_view, | 154 WebViewPlugin(content::RenderView* render_view, |
| 157 Delegate* delegate, | 155 Delegate* delegate, |
| 158 const content::WebPreferences& preferences); | 156 const content::WebPreferences& preferences); |
| 159 virtual ~WebViewPlugin(); | 157 ~WebViewPlugin() override; |
| 160 | 158 |
| 161 // content::RenderViewObserver methods: | 159 // content::RenderViewObserver methods: |
| 162 void OnDestruct() override; | 160 void OnDestruct() override; |
| 163 void OnZoomLevelChanged() override; | 161 void OnZoomLevelChanged() override; |
| 164 | 162 |
| 165 // Manages its own lifetime. | 163 // Manages its own lifetime. |
| 166 Delegate* delegate_; | 164 Delegate* delegate_; |
| 167 | 165 |
| 168 blink::WebCursorInfo current_cursor_; | 166 blink::WebCursorInfo current_cursor_; |
| 169 | 167 |
| 170 // Owns us. | 168 // Owns us. |
| 171 blink::WebPluginContainer* container_; | 169 blink::WebPluginContainer* container_; |
| 172 | 170 |
| 173 // Owned by us, deleted via |close()|. | 171 // Owned by us, deleted via |close()|. |
| 174 blink::WebView* web_view_; | 172 blink::WebView* web_view_; |
| 175 | 173 |
| 176 // Owned by us, deleted via |close()|. | 174 // Owned by us, deleted via |close()|. |
| 177 blink::WebFrame* web_frame_; | 175 blink::WebFrame* web_frame_; |
| 178 gfx::Rect rect_; | 176 gfx::Rect rect_; |
| 179 | 177 |
| 180 blink::WebURLResponse response_; | 178 blink::WebURLResponse response_; |
| 181 std::list<std::string> data_; | 179 std::list<std::string> data_; |
| 182 scoped_ptr<blink::WebURLError> error_; | 180 scoped_ptr<blink::WebURLError> error_; |
| 183 blink::WebString old_title_; | 181 blink::WebString old_title_; |
| 184 bool finished_loading_; | 182 bool finished_loading_; |
| 185 bool focused_; | 183 bool focused_; |
| 186 }; | 184 }; |
| 187 | 185 |
| 188 #endif // COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ | 186 #endif // COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ |
| OLD | NEW |