Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(372)

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 301733006: Zoom Extension API (chrome) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Create ZoomController for guest web contents. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 #include "chrome/browser/ssl/ssl_blocking_page.h" 76 #include "chrome/browser/ssl/ssl_blocking_page.h"
77 #include "chrome/browser/ssl/ssl_client_certificate_selector.h" 77 #include "chrome/browser/ssl/ssl_client_certificate_selector.h"
78 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" 78 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h"
79 #include "chrome/browser/tab_contents/tab_util.h" 79 #include "chrome/browser/tab_contents/tab_util.h"
80 #include "chrome/browser/ui/blocked_content/blocked_window_params.h" 80 #include "chrome/browser/ui/blocked_content/blocked_window_params.h"
81 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" 81 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h"
82 #include "chrome/browser/ui/chrome_select_file_policy.h" 82 #include "chrome/browser/ui/chrome_select_file_policy.h"
83 #include "chrome/browser/ui/sync/sync_promo_ui.h" 83 #include "chrome/browser/ui/sync/sync_promo_ui.h"
84 #include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h" 84 #include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h"
85 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" 85 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
86 #include "chrome/browser/ui/zoom/zoom_controller.h"
86 #include "chrome/common/chrome_constants.h" 87 #include "chrome/common/chrome_constants.h"
87 #include "chrome/common/chrome_paths.h" 88 #include "chrome/common/chrome_paths.h"
88 #include "chrome/common/chrome_switches.h" 89 #include "chrome/common/chrome_switches.h"
89 #include "chrome/common/env_vars.h" 90 #include "chrome/common/env_vars.h"
90 #include "chrome/common/extensions/extension_constants.h" 91 #include "chrome/common/extensions/extension_constants.h"
91 #include "chrome/common/extensions/extension_process_policy.h" 92 #include "chrome/common/extensions/extension_process_policy.h"
92 #include "chrome/common/extensions/manifest_handlers/app_isolation_info.h" 93 #include "chrome/common/extensions/manifest_handlers/app_isolation_info.h"
93 #include "chrome/common/logging_chrome.h" 94 #include "chrome/common/logging_chrome.h"
94 #include "chrome/common/pepper_permission_util.h" 95 #include "chrome/common/pepper_permission_util.h"
95 #include "chrome/common/pref_names.h" 96 #include "chrome/common/pref_names.h"
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 SiteInstance* guest_site_instance, 844 SiteInstance* guest_site_instance,
844 WebContents* guest_web_contents, 845 WebContents* guest_web_contents,
845 WebContents* opener_web_contents, 846 WebContents* opener_web_contents,
846 content::BrowserPluginGuestDelegate** guest_delegate, 847 content::BrowserPluginGuestDelegate** guest_delegate,
847 scoped_ptr<base::DictionaryValue> extra_params) { 848 scoped_ptr<base::DictionaryValue> extra_params) {
848 #if defined(ENABLE_EXTENSIONS) 849 #if defined(ENABLE_EXTENSIONS)
849 if (!guest_site_instance) { 850 if (!guest_site_instance) {
850 NOTREACHED(); 851 NOTREACHED();
851 return; 852 return;
852 } 853 }
854
wjmaclean 2014/06/23 18:40:48 Oops, I'll remove this line.
853 GURL guest_site_url = guest_site_instance->GetSiteURL(); 855 GURL guest_site_url = guest_site_instance->GetSiteURL();
854 const std::string& extension_id = guest_site_url.host(); 856 const std::string& extension_id = guest_site_url.host();
855 857
856 Profile* profile = Profile::FromBrowserContext( 858 Profile* profile = Profile::FromBrowserContext(
857 guest_web_contents->GetBrowserContext()); 859 guest_web_contents->GetBrowserContext());
858 ExtensionService* service = 860 ExtensionService* service =
859 extensions::ExtensionSystem::Get(profile)->extension_service(); 861 extensions::ExtensionSystem::Get(profile)->extension_service();
860 if (!service) { 862 if (!service) {
861 NOTREACHED(); 863 NOTREACHED();
862 return; 864 return;
863 } 865 }
864 866
865 /// TODO(fsamuel): In the future, certain types of GuestViewBases won't 867 /// TODO(fsamuel): In the future, certain types of GuestViewBases won't
866 // require extension bindings. At that point, we should clear |extension_id| 868 // require extension bindings. At that point, we should clear |extension_id|
867 // instead of exiting early. 869 // instead of exiting early.
868 if (!extension_id.empty() && 870 if (!extension_id.empty() &&
869 !service->GetExtensionById(extension_id, false)) { 871 !service->GetExtensionById(extension_id, false)) {
870 NOTREACHED(); 872 NOTREACHED();
871 return; 873 return;
872 } 874 }
873 875
876 // Create a zoom controller for the guest contents give it access to
877 // GetZoomLevel() and and SetZoomLevel() in WebViewGuest.
878 // TODO(wjmaclean) This currently uses the same HostZoomMap as the browser
879 // context, but we eventually want to isolate the guest contents from zoom
880 // changes outside the guest (e.g. in the main browser), so we should
881 // create a separate HostZoomMap for the guest.
882 ZoomController::CreateForWebContents(guest_web_contents);
874 if (opener_web_contents) { 883 if (opener_web_contents) {
875 GuestViewBase* guest = GuestViewBase::FromWebContents(opener_web_contents); 884 GuestViewBase* guest = GuestViewBase::FromWebContents(opener_web_contents);
876 DCHECK(guest); 885 DCHECK(guest);
877 886
878 // Create a new GuestViewBase of the same type as the opener. 887 // Create a new GuestViewBase of the same type as the opener.
879 *guest_delegate = GuestViewBase::Create( 888 *guest_delegate = GuestViewBase::Create(
880 guest_instance_id, 889 guest_instance_id,
881 guest_web_contents, 890 guest_web_contents,
882 extension_id, 891 extension_id,
883 guest->GetViewType()); 892 guest->GetViewType());
(...skipping 1985 matching lines...) Expand 10 before | Expand all | Expand 10 after
2869 switches::kDisableWebRtcEncryption, 2878 switches::kDisableWebRtcEncryption,
2870 }; 2879 };
2871 to_command_line->CopySwitchesFrom(from_command_line, 2880 to_command_line->CopySwitchesFrom(from_command_line,
2872 kWebRtcDevSwitchNames, 2881 kWebRtcDevSwitchNames,
2873 arraysize(kWebRtcDevSwitchNames)); 2882 arraysize(kWebRtcDevSwitchNames));
2874 } 2883 }
2875 } 2884 }
2876 #endif // defined(ENABLE_WEBRTC) 2885 #endif // defined(ENABLE_WEBRTC)
2877 2886
2878 } // namespace chrome 2887 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698