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 EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ | 5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ |
6 #define EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ | 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 void RegisterDestructionCallback(const DestructionCallback& callback) final; | 265 void RegisterDestructionCallback(const DestructionCallback& callback) final; |
266 void SetGuestSizer(content::GuestSizer* guest_sizer) final; | 266 void SetGuestSizer(content::GuestSizer* guest_sizer) final; |
267 void WillAttach(content::WebContents* embedder_web_contents, | 267 void WillAttach(content::WebContents* embedder_web_contents, |
268 int browser_plugin_instance_id, | 268 int browser_plugin_instance_id, |
269 bool is_full_page_plugin) final; | 269 bool is_full_page_plugin) final; |
270 | 270 |
271 // ui_zoom::ZoomObserver implementation. | 271 // ui_zoom::ZoomObserver implementation. |
272 void OnZoomChanged( | 272 void OnZoomChanged( |
273 const ui_zoom::ZoomController::ZoomChangedEventData& data) override; | 273 const ui_zoom::ZoomController::ZoomChangedEventData& data) override; |
274 | 274 |
275 // Dispatches an event |event_name| to the embedder with the |event| fields. | 275 // Dispatches an event to the guest proxy. |
276 void DispatchEventToEmbedder(Event* event); | 276 void DispatchEventToGuestProxy(Event* event); |
| 277 |
| 278 // Dispatches an event to the view. |
| 279 void DispatchEventToView(Event* event); |
277 | 280 |
278 protected: | 281 protected: |
279 GuestViewBase(content::BrowserContext* browser_context, | 282 GuestViewBase(content::BrowserContext* browser_context, |
280 content::WebContents* owner_web_contents, | 283 content::WebContents* owner_web_contents, |
281 int guest_instance_id); | 284 int guest_instance_id); |
282 | 285 |
283 ~GuestViewBase() override; | 286 ~GuestViewBase() override; |
284 | 287 |
285 private: | 288 private: |
286 class OwnerLifetimeObserver; | 289 class OwnerLifetimeObserver; |
287 | 290 |
288 class OpenerLifetimeObserver; | 291 class OpenerLifetimeObserver; |
289 | 292 |
| 293 void DispatchEvent(Event* event, int instance_id); |
| 294 |
290 void SendQueuedEvents(); | 295 void SendQueuedEvents(); |
291 | 296 |
292 void CompleteInit(scoped_ptr<base::DictionaryValue> create_params, | 297 void CompleteInit(scoped_ptr<base::DictionaryValue> create_params, |
293 const WebContentsCreatedCallback& callback, | 298 const WebContentsCreatedCallback& callback, |
294 content::WebContents* guest_web_contents); | 299 content::WebContents* guest_web_contents); |
295 | 300 |
| 301 // Dispatches the onResize event to the embedder. |
| 302 void DispatchOnResizeEvent(const gfx::Size& old_size, |
| 303 const gfx::Size& new_size); |
| 304 |
296 void SetUpAutoSize(const base::DictionaryValue& params); | 305 void SetUpAutoSize(const base::DictionaryValue& params); |
297 | 306 |
298 void StartTrackingEmbedderZoomLevel(); | 307 void StartTrackingEmbedderZoomLevel(); |
299 void StopTrackingEmbedderZoomLevel(); | 308 void StopTrackingEmbedderZoomLevel(); |
300 | 309 |
301 static void RegisterGuestViewTypes(); | 310 static void RegisterGuestViewTypes(); |
302 | 311 |
303 // WebContentsObserver implementation. | 312 // WebContentsObserver implementation. |
304 void DidStopLoading(content::RenderViewHost* render_view_host) final; | 313 void DidStopLoading(content::RenderViewHost* render_view_host) final; |
305 void RenderViewReady() final; | 314 void RenderViewReady() final; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 // This is used to ensure pending tasks will not fire after this object is | 399 // This is used to ensure pending tasks will not fire after this object is |
391 // destroyed. | 400 // destroyed. |
392 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; | 401 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; |
393 | 402 |
394 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); | 403 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); |
395 }; | 404 }; |
396 | 405 |
397 } // namespace extensions | 406 } // namespace extensions |
398 | 407 |
399 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ | 408 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ |
OLD | NEW |