OLD | NEW |
---|---|
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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
270 using content::FileDescriptorInfo; | 270 using content::FileDescriptorInfo; |
271 #endif | 271 #endif |
272 | 272 |
273 namespace { | 273 namespace { |
274 | 274 |
275 // Cached version of the locale so we can return the locale on the I/O | 275 // Cached version of the locale so we can return the locale on the I/O |
276 // thread. | 276 // thread. |
277 base::LazyInstance<std::string> g_io_thread_application_locale; | 277 base::LazyInstance<std::string> g_io_thread_application_locale; |
278 | 278 |
279 #if defined(ENABLE_PLUGINS) | 279 #if defined(ENABLE_PLUGINS) |
280 const char* const kPredefinedAllowedDevChannelOrigins[] = { | |
281 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see crbug.com/234789 | |
282 "4EB74897CB187C7633357C2FE832E0AD6A44883A" // see crbug.com/234789 | |
dmichael (off chromium)
2014/06/13 21:07:26
I think you might want to reference 383937 instead
teravest
2014/06/13 21:13:00
Done.
| |
283 }; | |
284 | |
280 const char* const kPredefinedAllowedFileHandleOrigins[] = { | 285 const char* const kPredefinedAllowedFileHandleOrigins[] = { |
281 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see crbug.com/234789 | 286 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see crbug.com/234789 |
282 "4EB74897CB187C7633357C2FE832E0AD6A44883A" // see crbug.com/234789 | 287 "4EB74897CB187C7633357C2FE832E0AD6A44883A" // see crbug.com/234789 |
283 }; | 288 }; |
284 | 289 |
285 const char* const kPredefinedAllowedSocketOrigins[] = { | 290 const char* const kPredefinedAllowedSocketOrigins[] = { |
286 "okddffdblfhhnmhodogpojmfkjmhinfp", // Test SSH Client | 291 "okddffdblfhhnmhodogpojmfkjmhinfp", // Test SSH Client |
287 "pnhechapfaindjhompbnflcldabbghjo", // HTerm App (SSH Client) | 292 "pnhechapfaindjhompbnflcldabbghjo", // HTerm App (SSH Client) |
288 "bglhmjfplikpjnfoegeomebmfnkjomhe", // see crbug.com/122126 | 293 "bglhmjfplikpjnfoegeomebmfnkjomhe", // see crbug.com/122126 |
289 "gbchcmhmhahfdphkhkmpfmihenigjmpp", // Chrome Remote Desktop | 294 "gbchcmhmhahfdphkhkmpfmihenigjmpp", // Chrome Remote Desktop |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
632 | 637 |
633 #endif // defined(OS_ANDROID) | 638 #endif // defined(OS_ANDROID) |
634 | 639 |
635 } // namespace | 640 } // namespace |
636 | 641 |
637 namespace chrome { | 642 namespace chrome { |
638 | 643 |
639 ChromeContentBrowserClient::ChromeContentBrowserClient() | 644 ChromeContentBrowserClient::ChromeContentBrowserClient() |
640 : prerender_tracker_(NULL) { | 645 : prerender_tracker_(NULL) { |
641 #if defined(ENABLE_PLUGINS) | 646 #if defined(ENABLE_PLUGINS) |
647 for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i) | |
648 allowed_dev_channel_origins_.insert(kPredefinedAllowedDevChannelOrigins[i]); | |
642 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i) | 649 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i) |
643 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); | 650 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); |
644 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) | 651 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) |
645 allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]); | 652 allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]); |
646 #endif | 653 #endif |
647 | 654 |
648 permissions_policy_delegate_.reset( | 655 permissions_policy_delegate_.reset( |
649 new extensions::BrowserPermissionsPolicyDelegate()); | 656 new extensions::BrowserPermissionsPolicyDelegate()); |
650 } | 657 } |
651 | 658 |
(...skipping 2081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2733 bool ChromeContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle( | 2740 bool ChromeContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle( |
2734 content::BrowserContext* browser_context, | 2741 content::BrowserContext* browser_context, |
2735 const GURL& url) { | 2742 const GURL& url) { |
2736 #if defined(ENABLE_PLUGINS) | 2743 #if defined(ENABLE_PLUGINS) |
2737 Profile* profile = Profile::FromBrowserContext(browser_context); | 2744 Profile* profile = Profile::FromBrowserContext(browser_context); |
2738 const extensions::ExtensionSet* extension_set = NULL; | 2745 const extensions::ExtensionSet* extension_set = NULL; |
2739 if (profile) { | 2746 if (profile) { |
2740 extension_set = extensions::ExtensionSystem::Get(profile)-> | 2747 extension_set = extensions::ExtensionSystem::Get(profile)-> |
2741 extension_service()->extensions(); | 2748 extension_service()->extensions(); |
2742 } | 2749 } |
2743 // TODO(teravest): Populate allowed_file_handle_origins_ when FileIO is moved | |
2744 // from the renderer to the browser. | |
2745 return IsExtensionOrSharedModuleWhitelisted(url, extension_set, | 2750 return IsExtensionOrSharedModuleWhitelisted(url, extension_set, |
2746 allowed_file_handle_origins_) || | 2751 allowed_file_handle_origins_) || |
2747 IsHostAllowedByCommandLine(url, extension_set, | 2752 IsHostAllowedByCommandLine(url, extension_set, |
2748 switches::kAllowNaClFileHandleAPI); | 2753 switches::kAllowNaClFileHandleAPI); |
2749 #else | 2754 #else |
2750 return false; | 2755 return false; |
2751 #endif | 2756 #endif |
2752 } | 2757 } |
2753 | 2758 |
2754 bool ChromeContentBrowserClient::IsPluginAllowedToUseDevChannelAPIs() { | 2759 bool ChromeContentBrowserClient::IsPluginAllowedToUseDevChannelAPIs( |
2760 content::BrowserContext* browser_context, | |
2761 const GURL& url) { | |
2755 #if defined(ENABLE_PLUGINS) | 2762 #if defined(ENABLE_PLUGINS) |
2756 // Allow access for tests. | 2763 // Allow access for tests. |
2757 if (CommandLine::ForCurrentProcess()->HasSwitch( | 2764 if (CommandLine::ForCurrentProcess()->HasSwitch( |
2758 switches::kEnablePepperTesting)) { | 2765 switches::kEnablePepperTesting)) { |
2759 return true; | 2766 return true; |
2760 } | 2767 } |
2761 | 2768 |
2769 Profile* profile = Profile::FromBrowserContext(browser_context); | |
2770 const extensions::ExtensionSet* extension_set = NULL; | |
2771 if (profile) { | |
2772 extension_set = extensions::ExtensionSystem::Get(profile)-> | |
2773 extension_service()->extensions(); | |
2774 } | |
2775 | |
2776 // Allow access for whitelisted applications. | |
2777 if (IsExtensionOrSharedModuleWhitelisted(url, | |
2778 extension_set, | |
2779 allowed_dev_channel_origins_)) { | |
2780 return true; | |
2781 } | |
2782 | |
2762 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | 2783 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
2763 // Allow dev channel APIs to be used on "Canary", "Dev", and "Unknown" | 2784 // Allow dev channel APIs to be used on "Canary", "Dev", and "Unknown" |
2764 // releases of Chrome. Permitting "Unknown" allows these APIs to be used on | 2785 // releases of Chrome. Permitting "Unknown" allows these APIs to be used on |
2765 // Chromium builds as well. | 2786 // Chromium builds as well. |
2766 return channel <= chrome::VersionInfo::CHANNEL_DEV; | 2787 return channel <= chrome::VersionInfo::CHANNEL_DEV; |
2767 #else | 2788 #else |
2768 return false; | 2789 return false; |
2769 #endif | 2790 #endif |
2770 } | 2791 } |
2771 | 2792 |
(...skipping 24 matching lines...) Expand all Loading... | |
2796 switches::kDisableWebRtcEncryption, | 2817 switches::kDisableWebRtcEncryption, |
2797 }; | 2818 }; |
2798 to_command_line->CopySwitchesFrom(from_command_line, | 2819 to_command_line->CopySwitchesFrom(from_command_line, |
2799 kWebRtcDevSwitchNames, | 2820 kWebRtcDevSwitchNames, |
2800 arraysize(kWebRtcDevSwitchNames)); | 2821 arraysize(kWebRtcDevSwitchNames)); |
2801 } | 2822 } |
2802 } | 2823 } |
2803 #endif // defined(ENABLE_WEBRTC) | 2824 #endif // defined(ENABLE_WEBRTC) |
2804 | 2825 |
2805 } // namespace chrome | 2826 } // namespace chrome |
OLD | NEW |