Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_GUEST_VIEW_BROWSER_GUEST_VIEW_BASE_H_ | 5 #ifndef COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_BASE_H_ |
| 6 #define COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_BASE_H_ | 6 #define COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_BASE_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 | 9 |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 75 static GuestViewBase* From(int owner_process_id, int instance_id); | 75 static GuestViewBase* From(int owner_process_id, int instance_id); |
| 76 | 76 |
| 77 // Given a |web_contents|, returns the top level owner WebContents. If | 77 // Given a |web_contents|, returns the top level owner WebContents. If |
| 78 // |web_contents| does not belong to a GuestView, it will be returned | 78 // |web_contents| does not belong to a GuestView, it will be returned |
| 79 // unchanged. | 79 // unchanged. |
| 80 static content::WebContents* GetTopLevelWebContents( | 80 static content::WebContents* GetTopLevelWebContents( |
| 81 content::WebContents* web_contents); | 81 content::WebContents* web_contents); |
| 82 | 82 |
| 83 static bool IsGuest(content::WebContents* web_contents); | 83 static bool IsGuest(content::WebContents* web_contents); |
| 84 | 84 |
| 85 // BrowserPluginGuestDelegate implementation. | |
| 86 void DidAttach(int guest_proxy_routing_id) final; | |
|
Fady Samuel
2015/10/09 22:35:19
Do DidAttach and WillAttach need to be public? Can
paulmeyer
2015/10/16 21:13:03
They need to be public because they are both calle
Fady Samuel
2015/10/16 21:17:28
I'd make GuestViewMessageFilter a friend instead.
paulmeyer
2015/10/21 19:45:12
Done.
| |
| 87 void WillAttach(content::WebContents* embedder_web_contents, | |
| 88 int browser_plugin_instance_id, | |
| 89 bool is_full_page_plugin, | |
| 90 const base::Closure& callback) final; | |
| 91 | |
| 92 // Returns the name of the derived type of this GuestView. | |
| 85 virtual const char* GetViewType() const = 0; | 93 virtual const char* GetViewType() const = 0; |
| 86 | 94 |
| 87 // This method is called after the guest has been attached to an embedder and | |
| 88 // suspended resource loads have been resumed. | |
| 89 // | |
| 90 // This method can be overriden by subclasses. This gives the derived class | |
| 91 // an opportunity to perform setup actions after attachment. | |
| 92 virtual void DidAttachToEmbedder() {} | |
| 93 | |
| 94 // This method is called after this GuestViewBase has been initiated. | |
| 95 // | |
| 96 // This gives the derived class an opportunity to perform additional | |
| 97 // initialization. | |
| 98 virtual void DidInitialize(const base::DictionaryValue& create_params) {} | |
| 99 | |
| 100 // This method is called when the initial set of frames within the page have | |
| 101 // completed loading. | |
| 102 virtual void GuestViewDidStopLoading() {} | |
| 103 | |
| 104 // This method is called when the embedder's zoom changes. | |
| 105 virtual void EmbedderZoomChanged(double old_zoom_level, | |
| 106 double new_zoom_level) {} | |
| 107 | |
| 108 // This method is called when the guest WebContents has been destroyed. This | |
| 109 // object will be destroyed after this call returns. | |
| 110 // | |
| 111 // This gives the derived class an opportunity to perform some cleanup. | |
| 112 virtual void GuestDestroyed() {} | |
| 113 | |
| 114 // This method is invoked when the guest RenderView is ready, e.g. because we | |
| 115 // recreated it after a crash or after reattachment. | |
| 116 // | |
| 117 // This gives the derived class an opportunity to perform some initialization | |
| 118 // work. | |
| 119 virtual void GuestReady() {} | |
| 120 | |
| 121 // This method is called when the guest's zoom changes. | |
| 122 virtual void GuestZoomChanged(double old_zoom_level, double new_zoom_level) {} | |
| 123 | |
| 124 // This method is called when embedder WebContents's fullscreen is toggled. | |
| 125 // | |
| 126 // If the guest asked the embedder to enter fullscreen, the guest uses this | |
| 127 // signal to exit fullscreen state. | |
| 128 virtual void EmbedderFullscreenToggled(bool entered_fullscreen) {} | |
| 129 | |
| 130 // This method is invoked when the contents auto-resized to give the container | |
| 131 // an opportunity to match it if it wishes. | |
| 132 // | |
| 133 // This gives the derived class an opportunity to inform its container element | |
| 134 // or perform other actions. | |
| 135 virtual void GuestSizeChangedDueToAutoSize(const gfx::Size& old_size, | |
| 136 const gfx::Size& new_size) {} | |
| 137 | |
| 138 // This method queries whether autosize is supported for this particular view. | 95 // This method queries whether autosize is supported for this particular view. |
| 139 // By default, autosize is not supported. Derived classes can override this | 96 // By default, autosize is not supported. Derived classes can override this |
| 140 // behavior to support autosize. | 97 // behavior to support autosize. |
| 141 virtual bool IsAutoSizeSupported() const; | 98 virtual bool IsAutoSizeSupported() const; |
| 142 | 99 |
| 143 // This method is invoked when the contents preferred size changes. This will | |
| 144 // only ever fire if IsPreferredSizeSupported returns true. | |
| 145 virtual void OnPreferredSizeChanged(const gfx::Size& pref_size) {} | |
| 146 | |
| 147 // This method queries whether preferred size events are enabled for this | 100 // This method queries whether preferred size events are enabled for this |
| 148 // view. By default, preferred size events are disabled, since they add a | 101 // view. By default, preferred size events are disabled, since they add a |
| 149 // small amount of overhead. | 102 // small amount of overhead. |
| 150 virtual bool IsPreferredSizeModeEnabled() const; | 103 virtual bool IsPreferredSizeModeEnabled() const; |
| 151 | 104 |
| 152 // This method is called immediately before suspended resource loads have been | 105 // This indicates whether zoom should propagate from the embedder to the guest |
| 153 // resumed on attachment to an embedder. | 106 // content. |
| 154 // | |
| 155 // This method can be overriden by subclasses. This gives the derived class | |
| 156 // an opportunity to perform setup actions before attachment. | |
| 157 virtual void WillAttachToEmbedder() {} | |
| 158 | |
| 159 // This method is called when the guest WebContents is about to be destroyed. | |
| 160 // | |
| 161 // This gives the derived class an opportunity to perform some cleanup prior | |
| 162 // to destruction. | |
| 163 virtual void WillDestroy() {} | |
| 164 | |
| 165 // This method is to be implemented by the derived class. This indicates | |
| 166 // whether zoom should propagate from the embedder to the guest content. | |
| 167 virtual bool ZoomPropagatesFromEmbedderToGuest() const; | 107 virtual bool ZoomPropagatesFromEmbedderToGuest() const; |
| 168 | 108 |
| 169 // This method is to be implemented by the derived class. Access to guest | 109 // Access to guest views are determined by the availability of the internal |
| 170 // views are determined by the availability of the internal extension API | 110 // extension API used to implement the guest view. |
| 171 // used to implement the guest view. | |
| 172 // | 111 // |
| 173 // This should be the name of the API as it appears in the _api_features.json | 112 // This should be the name of the API as it appears in the _api_features.json |
| 174 // file. | 113 // file. |
| 175 virtual const char* GetAPINamespace() const = 0; | 114 virtual const char* GetAPINamespace() const = 0; |
| 176 | 115 |
| 177 // This method is to be implemented by the derived class. This method is the | 116 // This method is the task prefix to show for a task produced by this |
| 178 // task prefix to show for a task produced by this GuestViewBase's derived | 117 // GuestViewBase's derived type. |
| 179 // type. | |
| 180 virtual int GetTaskPrefix() const = 0; | 118 virtual int GetTaskPrefix() const = 0; |
| 181 | 119 |
| 182 // This method is to be implemented by the derived class. Given a set of | 120 // Dispatches an event to the guest proxy. |
| 183 // initialization parameters, a concrete subclass of GuestViewBase can | 121 void DispatchEventToGuestProxy(GuestViewEvent* event); |
| 184 // create a specialized WebContents that it returns back to GuestViewBase. | 122 |
| 185 using WebContentsCreatedCallback = | 123 // Dispatches an event to the view. |
| 186 base::Callback<void(content::WebContents*)>; | 124 void DispatchEventToView(GuestViewEvent* event); |
| 187 virtual void CreateWebContents( | |
| 188 const base::DictionaryValue& create_params, | |
| 189 const WebContentsCreatedCallback& callback) = 0; | |
| 190 | 125 |
| 191 // This creates a WebContents and initializes |this| GuestViewBase to use the | 126 // This creates a WebContents and initializes |this| GuestViewBase to use the |
| 192 // newly created WebContents. | 127 // newly created WebContents. |
| 128 using WebContentsCreatedCallback = | |
| 129 base::Callback<void(content::WebContents*)>; | |
| 193 void Init(const base::DictionaryValue& create_params, | 130 void Init(const base::DictionaryValue& create_params, |
| 194 const WebContentsCreatedCallback& callback); | 131 const WebContentsCreatedCallback& callback); |
| 195 | 132 |
| 196 void InitWithWebContents(const base::DictionaryValue& create_params, | 133 void InitWithWebContents(const base::DictionaryValue& create_params, |
| 197 content::WebContents* guest_web_contents); | 134 content::WebContents* guest_web_contents); |
| 198 | 135 |
| 199 void LoadURLWithParams( | |
| 200 const content::NavigationController::LoadURLParams& load_params); | |
| 201 | |
| 202 bool IsViewType(const char* const view_type) const { | 136 bool IsViewType(const char* const view_type) const { |
| 203 return !strcmp(GetViewType(), view_type); | 137 return !strcmp(GetViewType(), view_type); |
| 204 } | 138 } |
| 205 | 139 |
| 206 // Used to toggle autosize mode for this GuestView, and set both the automatic | 140 // Used to toggle autosize mode for this GuestView, and set both the automatic |
| 207 // and normal sizes. | 141 // and normal sizes. |
| 208 void SetSize(const SetSizeParams& params); | 142 void SetSize(const SetSizeParams& params); |
| 209 | 143 |
| 210 bool initialized() const { return initialized_; } | 144 bool initialized() const { return initialized_; } |
| 211 | 145 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 264 // This value is only valid after attachment or first navigation. | 198 // This value is only valid after attachment or first navigation. |
| 265 int proxy_routing_id() const { return guest_proxy_routing_id_; } | 199 int proxy_routing_id() const { return guest_proxy_routing_id_; } |
| 266 | 200 |
| 267 // Destroy this guest. | 201 // Destroy this guest. |
| 268 void Destroy(); | 202 void Destroy(); |
| 269 | 203 |
| 270 // Saves the attach state of the custom element hosting this GuestView. | 204 // Saves the attach state of the custom element hosting this GuestView. |
| 271 void SetAttachParams(const base::DictionaryValue& params); | 205 void SetAttachParams(const base::DictionaryValue& params); |
| 272 void SetOpener(GuestViewBase* opener); | 206 void SetOpener(GuestViewBase* opener); |
| 273 | 207 |
| 274 content::WebContents* CreateNewGuestWindow( | |
| 275 const content::WebContents::CreateParams& create_params) final; | |
| 276 void DidAttach(int guest_proxy_routing_id) final; | |
| 277 void DidDetach() final; | |
| 278 content::WebContents* GetOwnerWebContents() const final; | |
| 279 bool Find(int request_id, | |
| 280 const base::string16& search_text, | |
| 281 const blink::WebFindOptions& options) final; | |
| 282 bool StopFinding(content::StopFindAction action) final; | |
| 283 void GuestSizeChanged(const gfx::Size& new_size) final; | |
| 284 void SetGuestHost(content::GuestHost* guest_host) final; | |
| 285 void WillAttach(content::WebContents* embedder_web_contents, | |
| 286 int browser_plugin_instance_id, | |
| 287 bool is_full_page_plugin, | |
| 288 const base::Closure& callback) final; | |
| 289 | |
| 290 // ui_zoom::ZoomObserver implementation. | |
| 291 void OnZoomChanged( | |
| 292 const ui_zoom::ZoomController::ZoomChangedEventData& data) final; | |
| 293 | |
| 294 // Dispatches an event to the guest proxy. | |
| 295 void DispatchEventToGuestProxy(GuestViewEvent* event); | |
| 296 | |
| 297 // Dispatches an event to the view. | |
| 298 void DispatchEventToView(GuestViewEvent* event); | |
| 299 | |
| 300 protected: | 208 protected: |
| 301 explicit GuestViewBase(content::WebContents* owner_web_contents); | 209 explicit GuestViewBase(content::WebContents* owner_web_contents); |
| 302 | 210 |
| 303 ~GuestViewBase() override; | 211 ~GuestViewBase() override; |
| 304 | 212 |
| 213 // BrowserPluginGuestDelegate implementation. | |
| 214 void SetContextMenuPosition(const gfx::Point& position) override; | |
| 215 | |
| 216 // WebContentsDelegate implementation. | |
| 217 void HandleKeyboardEvent( | |
| 218 content::WebContents* source, | |
| 219 const content::NativeWebKeyboardEvent& event) override; | |
| 220 bool PreHandleGestureEvent(content::WebContents* source, | |
| 221 const blink::WebGestureEvent& event) override; | |
| 222 void FindReply(content::WebContents* source, | |
| 223 int request_id, | |
| 224 int number_of_matches, | |
| 225 const gfx::Rect& selection_rect, | |
| 226 int active_match_ordinal, | |
| 227 bool final_update) override; | |
| 228 | |
| 229 // WebContentsObserver implementation. | |
| 230 void DidNavigateMainFrame( | |
| 231 const content::LoadCommittedDetails& details, | |
| 232 const content::FrameNavigateParams& params) override; | |
| 233 | |
| 234 // Given a set of initialization parameters, a concrete subclass of | |
| 235 // GuestViewBase can create a specialized WebContents that it returns back to | |
| 236 // GuestViewBase. | |
| 237 virtual void CreateWebContents( | |
| 238 const base::DictionaryValue& create_params, | |
| 239 const WebContentsCreatedCallback& callback) = 0; | |
| 240 | |
| 241 // This method is called after the guest has been attached to an embedder and | |
| 242 // suspended resource loads have been resumed. | |
| 243 // | |
| 244 // This method can be overriden by subclasses. This gives the derived class | |
| 245 // an opportunity to perform setup actions after attachment. | |
| 246 virtual void DidAttachToEmbedder() {} | |
| 247 | |
| 248 // This method is called after this GuestViewBase has been initiated. | |
| 249 // | |
| 250 // This gives the derived class an opportunity to perform additional | |
| 251 // initialization. | |
| 252 virtual void DidInitialize(const base::DictionaryValue& create_params) {} | |
| 253 | |
| 254 // This method is called when embedder WebContents's fullscreen is toggled. | |
| 255 // | |
| 256 // If the guest asked the embedder to enter fullscreen, the guest uses this | |
| 257 // signal to exit fullscreen state. | |
| 258 virtual void EmbedderFullscreenToggled(bool entered_fullscreen) {} | |
| 259 | |
| 260 // This method is called when the initial set of frames within the page have | |
| 261 // completed loading. | |
| 262 virtual void GuestViewDidStopLoading() {} | |
| 263 | |
| 264 // This method is called when the guest WebContents has been destroyed. This | |
| 265 // object will be destroyed after this call returns. | |
| 266 // | |
| 267 // This gives the derived class an opportunity to perform some cleanup. | |
| 268 virtual void GuestDestroyed() {} | |
| 269 | |
| 270 // This method is invoked when the guest RenderView is ready, e.g. because we | |
| 271 // recreated it after a crash or after reattachment. | |
| 272 // | |
| 273 // This gives the derived class an opportunity to perform some initialization | |
| 274 // work. | |
| 275 virtual void GuestReady() {} | |
| 276 | |
| 277 // This method is called when the guest's zoom changes. | |
| 278 virtual void GuestZoomChanged(double old_zoom_level, double new_zoom_level) {} | |
| 279 | |
| 280 // This method is invoked when the contents auto-resized to give the container | |
| 281 // an opportunity to match it if it wishes. | |
| 282 // | |
| 283 // This gives the derived class an opportunity to inform its container element | |
| 284 // or perform other actions. | |
| 285 virtual void GuestSizeChangedDueToAutoSize(const gfx::Size& old_size, | |
| 286 const gfx::Size& new_size) {} | |
| 287 | |
| 288 // This method is invoked when the contents preferred size changes. This will | |
| 289 // only ever fire if IsPreferredSizeSupported returns true. | |
| 290 virtual void OnPreferredSizeChanged(const gfx::Size& pref_size) {} | |
| 291 | |
| 292 // Signals that the guest view is ready. The default implementation signals | |
| 293 // immediately, but derived class can override this if they need to do | |
| 294 // asynchronous setup. | |
| 295 virtual void SignalWhenReady(const base::Closure& callback); | |
| 296 | |
| 297 // Returns true if this guest should handle find requests for its | |
| 298 // embedder. This should generally be true for guests that make up the | |
| 299 // entirety of the embedder's content. | |
| 300 virtual bool ShouldHandleFindRequestsForEmbedder() const; | |
| 301 | |
| 302 // This method is called immediately before suspended resource loads have been | |
| 303 // resumed on attachment to an embedder. | |
| 304 // | |
| 305 // This method can be overriden by subclasses. This gives the derived class | |
| 306 // an opportunity to perform setup actions before attachment. | |
| 307 virtual void WillAttachToEmbedder() {} | |
| 308 | |
| 309 // This method is called when the guest WebContents is about to be destroyed. | |
| 310 // | |
| 311 // This gives the derived class an opportunity to perform some cleanup prior | |
| 312 // to destruction. | |
| 313 virtual void WillDestroy() {} | |
| 314 | |
| 315 void LoadURLWithParams( | |
| 316 const content::NavigationController::LoadURLParams& load_params); | |
| 317 | |
| 305 // Convert sizes in pixels from logical to physical numbers of pixels. | 318 // Convert sizes in pixels from logical to physical numbers of pixels. |
| 306 // Note that a size can consist of a fractional number of logical pixels | 319 // Note that a size can consist of a fractional number of logical pixels |
| 307 // (hence |logical_pixels| is represented as a double), but will always | 320 // (hence |logical_pixels| is represented as a double), but will always |
| 308 // consist of an integral number of physical pixels (hence the return value | 321 // consist of an integral number of physical pixels (hence the return value |
| 309 // is represented as an int). | 322 // is represented as an int). |
| 310 int LogicalPixelsToPhysicalPixels(double logical_pixels) const; | 323 int LogicalPixelsToPhysicalPixels(double logical_pixels) const; |
| 311 | 324 |
| 312 // Convert sizes in pixels from physical to logical numbers of pixels. | 325 // Convert sizes in pixels from physical to logical numbers of pixels. |
| 313 // Note that a size can consist of a fractional number of logical pixels | 326 // Note that a size can consist of a fractional number of logical pixels |
| 314 // (hence the return value is represented as a double), but will always | 327 // (hence the return value is represented as a double), but will always |
| 315 // consist of an integral number of physical pixels (hence |physical_pixels| | 328 // consist of an integral number of physical pixels (hence |physical_pixels| |
| 316 // is represented as an int). | 329 // is represented as an int). |
| 317 double PhysicalPixelsToLogicalPixels(int physical_pixels) const; | 330 double PhysicalPixelsToLogicalPixels(int physical_pixels) const; |
| 318 | 331 |
| 319 // WebContentsObserver implementation. | 332 void SetGuestZoomLevelToMatchEmbedder(); |
| 320 void DidStopLoading() final; | 333 |
| 321 void RenderViewReady() final; | 334 private: |
| 322 void WebContentsDestroyed() final; | 335 class OwnerContentsObserver; |
| 323 void DidNavigateMainFrame( | 336 class OpenerLifetimeObserver; |
| 324 const content::LoadCommittedDetails& details, | 337 |
| 325 const content::FrameNavigateParams& params) override; | 338 // BrowserPluginGuestDelegate implementation. |
| 339 content::WebContents* CreateNewGuestWindow( | |
| 340 const content::WebContents::CreateParams& create_params) final; | |
| 341 void DidDetach() final; | |
| 342 content::WebContents* GetOwnerWebContents() const final; | |
| 343 bool Find(int request_id, | |
| 344 const base::string16& search_text, | |
| 345 const blink::WebFindOptions& options) final; | |
| 346 bool StopFinding(content::StopFindAction action) final; | |
| 347 void GuestSizeChanged(const gfx::Size& new_size) final; | |
| 348 void SetGuestHost(content::GuestHost* guest_host) final; | |
| 326 | 349 |
| 327 // WebContentsDelegate implementation. | 350 // WebContentsDelegate implementation. |
| 328 void ActivateContents(content::WebContents* contents) final; | 351 void ActivateContents(content::WebContents* contents) final; |
| 329 void DeactivateContents(content::WebContents* contents) final; | 352 void DeactivateContents(content::WebContents* contents) final; |
| 330 void ContentsMouseEvent(content::WebContents* source, | 353 void ContentsMouseEvent(content::WebContents* source, |
| 331 const gfx::Point& location, | 354 const gfx::Point& location, |
| 332 bool motion) override; | 355 bool motion) final; |
| 333 void ContentsZoomChange(bool zoom_in) override; | 356 void ContentsZoomChange(bool zoom_in) final; |
| 334 void HandleKeyboardEvent( | |
| 335 content::WebContents* source, | |
| 336 const content::NativeWebKeyboardEvent& event) override; | |
| 337 void LoadingStateChanged(content::WebContents* source, | 357 void LoadingStateChanged(content::WebContents* source, |
| 338 bool to_different_document) final; | 358 bool to_different_document) final; |
| 339 content::ColorChooser* OpenColorChooser( | 359 content::ColorChooser* OpenColorChooser( |
| 340 content::WebContents* web_contents, | 360 content::WebContents* web_contents, |
| 341 SkColor color, | 361 SkColor color, |
| 342 const std::vector<content::ColorSuggestion>& suggestions) override; | 362 const std::vector<content::ColorSuggestion>& suggestions) final; |
| 343 void ResizeDueToAutoResize(content::WebContents* web_contents, | 363 void ResizeDueToAutoResize(content::WebContents* web_contents, |
| 344 const gfx::Size& new_size) override; | 364 const gfx::Size& new_size) final; |
| 345 void RunFileChooser(content::WebContents* web_contents, | 365 void RunFileChooser(content::WebContents* web_contents, |
| 346 const content::FileChooserParams& params) override; | 366 const content::FileChooserParams& params) final; |
| 347 bool ShouldFocusPageAfterCrash() final; | 367 bool ShouldFocusPageAfterCrash() final; |
| 348 bool PreHandleGestureEvent(content::WebContents* source, | |
| 349 const blink::WebGestureEvent& event) override; | |
| 350 void UpdatePreferredSize(content::WebContents* web_contents, | 368 void UpdatePreferredSize(content::WebContents* web_contents, |
| 351 const gfx::Size& pref_size) final; | 369 const gfx::Size& pref_size) final; |
| 352 void UpdateTargetURL(content::WebContents* source, const GURL& url) override; | 370 void UpdateTargetURL(content::WebContents* source, const GURL& url) final; |
| 353 bool ShouldResumeRequestsForCreatedWindow() override; | 371 bool ShouldResumeRequestsForCreatedWindow() final; |
| 354 void FindReply(content::WebContents* source, | |
| 355 int request_id, | |
| 356 int number_of_matches, | |
| 357 const gfx::Rect& selection_rect, | |
| 358 int active_match_ordinal, | |
| 359 bool final_update) override; | |
| 360 | 372 |
| 361 void SetGuestZoomLevelToMatchEmbedder(); | 373 // WebContentsObserver implementation. |
| 374 void DidStopLoading() final; | |
| 375 void RenderViewReady() final; | |
| 376 void WebContentsDestroyed() final; | |
| 362 | 377 |
| 363 // Signals that the guest view is ready. The default implementation signals | 378 // ui_zoom::ZoomObserver implementation. |
| 364 // immediately, but derived class can override this if they need to do | 379 void OnZoomChanged( |
| 365 // asynchronous setup. | 380 const ui_zoom::ZoomController::ZoomChangedEventData& data) final; |
| 366 virtual void SignalWhenReady(const base::Closure& callback); | |
| 367 | |
| 368 // Returns true if this guest should handle find requests for its | |
| 369 // embedder. This should generally be true for guests that make up the | |
| 370 // entirety of the embedder's content. | |
| 371 virtual bool ShouldHandleFindRequestsForEmbedder() const; | |
| 372 | |
| 373 // BrowserPluginGuestDelegate implementation. | |
| 374 void SetContextMenuPosition(const gfx::Point& position) override; | |
| 375 | |
| 376 private: | |
| 377 class OwnerContentsObserver; | |
| 378 | |
| 379 class OpenerLifetimeObserver; | |
| 380 | 381 |
| 381 void SendQueuedEvents(); | 382 void SendQueuedEvents(); |
| 382 | 383 |
| 383 void CompleteInit(scoped_ptr<base::DictionaryValue> create_params, | 384 void CompleteInit(scoped_ptr<base::DictionaryValue> create_params, |
| 384 const WebContentsCreatedCallback& callback, | 385 const WebContentsCreatedCallback& callback, |
| 385 content::WebContents* guest_web_contents); | 386 content::WebContents* guest_web_contents); |
| 386 | 387 |
| 387 // Dispatches the onResize event to the embedder. | 388 // Dispatches the onResize event to the embedder. |
| 388 void DispatchOnResizeEvent(const gfx::Size& old_size, | 389 void DispatchOnResizeEvent(const gfx::Size& old_size, |
| 389 const gfx::Size& new_size); | 390 const gfx::Size& new_size); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 476 // This is used to ensure pending tasks will not fire after this object is | 477 // This is used to ensure pending tasks will not fire after this object is |
| 477 // destroyed. | 478 // destroyed. |
| 478 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; | 479 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; |
| 479 | 480 |
| 480 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); | 481 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); |
| 481 }; | 482 }; |
| 482 | 483 |
| 483 } // namespace guest_view | 484 } // namespace guest_view |
| 484 | 485 |
| 485 #endif // COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_BASE_H_ | 486 #endif // COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_BASE_H_ |
| OLD | NEW |