| 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 | 5 |
| 6 #include "chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h" | 6 #include "chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h" |
| 7 | 7 |
| 8 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" | 8 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" |
| 9 #include "chrome/browser/favicon/favicon_tab_helper.h" | 9 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 10 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" | 10 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" |
| 11 #include "chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h" | 11 #include "chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h" |
| 12 #include "chrome/browser/ui/zoom/zoom_controller.h" | 12 #include "chrome/browser/ui/zoom/zoom_controller.h" |
| 13 #include "chrome/common/chrome_version_info.h" | 13 #include "chrome/common/chrome_version_info.h" |
| 14 #include "components/pdf/browser/pdf_web_contents_helper.h" | 14 #include "components/pdf/browser/pdf_web_contents_helper.h" |
| 15 #include "components/renderer_context_menu/context_menu_delegate.h" | 15 #include "components/renderer_context_menu/context_menu_delegate.h" |
| 16 #include "content/public/common/page_zoom.h" | 16 #include "content/public/common/page_zoom.h" |
| 17 #include "extensions/browser/api/web_request/web_request_api.h" | 17 #include "extensions/browser/api/web_request/web_request_api.h" |
| 18 #include "extensions/browser/guest_view/web_view/web_view_constants.h" | 18 #include "extensions/browser/guest_view/web_view/web_view_constants.h" |
| 19 | 19 |
| 20 #if defined(ENABLE_PRINTING) | 20 #if defined(ENABLE_PRINTING) |
| 21 #if defined(ENABLE_FULL_PRINTING) | 21 #if defined(ENABLE_PRINT_PREVIEW) |
| 22 #include "chrome/browser/printing/print_preview_message_handler.h" | 22 #include "chrome/browser/printing/print_preview_message_handler.h" |
| 23 #include "chrome/browser/printing/print_view_manager.h" | 23 #include "chrome/browser/printing/print_view_manager.h" |
| 24 #else | 24 #else |
| 25 #include "chrome/browser/printing/print_view_manager_basic.h" | 25 #include "chrome/browser/printing/print_view_manager_basic.h" |
| 26 #endif // defined(ENABLE_FULL_PRINTING) | 26 #endif // defined(ENABLE_PRINT_PREVIEW) |
| 27 #endif // defined(ENABLE_PRINTING) | 27 #endif // defined(ENABLE_PRINTING) |
| 28 | 28 |
| 29 namespace extensions { | 29 namespace extensions { |
| 30 | 30 |
| 31 ChromeWebViewGuestDelegate::ChromeWebViewGuestDelegate( | 31 ChromeWebViewGuestDelegate::ChromeWebViewGuestDelegate( |
| 32 WebViewGuest* web_view_guest) | 32 WebViewGuest* web_view_guest) |
| 33 : pending_context_menu_request_id_(0), | 33 : pending_context_menu_request_id_(0), |
| 34 chromevox_injected_(false), | 34 chromevox_injected_(false), |
| 35 current_zoom_factor_(1.0), | 35 current_zoom_factor_(1.0), |
| 36 web_view_guest_(web_view_guest), | 36 web_view_guest_(web_view_guest), |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // GetZoomLevel() and and SetZoomLevel() in WebViewGuest. | 72 // GetZoomLevel() and and SetZoomLevel() in WebViewGuest. |
| 73 // TODO(wjmaclean) This currently uses the same HostZoomMap as the browser | 73 // TODO(wjmaclean) This currently uses the same HostZoomMap as the browser |
| 74 // context, but we eventually want to isolate the guest contents from zoom | 74 // context, but we eventually want to isolate the guest contents from zoom |
| 75 // changes outside the guest (e.g. in the main browser), so we should | 75 // changes outside the guest (e.g. in the main browser), so we should |
| 76 // create a separate HostZoomMap for the guest. | 76 // create a separate HostZoomMap for the guest. |
| 77 ZoomController::CreateForWebContents(contents); | 77 ZoomController::CreateForWebContents(contents); |
| 78 | 78 |
| 79 FaviconTabHelper::CreateForWebContents(contents); | 79 FaviconTabHelper::CreateForWebContents(contents); |
| 80 ChromeExtensionWebContentsObserver::CreateForWebContents(contents); | 80 ChromeExtensionWebContentsObserver::CreateForWebContents(contents); |
| 81 #if defined(ENABLE_PRINTING) | 81 #if defined(ENABLE_PRINTING) |
| 82 #if defined(ENABLE_FULL_PRINTING) | 82 #if defined(ENABLE_PRINT_PREVIEW) |
| 83 printing::PrintViewManager::CreateForWebContents(contents); | 83 printing::PrintViewManager::CreateForWebContents(contents); |
| 84 printing::PrintPreviewMessageHandler::CreateForWebContents(contents); | 84 printing::PrintPreviewMessageHandler::CreateForWebContents(contents); |
| 85 #else | 85 #else |
| 86 printing::PrintViewManagerBasic::CreateForWebContents(contents); | 86 printing::PrintViewManagerBasic::CreateForWebContents(contents); |
| 87 #endif // defined(ENABLE_FULL_PRINTING) | 87 #endif // defined(ENABLE_PRINT_PREVIEW) |
| 88 #endif // defined(ENABLE_PRINTING) | 88 #endif // defined(ENABLE_PRINTING) |
| 89 pdf::PDFWebContentsHelper::CreateForWebContentsWithClient( | 89 pdf::PDFWebContentsHelper::CreateForWebContentsWithClient( |
| 90 contents, | 90 contents, |
| 91 scoped_ptr<pdf::PDFWebContentsHelperClient>( | 91 scoped_ptr<pdf::PDFWebContentsHelperClient>( |
| 92 new ChromePDFWebContentsHelperClient())); | 92 new ChromePDFWebContentsHelperClient())); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void ChromeWebViewGuestDelegate::OnDidAttachToEmbedder() { | 95 void ChromeWebViewGuestDelegate::OnDidAttachToEmbedder() { |
| 96 // TODO(fsamuel): This code should be implemented in GuestViewBase once the | 96 // TODO(fsamuel): This code should be implemented in GuestViewBase once the |
| 97 // ZoomController moves to the extensions module. | 97 // ZoomController moves to the extensions module. |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 } | 234 } |
| 235 #endif | 235 #endif |
| 236 | 236 |
| 237 void ChromeWebViewGuestDelegate::OnZoomChanged( | 237 void ChromeWebViewGuestDelegate::OnZoomChanged( |
| 238 const ZoomController::ZoomChangedEventData& data) { | 238 const ZoomController::ZoomChangedEventData& data) { |
| 239 ZoomController::FromWebContents(guest_web_contents())-> | 239 ZoomController::FromWebContents(guest_web_contents())-> |
| 240 SetZoomLevel(data.new_zoom_level); | 240 SetZoomLevel(data.new_zoom_level); |
| 241 } | 241 } |
| 242 | 242 |
| 243 } // namespace extensions | 243 } // namespace extensions |
| OLD | NEW |