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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 void RegisterDestructionCallback(const DestructionCallback& callback) final; | 262 void RegisterDestructionCallback(const DestructionCallback& callback) final; |
263 void SetGuestSizer(content::GuestSizer* guest_sizer) final; | 263 void SetGuestSizer(content::GuestSizer* guest_sizer) final; |
264 void WillAttach(content::WebContents* embedder_web_contents, | 264 void WillAttach(content::WebContents* embedder_web_contents, |
265 int browser_plugin_instance_id, | 265 int browser_plugin_instance_id, |
266 bool is_full_page_plugin) final; | 266 bool is_full_page_plugin) final; |
267 | 267 |
268 // ui_zoom::ZoomObserver implementation. | 268 // ui_zoom::ZoomObserver implementation. |
269 void OnZoomChanged( | 269 void OnZoomChanged( |
270 const ui_zoom::ZoomController::ZoomChangedEventData& data) override; | 270 const ui_zoom::ZoomController::ZoomChangedEventData& data) override; |
271 | 271 |
272 // Dispatches an event |event_name| to the embedder with the |event| fields. | 272 // Dispatches an event to the guest proxy. |
273 void DispatchEventToEmbedder(Event* event); | 273 void DispatchEventToGuestProxy(Event* event); |
| 274 |
| 275 // Dispatches an event to the view. |
| 276 void DispatchEventToView(Event* event); |
274 | 277 |
275 protected: | 278 protected: |
276 GuestViewBase(content::WebContents* owner_web_contents, | 279 GuestViewBase(content::WebContents* owner_web_contents, |
277 int guest_instance_id); | 280 int guest_instance_id); |
278 | 281 |
279 ~GuestViewBase() override; | 282 ~GuestViewBase() override; |
280 | 283 |
281 private: | 284 private: |
282 class OwnerLifetimeObserver; | 285 class OwnerLifetimeObserver; |
283 | 286 |
284 class OpenerLifetimeObserver; | 287 class OpenerLifetimeObserver; |
285 | 288 |
| 289 void DispatchEvent(Event* event, int instance_id); |
| 290 |
286 void SendQueuedEvents(); | 291 void SendQueuedEvents(); |
287 | 292 |
288 void CompleteInit(scoped_ptr<base::DictionaryValue> create_params, | 293 void CompleteInit(scoped_ptr<base::DictionaryValue> create_params, |
289 const WebContentsCreatedCallback& callback, | 294 const WebContentsCreatedCallback& callback, |
290 content::WebContents* guest_web_contents); | 295 content::WebContents* guest_web_contents); |
291 | 296 |
| 297 // Dispatches the onResize event to the embedder. |
| 298 void DispatchOnResizeEvent(const gfx::Size& old_size, |
| 299 const gfx::Size& new_size); |
| 300 |
292 void SetUpAutoSize(const base::DictionaryValue& params); | 301 void SetUpAutoSize(const base::DictionaryValue& params); |
293 | 302 |
294 void StartTrackingEmbedderZoomLevel(); | 303 void StartTrackingEmbedderZoomLevel(); |
295 void StopTrackingEmbedderZoomLevel(); | 304 void StopTrackingEmbedderZoomLevel(); |
296 | 305 |
297 static void RegisterGuestViewTypes(); | 306 static void RegisterGuestViewTypes(); |
298 | 307 |
299 // WebContentsObserver implementation. | 308 // WebContentsObserver implementation. |
300 void DidStopLoading(content::RenderViewHost* render_view_host) final; | 309 void DidStopLoading(content::RenderViewHost* render_view_host) final; |
301 void RenderViewReady() final; | 310 void RenderViewReady() final; |
(...skipping 88 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 |