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

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

Issue 709813004: Remove the deprecated function ExtensionService::extensions(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed thestig@'s comments. Created 6 years, 1 month 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
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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 #if !defined(DISABLE_NACL) 216 #if !defined(DISABLE_NACL)
217 #include "components/nacl/browser/nacl_browser.h" 217 #include "components/nacl/browser/nacl_browser.h"
218 #include "components/nacl/browser/nacl_host_message_filter.h" 218 #include "components/nacl/browser/nacl_host_message_filter.h"
219 #include "components/nacl/browser/nacl_process_host.h" 219 #include "components/nacl/browser/nacl_process_host.h"
220 #include "components/nacl/common/nacl_process_type.h" 220 #include "components/nacl/common/nacl_process_type.h"
221 #include "components/nacl/common/nacl_switches.h" 221 #include "components/nacl/common/nacl_switches.h"
222 #endif 222 #endif
223 223
224 #if defined(ENABLE_EXTENSIONS) 224 #if defined(ENABLE_EXTENSIONS)
225 #include "chrome/browser/extensions/chrome_content_browser_client_extensions_par t.h" 225 #include "chrome/browser/extensions/chrome_content_browser_client_extensions_par t.h"
226 #include "chrome/browser/extensions/extension_service.h"
227 #include "chrome/browser/extensions/extension_util.h" 226 #include "chrome/browser/extensions/extension_util.h"
228 #include "chrome/browser/speech/extension_api/tts_engine_extension_api.h" 227 #include "chrome/browser/speech/extension_api/tts_engine_extension_api.h"
229 #include "extensions/browser/extension_system.h" 228 #include "extensions/browser/extension_registry.h"
230 #include "extensions/browser/guest_view/guest_view_base.h" 229 #include "extensions/browser/guest_view/guest_view_base.h"
231 #include "extensions/browser/guest_view/guest_view_manager.h" 230 #include "extensions/browser/guest_view/guest_view_manager.h"
232 #include "extensions/browser/guest_view/web_view/web_view_guest.h" 231 #include "extensions/browser/guest_view/web_view/web_view_guest.h"
233 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h" 232 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h"
234 #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" 233 #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h"
235 #include "extensions/common/constants.h" 234 #include "extensions/common/constants.h"
236 #include "extensions/common/extension.h" 235 #include "extensions/common/extension.h"
237 #include "extensions/common/extension_set.h" 236 #include "extensions/common/extension_set.h"
238 #include "extensions/common/manifest_handlers/background_info.h" 237 #include "extensions/common/manifest_handlers/background_info.h"
239 #include "extensions/common/manifest_handlers/shared_module_info.h" 238 #include "extensions/common/manifest_handlers/shared_module_info.h"
(...skipping 2120 matching lines...) Expand 10 before | Expand all | Expand 10 after
2360 2359
2361 bool ChromeContentBrowserClient::AllowPepperSocketAPI( 2360 bool ChromeContentBrowserClient::AllowPepperSocketAPI(
2362 content::BrowserContext* browser_context, 2361 content::BrowserContext* browser_context,
2363 const GURL& url, 2362 const GURL& url,
2364 bool private_api, 2363 bool private_api,
2365 const content::SocketPermissionRequest* params) { 2364 const content::SocketPermissionRequest* params) {
2366 #if defined(ENABLE_EXTENSIONS) 2365 #if defined(ENABLE_EXTENSIONS)
2367 Profile* profile = Profile::FromBrowserContext(browser_context); 2366 Profile* profile = Profile::FromBrowserContext(browser_context);
2368 const extensions::ExtensionSet* extension_set = NULL; 2367 const extensions::ExtensionSet* extension_set = NULL;
2369 if (profile) { 2368 if (profile) {
2370 const ExtensionService* ext_service = 2369 extension_set =
2371 extensions::ExtensionSystem::Get(profile)->extension_service(); 2370 &extensions::ExtensionRegistry::Get(profile)->enabled_extensions();
2372 if (ext_service) {
2373 extension_set = ext_service->extensions();
2374 }
2375 } 2371 }
2376 2372
2377 if (private_api) { 2373 if (private_api) {
2378 // Access to private socket APIs is controlled by the whitelist. 2374 // Access to private socket APIs is controlled by the whitelist.
2379 if (IsExtensionOrSharedModuleWhitelisted(url, extension_set, 2375 if (IsExtensionOrSharedModuleWhitelisted(url, extension_set,
2380 allowed_socket_origins_)) { 2376 allowed_socket_origins_)) {
2381 return true; 2377 return true;
2382 } 2378 }
2383 } else { 2379 } else {
2384 // Access to public socket APIs is controlled by extension permissions. 2380 // Access to public socket APIs is controlled by extension permissions.
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
2597 #endif 2593 #endif
2598 } 2594 }
2599 2595
2600 bool ChromeContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle( 2596 bool ChromeContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle(
2601 content::BrowserContext* browser_context, 2597 content::BrowserContext* browser_context,
2602 const GURL& url) { 2598 const GURL& url) {
2603 #if defined(ENABLE_EXTENSIONS) 2599 #if defined(ENABLE_EXTENSIONS)
2604 Profile* profile = Profile::FromBrowserContext(browser_context); 2600 Profile* profile = Profile::FromBrowserContext(browser_context);
2605 const extensions::ExtensionSet* extension_set = NULL; 2601 const extensions::ExtensionSet* extension_set = NULL;
2606 if (profile) { 2602 if (profile) {
2607 const ExtensionService* ext_service = 2603 extension_set =
2608 extensions::ExtensionSystem::Get(profile)->extension_service(); 2604 &extensions::ExtensionRegistry::Get(profile)->enabled_extensions();
2609 if (ext_service) {
2610 extension_set = ext_service->extensions();
2611 }
2612 } 2605 }
2613 return IsExtensionOrSharedModuleWhitelisted(url, extension_set, 2606 return IsExtensionOrSharedModuleWhitelisted(url, extension_set,
2614 allowed_file_handle_origins_) || 2607 allowed_file_handle_origins_) ||
2615 IsHostAllowedByCommandLine(url, extension_set, 2608 IsHostAllowedByCommandLine(url, extension_set,
2616 switches::kAllowNaClFileHandleAPI); 2609 switches::kAllowNaClFileHandleAPI);
2617 #else 2610 #else
2618 return false; 2611 return false;
2619 #endif 2612 #endif
2620 } 2613 }
2621 2614
2622 bool ChromeContentBrowserClient::IsPluginAllowedToUseDevChannelAPIs( 2615 bool ChromeContentBrowserClient::IsPluginAllowedToUseDevChannelAPIs(
2623 content::BrowserContext* browser_context, 2616 content::BrowserContext* browser_context,
2624 const GURL& url) { 2617 const GURL& url) {
2625 #if defined(ENABLE_EXTENSIONS) 2618 #if defined(ENABLE_EXTENSIONS)
2626 // Allow access for tests. 2619 // Allow access for tests.
2627 if (CommandLine::ForCurrentProcess()->HasSwitch( 2620 if (CommandLine::ForCurrentProcess()->HasSwitch(
2628 switches::kEnablePepperTesting)) { 2621 switches::kEnablePepperTesting)) {
2629 return true; 2622 return true;
2630 } 2623 }
2631 2624
2632 Profile* profile = Profile::FromBrowserContext(browser_context); 2625 Profile* profile = Profile::FromBrowserContext(browser_context);
2633 const extensions::ExtensionSet* extension_set = NULL; 2626 const extensions::ExtensionSet* extension_set = NULL;
2634 if (profile) { 2627 if (profile) {
2635 const ExtensionService* ext_service = 2628 extension_set =
2636 extensions::ExtensionSystem::Get(profile)->extension_service(); 2629 &extensions::ExtensionRegistry::Get(profile)->enabled_extensions();
2637 if (ext_service) {
2638 extension_set = ext_service->extensions();
2639 }
2640 } 2630 }
2641 2631
2642 // Allow access for whitelisted applications. 2632 // Allow access for whitelisted applications.
2643 if (IsExtensionOrSharedModuleWhitelisted(url, 2633 if (IsExtensionOrSharedModuleWhitelisted(url,
2644 extension_set, 2634 extension_set,
2645 allowed_dev_channel_origins_)) { 2635 allowed_dev_channel_origins_)) {
2646 return true; 2636 return true;
2647 } 2637 }
2648 2638
2649 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); 2639 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2683 switches::kDisableWebRtcEncryption, 2673 switches::kDisableWebRtcEncryption,
2684 }; 2674 };
2685 to_command_line->CopySwitchesFrom(from_command_line, 2675 to_command_line->CopySwitchesFrom(from_command_line,
2686 kWebRtcDevSwitchNames, 2676 kWebRtcDevSwitchNames,
2687 arraysize(kWebRtcDevSwitchNames)); 2677 arraysize(kWebRtcDevSwitchNames));
2688 } 2678 }
2689 } 2679 }
2690 #endif // defined(ENABLE_WEBRTC) 2680 #endif // defined(ENABLE_WEBRTC)
2691 2681
2692 } // namespace chrome 2682 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698