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 #include "extensions/browser/guest_view/guest_view_base.h" | 5 #include "extensions/browser/guest_view/guest_view_base.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "components/ui/zoom/page_zoom.h" | 9 #include "components/ui/zoom/page_zoom.h" |
10 #include "components/ui/zoom/zoom_controller.h" | 10 #include "components/ui/zoom/zoom_controller.h" |
11 #include "content/public/browser/navigation_details.h" | 11 #include "content/public/browser/navigation_details.h" |
12 #include "content/public/browser/render_frame_host.h" | 12 #include "content/public/browser/render_frame_host.h" |
13 #include "content/public/browser/render_process_host.h" | 13 #include "content/public/browser/render_process_host.h" |
14 #include "content/public/browser/render_view_host.h" | 14 #include "content/public/browser/render_view_host.h" |
15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
16 #include "content/public/common/page_zoom.h" | 16 #include "content/public/common/page_zoom.h" |
17 #include "content/public/common/url_constants.h" | 17 #include "content/public/common/url_constants.h" |
18 #include "extensions/browser/api/extensions_api_client.h" | 18 #include "extensions/browser/api/extensions_api_client.h" |
19 #include "extensions/browser/event_router.h" | 19 #include "extensions/browser/event_router.h" |
20 #include "extensions/browser/extension_registry.h" | 20 #include "extensions/browser/extension_registry.h" |
21 #include "extensions/browser/guest_view/app_view/app_view_guest.h" | 21 #include "extensions/browser/guest_view/app_view/app_view_guest.h" |
22 #include "extensions/browser/guest_view/extension_options/extension_options_gues
t.h" | 22 #include "extensions/browser/guest_view/extension_options/extension_options_gues
t.h" |
23 #include "extensions/browser/guest_view/extension_view/extension_view_guest.h" | 23 #include "extensions/browser/guest_view/extension_view/extension_view_guest.h" |
24 #include "extensions/browser/guest_view/guest_view_manager.h" | 24 #include "extensions/browser/guest_view/guest_view_manager.h" |
25 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_gues
t.h" | 25 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_gues
t.h" |
26 #include "extensions/browser/guest_view/surface_worker/surface_worker_guest.h" | 26 #include "extensions/browser/guest_view/surface_worker/surface_worker_guest.h" |
27 #include "extensions/browser/guest_view/web_view/web_view_guest.h" | 27 #include "extensions/browser/guest_view/web_view/web_view_guest.h" |
28 #include "extensions/browser/process_manager.h" | 28 #include "extensions/browser/process_manager.h" |
29 #include "extensions/browser/process_map.h" | 29 #include "extensions/browser/process_map.h" |
30 #include "extensions/common/extension_messages.h" | |
31 #include "extensions/common/features/feature.h" | 30 #include "extensions/common/features/feature.h" |
32 #include "extensions/common/features/feature_provider.h" | 31 #include "extensions/common/features/feature_provider.h" |
33 #include "extensions/common/guest_view/guest_view_constants.h" | 32 #include "extensions/common/guest_view/guest_view_constants.h" |
| 33 #include "extensions/common/guest_view/guest_view_messages.h" |
34 #include "third_party/WebKit/public/web/WebInputEvent.h" | 34 #include "third_party/WebKit/public/web/WebInputEvent.h" |
35 | 35 |
36 using content::WebContents; | 36 using content::WebContents; |
37 | 37 |
38 namespace content { | 38 namespace content { |
39 struct FrameNavigateParams; | 39 struct FrameNavigateParams; |
40 } | 40 } |
41 | 41 |
42 namespace extensions { | 42 namespace extensions { |
43 | 43 |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 | 380 |
381 void GuestViewBase::DidAttach(int guest_proxy_routing_id) { | 381 void GuestViewBase::DidAttach(int guest_proxy_routing_id) { |
382 opener_lifetime_observer_.reset(); | 382 opener_lifetime_observer_.reset(); |
383 | 383 |
384 SetUpSizing(*attach_params()); | 384 SetUpSizing(*attach_params()); |
385 | 385 |
386 // Give the derived class an opportunity to perform some actions. | 386 // Give the derived class an opportunity to perform some actions. |
387 DidAttachToEmbedder(); | 387 DidAttachToEmbedder(); |
388 | 388 |
389 // Inform the associated GuestViewContainer that the contentWindow is ready. | 389 // Inform the associated GuestViewContainer that the contentWindow is ready. |
390 embedder_web_contents()->Send(new ExtensionMsg_GuestAttached( | 390 embedder_web_contents()->Send(new GuestViewMsg_GuestAttached( |
391 element_instance_id_, | 391 element_instance_id_, |
392 guest_proxy_routing_id)); | 392 guest_proxy_routing_id)); |
393 | 393 |
394 SendQueuedEvents(); | 394 SendQueuedEvents(); |
395 } | 395 } |
396 | 396 |
397 void GuestViewBase::DidDetach() { | 397 void GuestViewBase::DidDetach() { |
398 GuestViewManager::FromBrowserContext(browser_context_)->DetachGuest( | 398 GuestViewManager::FromBrowserContext(browser_context_)->DetachGuest( |
399 this, element_instance_id_); | 399 this, element_instance_id_); |
400 StopTrackingEmbedderZoomLevel(); | 400 StopTrackingEmbedderZoomLevel(); |
401 owner_web_contents()->Send(new ExtensionMsg_GuestDetached( | 401 owner_web_contents()->Send(new GuestViewMsg_GuestDetached( |
402 element_instance_id_)); | 402 element_instance_id_)); |
403 element_instance_id_ = guestview::kInstanceIDNone; | 403 element_instance_id_ = guestview::kInstanceIDNone; |
404 } | 404 } |
405 | 405 |
406 void GuestViewBase::ElementSizeChanged(const gfx::Size& size) { | 406 void GuestViewBase::ElementSizeChanged(const gfx::Size& size) { |
407 if (size.IsEmpty()) | 407 if (size.IsEmpty()) |
408 return; | 408 return; |
409 | 409 |
410 // Only resize if needed. | 410 // Only resize if needed. |
411 guest_sizer_->SizeContents(size); | 411 guest_sizer_->SizeContents(size); |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 void GuestViewBase::RegisterGuestViewTypes() { | 783 void GuestViewBase::RegisterGuestViewTypes() { |
784 AppViewGuest::Register(); | 784 AppViewGuest::Register(); |
785 ExtensionOptionsGuest::Register(); | 785 ExtensionOptionsGuest::Register(); |
786 ExtensionViewGuest::Register(); | 786 ExtensionViewGuest::Register(); |
787 MimeHandlerViewGuest::Register(); | 787 MimeHandlerViewGuest::Register(); |
788 SurfaceWorkerGuest::Register(); | 788 SurfaceWorkerGuest::Register(); |
789 WebViewGuest::Register(); | 789 WebViewGuest::Register(); |
790 } | 790 } |
791 | 791 |
792 } // namespace extensions | 792 } // namespace extensions |
OLD | NEW |