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

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

Issue 383803003: Fixed a crash when extensions are not enabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2495 matching lines...) Expand 10 before | Expand all | Expand 10 after
2506 2506
2507 bool ChromeContentBrowserClient::AllowPepperSocketAPI( 2507 bool ChromeContentBrowserClient::AllowPepperSocketAPI(
2508 content::BrowserContext* browser_context, 2508 content::BrowserContext* browser_context,
2509 const GURL& url, 2509 const GURL& url,
2510 bool private_api, 2510 bool private_api,
2511 const content::SocketPermissionRequest* params) { 2511 const content::SocketPermissionRequest* params) {
2512 #if defined(ENABLE_PLUGINS) 2512 #if defined(ENABLE_PLUGINS)
2513 Profile* profile = Profile::FromBrowserContext(browser_context); 2513 Profile* profile = Profile::FromBrowserContext(browser_context);
2514 const extensions::ExtensionSet* extension_set = NULL; 2514 const extensions::ExtensionSet* extension_set = NULL;
2515 if (profile) { 2515 if (profile) {
2516 extension_set = extensions::ExtensionSystem::Get(profile)-> 2516 const ExtensionService* ext_service =
2517 extension_service()->extensions(); 2517 extensions::ExtensionSystem::Get(profile)->extension_service();
2518 if (ext_service) {
2519 extension_set = ext_service->extensions();
2520 }
2518 } 2521 }
2519 2522
2520 if (private_api) { 2523 if (private_api) {
2521 // Access to private socket APIs is controlled by the whitelist. 2524 // Access to private socket APIs is controlled by the whitelist.
2522 if (IsExtensionOrSharedModuleWhitelisted(url, extension_set, 2525 if (IsExtensionOrSharedModuleWhitelisted(url, extension_set,
2523 allowed_socket_origins_)) { 2526 allowed_socket_origins_)) {
2524 return true; 2527 return true;
2525 } 2528 }
2526 } else { 2529 } else {
2527 // Access to public socket APIs is controlled by extension permissions. 2530 // Access to public socket APIs is controlled by extension permissions.
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
2726 return new ChromeDevToolsManagerDelegate(); 2729 return new ChromeDevToolsManagerDelegate();
2727 } 2730 }
2728 2731
2729 bool ChromeContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle( 2732 bool ChromeContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle(
2730 content::BrowserContext* browser_context, 2733 content::BrowserContext* browser_context,
2731 const GURL& url) { 2734 const GURL& url) {
2732 #if defined(ENABLE_PLUGINS) 2735 #if defined(ENABLE_PLUGINS)
2733 Profile* profile = Profile::FromBrowserContext(browser_context); 2736 Profile* profile = Profile::FromBrowserContext(browser_context);
2734 const extensions::ExtensionSet* extension_set = NULL; 2737 const extensions::ExtensionSet* extension_set = NULL;
2735 if (profile) { 2738 if (profile) {
2736 extension_set = extensions::ExtensionSystem::Get(profile)-> 2739 const ExtensionService* ext_service =
2737 extension_service()->extensions(); 2740 extensions::ExtensionSystem::Get(profile)->extension_service();
2741 if (ext_service) {
2742 extension_set = ext_service->extensions();
2743 }
2738 } 2744 }
2739 return IsExtensionOrSharedModuleWhitelisted(url, extension_set, 2745 return IsExtensionOrSharedModuleWhitelisted(url, extension_set,
2740 allowed_file_handle_origins_) || 2746 allowed_file_handle_origins_) ||
2741 IsHostAllowedByCommandLine(url, extension_set, 2747 IsHostAllowedByCommandLine(url, extension_set,
2742 switches::kAllowNaClFileHandleAPI); 2748 switches::kAllowNaClFileHandleAPI);
2743 #else 2749 #else
2744 return false; 2750 return false;
2745 #endif 2751 #endif
2746 } 2752 }
2747 2753
2748 bool ChromeContentBrowserClient::IsPluginAllowedToUseDevChannelAPIs( 2754 bool ChromeContentBrowserClient::IsPluginAllowedToUseDevChannelAPIs(
2749 content::BrowserContext* browser_context, 2755 content::BrowserContext* browser_context,
2750 const GURL& url) { 2756 const GURL& url) {
2751 #if defined(ENABLE_PLUGINS) 2757 #if defined(ENABLE_PLUGINS)
2752 // Allow access for tests. 2758 // Allow access for tests.
2753 if (CommandLine::ForCurrentProcess()->HasSwitch( 2759 if (CommandLine::ForCurrentProcess()->HasSwitch(
2754 switches::kEnablePepperTesting)) { 2760 switches::kEnablePepperTesting)) {
2755 return true; 2761 return true;
2756 } 2762 }
2757 2763
2758 Profile* profile = Profile::FromBrowserContext(browser_context); 2764 Profile* profile = Profile::FromBrowserContext(browser_context);
2759 const extensions::ExtensionSet* extension_set = NULL; 2765 const extensions::ExtensionSet* extension_set = NULL;
2760 if (profile) { 2766 if (profile) {
2761 extension_set = extensions::ExtensionSystem::Get(profile)-> 2767 const ExtensionService* ext_service =
2762 extension_service()->extensions(); 2768 extensions::ExtensionSystem::Get(profile)->extension_service();
2769 if (ext_service) {
2770 extension_set = ext_service->extensions();
2771 }
2763 } 2772 }
2764 2773
2765 // Allow access for whitelisted applications. 2774 // Allow access for whitelisted applications.
2766 if (IsExtensionOrSharedModuleWhitelisted(url, 2775 if (IsExtensionOrSharedModuleWhitelisted(url,
2767 extension_set, 2776 extension_set,
2768 allowed_dev_channel_origins_)) { 2777 allowed_dev_channel_origins_)) {
2769 return true; 2778 return true;
2770 } 2779 }
2771 2780
2772 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); 2781 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2806 switches::kDisableWebRtcEncryption, 2815 switches::kDisableWebRtcEncryption,
2807 }; 2816 };
2808 to_command_line->CopySwitchesFrom(from_command_line, 2817 to_command_line->CopySwitchesFrom(from_command_line,
2809 kWebRtcDevSwitchNames, 2818 kWebRtcDevSwitchNames,
2810 arraysize(kWebRtcDevSwitchNames)); 2819 arraysize(kWebRtcDevSwitchNames));
2811 } 2820 }
2812 } 2821 }
2813 #endif // defined(ENABLE_WEBRTC) 2822 #endif // defined(ENABLE_WEBRTC)
2814 2823
2815 } // namespace chrome 2824 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698