| 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 27 matching lines...) Expand all Loading... |
| 38 #include "chrome/browser/media/cast_transport_host_filter.h" | 38 #include "chrome/browser/media/cast_transport_host_filter.h" |
| 39 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 39 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
| 40 #include "chrome/browser/media/midi_permission_context.h" | 40 #include "chrome/browser/media/midi_permission_context.h" |
| 41 #include "chrome/browser/media/midi_permission_context_factory.h" | 41 #include "chrome/browser/media/midi_permission_context_factory.h" |
| 42 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" | 42 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" |
| 43 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" | 43 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" |
| 44 #include "chrome/browser/net/chrome_net_log.h" | 44 #include "chrome/browser/net/chrome_net_log.h" |
| 45 #include "chrome/browser/notifications/desktop_notification_service.h" | 45 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 46 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 46 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
| 47 #include "chrome/browser/platform_util.h" | 47 #include "chrome/browser/platform_util.h" |
| 48 #include "chrome/browser/plugins/plugin_info_message_filter.h" | |
| 49 #include "chrome/browser/prerender/prerender_final_status.h" | 48 #include "chrome/browser/prerender/prerender_final_status.h" |
| 50 #include "chrome/browser/prerender/prerender_manager.h" | 49 #include "chrome/browser/prerender/prerender_manager.h" |
| 51 #include "chrome/browser/prerender/prerender_manager_factory.h" | 50 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 52 #include "chrome/browser/prerender/prerender_message_filter.h" | 51 #include "chrome/browser/prerender/prerender_message_filter.h" |
| 53 #include "chrome/browser/prerender/prerender_tracker.h" | 52 #include "chrome/browser/prerender/prerender_tracker.h" |
| 54 #include "chrome/browser/printing/printing_message_filter.h" | 53 #include "chrome/browser/printing/printing_message_filter.h" |
| 55 #include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h" | 54 #include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h" |
| 56 #include "chrome/browser/profiles/profile.h" | 55 #include "chrome/browser/profiles/profile.h" |
| 57 #include "chrome/browser/profiles/profile_io_data.h" | 56 #include "chrome/browser/profiles/profile_io_data.h" |
| 58 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" | 57 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 #include "content/public/common/child_process_host.h" | 119 #include "content/public/common/child_process_host.h" |
| 121 #include "content/public/common/content_descriptors.h" | 120 #include "content/public/common/content_descriptors.h" |
| 122 #include "content/public/common/show_desktop_notification_params.h" | 121 #include "content/public/common/show_desktop_notification_params.h" |
| 123 #include "content/public/common/url_utils.h" | 122 #include "content/public/common/url_utils.h" |
| 124 #include "content/public/common/web_preferences.h" | 123 #include "content/public/common/web_preferences.h" |
| 125 #include "net/base/mime_util.h" | 124 #include "net/base/mime_util.h" |
| 126 #include "net/cookies/canonical_cookie.h" | 125 #include "net/cookies/canonical_cookie.h" |
| 127 #include "net/cookies/cookie_options.h" | 126 #include "net/cookies/cookie_options.h" |
| 128 #include "net/ssl/ssl_cert_request_info.h" | 127 #include "net/ssl/ssl_cert_request_info.h" |
| 129 #include "ppapi/host/ppapi_host.h" | 128 #include "ppapi/host/ppapi_host.h" |
| 130 #include "ppapi/shared_impl/ppapi_switches.h" | |
| 131 #include "storage/browser/fileapi/external_mount_points.h" | 129 #include "storage/browser/fileapi/external_mount_points.h" |
| 132 #include "ui/base/l10n/l10n_util.h" | 130 #include "ui/base/l10n/l10n_util.h" |
| 133 #include "ui/base/resource/resource_bundle.h" | 131 #include "ui/base/resource/resource_bundle.h" |
| 134 #include "ui/resources/grit/ui_resources.h" | 132 #include "ui/resources/grit/ui_resources.h" |
| 135 | 133 |
| 136 #if defined(OS_WIN) | 134 #if defined(OS_WIN) |
| 137 #include "base/win/windows_version.h" | 135 #include "base/win/windows_version.h" |
| 138 #include "chrome/browser/chrome_browser_main_win.h" | 136 #include "chrome/browser/chrome_browser_main_win.h" |
| 139 #include "sandbox/win/src/sandbox_policy.h" | 137 #include "sandbox/win/src/sandbox_policy.h" |
| 140 #elif defined(OS_MACOSX) | 138 #elif defined(OS_MACOSX) |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 #include "extensions/common/constants.h" | 232 #include "extensions/common/constants.h" |
| 235 #include "extensions/common/extension.h" | 233 #include "extensions/common/extension.h" |
| 236 #include "extensions/common/extension_set.h" | 234 #include "extensions/common/extension_set.h" |
| 237 #include "extensions/common/manifest_handlers/background_info.h" | 235 #include "extensions/common/manifest_handlers/background_info.h" |
| 238 #include "extensions/common/manifest_handlers/shared_module_info.h" | 236 #include "extensions/common/manifest_handlers/shared_module_info.h" |
| 239 #include "extensions/common/permissions/permissions_data.h" | 237 #include "extensions/common/permissions/permissions_data.h" |
| 240 #include "extensions/common/permissions/socket_permission.h" | 238 #include "extensions/common/permissions/socket_permission.h" |
| 241 #include "extensions/common/switches.h" | 239 #include "extensions/common/switches.h" |
| 242 #endif | 240 #endif |
| 243 | 241 |
| 242 #if defined(ENABLE_PLUGINS) |
| 243 #include "chrome/browser/plugins/chrome_content_browser_client_plugins_part.h" |
| 244 #endif |
| 245 |
| 244 #if defined(ENABLE_SPELLCHECK) | 246 #if defined(ENABLE_SPELLCHECK) |
| 245 #include "chrome/browser/spellchecker/spellcheck_message_filter.h" | 247 #include "chrome/browser/spellchecker/spellcheck_message_filter.h" |
| 246 #endif | 248 #endif |
| 247 | 249 |
| 248 #if defined(ENABLE_WEBRTC) | 250 #if defined(ENABLE_WEBRTC) |
| 249 #include "chrome/browser/media/webrtc_logging_handler_host.h" | 251 #include "chrome/browser/media/webrtc_logging_handler_host.h" |
| 250 #endif | 252 #endif |
| 251 | 253 |
| 252 using base::FileDescriptor; | 254 using base::FileDescriptor; |
| 253 using blink::WebWindowFeatures; | 255 using blink::WebWindowFeatures; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 269 #endif | 271 #endif |
| 270 | 272 |
| 271 #if defined(ENABLE_EXTENSIONS) | 273 #if defined(ENABLE_EXTENSIONS) |
| 272 using extensions::APIPermission; | 274 using extensions::APIPermission; |
| 273 using extensions::ChromeContentBrowserClientExtensionsPart; | 275 using extensions::ChromeContentBrowserClientExtensionsPart; |
| 274 using extensions::Extension; | 276 using extensions::Extension; |
| 275 using extensions::InfoMap; | 277 using extensions::InfoMap; |
| 276 using extensions::Manifest; | 278 using extensions::Manifest; |
| 277 #endif | 279 #endif |
| 278 | 280 |
| 281 #if defined(ENABLE_PLUGINS) |
| 282 using plugins::ChromeContentBrowserClientPluginsPart; |
| 283 #endif |
| 284 |
| 279 namespace { | 285 namespace { |
| 280 | 286 |
| 281 // Cached version of the locale so we can return the locale on the I/O | 287 // Cached version of the locale so we can return the locale on the I/O |
| 282 // thread. | 288 // thread. |
| 283 base::LazyInstance<std::string> g_io_thread_application_locale; | 289 base::LazyInstance<std::string> g_io_thread_application_locale; |
| 284 | 290 |
| 285 #if defined(ENABLE_PLUGINS) | 291 #if defined(ENABLE_PLUGINS) |
| 286 // TODO(teravest): Add renderer-side API-specific checking for these APIs so | 292 // TODO(teravest): Add renderer-side API-specific checking for these APIs so |
| 287 // that blanket permission isn't granted to all dev channel APIs for these. | 293 // that blanket permission isn't granted to all dev channel APIs for these. |
| 288 // http://crbug.com/386743 | 294 // http://crbug.com/386743 |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 ChromeContentBrowserClient::ChromeContentBrowserClient() | 607 ChromeContentBrowserClient::ChromeContentBrowserClient() |
| 602 : prerender_tracker_(NULL), | 608 : prerender_tracker_(NULL), |
| 603 weak_factory_(this) { | 609 weak_factory_(this) { |
| 604 #if defined(ENABLE_PLUGINS) | 610 #if defined(ENABLE_PLUGINS) |
| 605 for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i) | 611 for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i) |
| 606 allowed_dev_channel_origins_.insert(kPredefinedAllowedDevChannelOrigins[i]); | 612 allowed_dev_channel_origins_.insert(kPredefinedAllowedDevChannelOrigins[i]); |
| 607 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i) | 613 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i) |
| 608 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); | 614 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); |
| 609 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) | 615 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) |
| 610 allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]); | 616 allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]); |
| 617 |
| 618 extra_parts_.push_back(new ChromeContentBrowserClientPluginsPart); |
| 611 #endif | 619 #endif |
| 612 | 620 |
| 613 #if !defined(OS_ANDROID) | 621 #if !defined(OS_ANDROID) |
| 614 TtsExtensionEngine* tts_extension_engine = TtsExtensionEngine::GetInstance(); | 622 TtsExtensionEngine* tts_extension_engine = TtsExtensionEngine::GetInstance(); |
| 615 TtsController::GetInstance()->SetTtsEngineDelegate(tts_extension_engine); | 623 TtsController::GetInstance()->SetTtsEngineDelegate(tts_extension_engine); |
| 616 #endif | 624 #endif |
| 617 | 625 |
| 618 #if defined(ENABLE_EXTENSIONS) | 626 #if defined(ENABLE_EXTENSIONS) |
| 619 extra_parts_.push_back(new ChromeContentBrowserClientExtensionsPart); | 627 extra_parts_.push_back(new ChromeContentBrowserClientExtensionsPart); |
| 620 #endif | 628 #endif |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 } | 818 } |
| 811 | 819 |
| 812 void ChromeContentBrowserClient::RenderProcessWillLaunch( | 820 void ChromeContentBrowserClient::RenderProcessWillLaunch( |
| 813 content::RenderProcessHost* host) { | 821 content::RenderProcessHost* host) { |
| 814 int id = host->GetID(); | 822 int id = host->GetID(); |
| 815 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); | 823 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); |
| 816 net::URLRequestContextGetter* context = | 824 net::URLRequestContextGetter* context = |
| 817 profile->GetRequestContextForRenderProcess(id); | 825 profile->GetRequestContextForRenderProcess(id); |
| 818 | 826 |
| 819 host->AddFilter(new ChromeRenderMessageFilter(id, profile)); | 827 host->AddFilter(new ChromeRenderMessageFilter(id, profile)); |
| 820 #if defined(ENABLE_PLUGINS) | |
| 821 host->AddFilter(new PluginInfoMessageFilter(id, profile)); | |
| 822 #endif | |
| 823 host->AddFilter(new cast::CastTransportHostFilter); | 828 host->AddFilter(new cast::CastTransportHostFilter); |
| 824 #if defined(ENABLE_PRINTING) | 829 #if defined(ENABLE_PRINTING) |
| 825 host->AddFilter(new printing::PrintingMessageFilter(id, profile)); | 830 host->AddFilter(new printing::PrintingMessageFilter(id, profile)); |
| 826 #endif | 831 #endif |
| 827 host->AddFilter(new SearchProviderInstallStateMessageFilter(id, profile)); | 832 host->AddFilter(new SearchProviderInstallStateMessageFilter(id, profile)); |
| 828 #if defined(ENABLE_SPELLCHECK) | 833 #if defined(ENABLE_SPELLCHECK) |
| 829 host->AddFilter(new SpellCheckMessageFilter(id)); | 834 host->AddFilter(new SpellCheckMessageFilter(id)); |
| 830 #endif | 835 #endif |
| 831 #if defined(OS_MACOSX) | 836 #if defined(OS_MACOSX) |
| 832 host->AddFilter(new SpellCheckMessageFilterMac(id)); | 837 host->AddFilter(new SpellCheckMessageFilterMac(id)); |
| (...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2325 return DownloadPrefs::GetDefaultDownloadDirectory(); | 2330 return DownloadPrefs::GetDefaultDownloadDirectory(); |
| 2326 } | 2331 } |
| 2327 | 2332 |
| 2328 std::string ChromeContentBrowserClient::GetDefaultDownloadName() { | 2333 std::string ChromeContentBrowserClient::GetDefaultDownloadName() { |
| 2329 return l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME); | 2334 return l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME); |
| 2330 } | 2335 } |
| 2331 | 2336 |
| 2332 void ChromeContentBrowserClient::DidCreatePpapiPlugin( | 2337 void ChromeContentBrowserClient::DidCreatePpapiPlugin( |
| 2333 content::BrowserPpapiHost* browser_host) { | 2338 content::BrowserPpapiHost* browser_host) { |
| 2334 #if defined(ENABLE_PLUGINS) | 2339 #if defined(ENABLE_PLUGINS) |
| 2335 browser_host->GetPpapiHost()->AddHostFactoryFilter( | 2340 ChromeContentBrowserClientPluginsPart::DidCreatePpapiPlugin(browser_host); |
| 2336 scoped_ptr<ppapi::host::HostFactory>( | |
| 2337 new ChromeBrowserPepperHostFactory(browser_host))); | |
| 2338 #endif | 2341 #endif |
| 2339 } | 2342 } |
| 2340 | 2343 |
| 2341 content::BrowserPpapiHost* | 2344 content::BrowserPpapiHost* |
| 2342 ChromeContentBrowserClient::GetExternalBrowserPpapiHost( | 2345 ChromeContentBrowserClient::GetExternalBrowserPpapiHost( |
| 2343 int plugin_process_id) { | 2346 int plugin_process_id) { |
| 2344 #if !defined(DISABLE_NACL) | 2347 #if !defined(DISABLE_NACL) |
| 2345 content::BrowserChildProcessHostIterator iter(PROCESS_TYPE_NACL_LOADER); | 2348 content::BrowserChildProcessHostIterator iter(PROCESS_TYPE_NACL_LOADER); |
| 2346 while (!iter.Done()) { | 2349 while (!iter.Done()) { |
| 2347 nacl::NaClProcessHost* host = static_cast<nacl::NaClProcessHost*>( | 2350 nacl::NaClProcessHost* host = static_cast<nacl::NaClProcessHost*>( |
| 2348 iter.GetDelegate()); | 2351 iter.GetDelegate()); |
| 2349 if (host->process() && | 2352 if (host->process() && |
| 2350 host->process()->GetData().id == plugin_process_id) { | 2353 host->process()->GetData().id == plugin_process_id) { |
| 2351 // Found the plugin. | 2354 // Found the plugin. |
| 2352 return host->browser_ppapi_host(); | 2355 return host->browser_ppapi_host(); |
| 2353 } | 2356 } |
| 2354 ++iter; | 2357 ++iter; |
| 2355 } | 2358 } |
| 2356 #endif | 2359 #endif |
| 2357 return NULL; | 2360 return NULL; |
| 2358 } | 2361 } |
| 2359 | 2362 |
| 2360 bool ChromeContentBrowserClient::AllowPepperSocketAPI( | 2363 bool ChromeContentBrowserClient::AllowPepperSocketAPI( |
| 2361 content::BrowserContext* browser_context, | 2364 content::BrowserContext* browser_context, |
| 2362 const GURL& url, | 2365 const GURL& url, |
| 2363 bool private_api, | 2366 bool private_api, |
| 2364 const content::SocketPermissionRequest* params) { | 2367 const content::SocketPermissionRequest* params) { |
| 2365 #if defined(ENABLE_EXTENSIONS) | 2368 #if defined(ENABLE_PLUGINS) && defined(ENABLE_EXTENSIONS) |
| 2366 Profile* profile = Profile::FromBrowserContext(browser_context); | 2369 return ChromeContentBrowserClientPluginsPart::AllowPepperSocketAPI( |
| 2367 const extensions::ExtensionSet* extension_set = NULL; | 2370 browser_context, url, private_api, params, allowed_socket_origins_); |
| 2368 if (profile) { | |
| 2369 extension_set = | |
| 2370 &extensions::ExtensionRegistry::Get(profile)->enabled_extensions(); | |
| 2371 } | |
| 2372 | |
| 2373 if (private_api) { | |
| 2374 // Access to private socket APIs is controlled by the whitelist. | |
| 2375 if (IsExtensionOrSharedModuleWhitelisted(url, extension_set, | |
| 2376 allowed_socket_origins_)) { | |
| 2377 return true; | |
| 2378 } | |
| 2379 } else { | |
| 2380 // Access to public socket APIs is controlled by extension permissions. | |
| 2381 if (url.is_valid() && url.SchemeIs(extensions::kExtensionScheme) && | |
| 2382 extension_set) { | |
| 2383 const Extension* extension = extension_set->GetByID(url.host()); | |
| 2384 if (extension) { | |
| 2385 const extensions::PermissionsData* permissions_data = | |
| 2386 extension->permissions_data(); | |
| 2387 if (params) { | |
| 2388 extensions::SocketPermission::CheckParam check_params( | |
| 2389 params->type, params->host, params->port); | |
| 2390 if (permissions_data->CheckAPIPermissionWithParam( | |
| 2391 extensions::APIPermission::kSocket, &check_params)) { | |
| 2392 return true; | |
| 2393 } | |
| 2394 } else if (permissions_data->HasAPIPermission( | |
| 2395 extensions::APIPermission::kSocket)) { | |
| 2396 return true; | |
| 2397 } | |
| 2398 } | |
| 2399 } | |
| 2400 } | |
| 2401 | |
| 2402 // Allow both public and private APIs if the command line says so. | |
| 2403 return IsHostAllowedByCommandLine(url, extension_set, | |
| 2404 switches::kAllowNaClSocketAPI); | |
| 2405 #else | 2371 #else |
| 2406 return false; | 2372 return false; |
| 2407 #endif | 2373 #endif |
| 2408 } | 2374 } |
| 2409 | 2375 |
| 2410 ui::SelectFilePolicy* ChromeContentBrowserClient::CreateSelectFilePolicy( | 2376 ui::SelectFilePolicy* ChromeContentBrowserClient::CreateSelectFilePolicy( |
| 2411 WebContents* web_contents) { | 2377 WebContents* web_contents) { |
| 2412 return new ChromeSelectFilePolicy(web_contents); | 2378 return new ChromeSelectFilePolicy(web_contents); |
| 2413 } | 2379 } |
| 2414 | 2380 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2589 #if defined(OS_ANDROID) | 2555 #if defined(OS_ANDROID) |
| 2590 return new DevToolsManagerDelegateAndroid(); | 2556 return new DevToolsManagerDelegateAndroid(); |
| 2591 #else | 2557 #else |
| 2592 return new ChromeDevToolsManagerDelegate(); | 2558 return new ChromeDevToolsManagerDelegate(); |
| 2593 #endif | 2559 #endif |
| 2594 } | 2560 } |
| 2595 | 2561 |
| 2596 bool ChromeContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle( | 2562 bool ChromeContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle( |
| 2597 content::BrowserContext* browser_context, | 2563 content::BrowserContext* browser_context, |
| 2598 const GURL& url) { | 2564 const GURL& url) { |
| 2599 #if defined(ENABLE_EXTENSIONS) | 2565 #if defined(ENABLE_PLUGINS) && defined(ENABLE_EXTENSIONS) |
| 2600 Profile* profile = Profile::FromBrowserContext(browser_context); | 2566 return ChromeContentBrowserClientPluginsPart:: |
| 2601 const extensions::ExtensionSet* extension_set = NULL; | 2567 IsPluginAllowedToCallRequestOSFileHandle(browser_context, url, |
| 2602 if (profile) { | 2568 allowed_file_handle_origins_); |
| 2603 extension_set = | |
| 2604 &extensions::ExtensionRegistry::Get(profile)->enabled_extensions(); | |
| 2605 } | |
| 2606 return IsExtensionOrSharedModuleWhitelisted(url, extension_set, | |
| 2607 allowed_file_handle_origins_) || | |
| 2608 IsHostAllowedByCommandLine(url, extension_set, | |
| 2609 switches::kAllowNaClFileHandleAPI); | |
| 2610 #else | 2569 #else |
| 2611 return false; | 2570 return false; |
| 2612 #endif | 2571 #endif |
| 2613 } | 2572 } |
| 2614 | 2573 |
| 2615 bool ChromeContentBrowserClient::IsPluginAllowedToUseDevChannelAPIs( | 2574 bool ChromeContentBrowserClient::IsPluginAllowedToUseDevChannelAPIs( |
| 2616 content::BrowserContext* browser_context, | 2575 content::BrowserContext* browser_context, |
| 2617 const GURL& url) { | 2576 const GURL& url) { |
| 2618 #if defined(ENABLE_EXTENSIONS) | 2577 #if defined(ENABLE_PLUGINS) && defined(ENABLE_EXTENSIONS) |
| 2619 // Allow access for tests. | 2578 return ChromeContentBrowserClientPluginsPart:: |
| 2620 if (CommandLine::ForCurrentProcess()->HasSwitch( | 2579 IsPluginAllowedToUseDevChannelAPIs(browser_context, url, |
| 2621 switches::kEnablePepperTesting)) { | 2580 allowed_dev_channel_origins_); |
| 2622 return true; | |
| 2623 } | |
| 2624 | |
| 2625 Profile* profile = Profile::FromBrowserContext(browser_context); | |
| 2626 const extensions::ExtensionSet* extension_set = NULL; | |
| 2627 if (profile) { | |
| 2628 extension_set = | |
| 2629 &extensions::ExtensionRegistry::Get(profile)->enabled_extensions(); | |
| 2630 } | |
| 2631 | |
| 2632 // Allow access for whitelisted applications. | |
| 2633 if (IsExtensionOrSharedModuleWhitelisted(url, | |
| 2634 extension_set, | |
| 2635 allowed_dev_channel_origins_)) { | |
| 2636 return true; | |
| 2637 } | |
| 2638 | |
| 2639 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | |
| 2640 // Allow dev channel APIs to be used on "Canary", "Dev", and "Unknown" | |
| 2641 // releases of Chrome. Permitting "Unknown" allows these APIs to be used on | |
| 2642 // Chromium builds as well. | |
| 2643 return channel <= chrome::VersionInfo::CHANNEL_DEV; | |
| 2644 #else | 2581 #else |
| 2645 return false; | 2582 return false; |
| 2646 #endif | 2583 #endif |
| 2647 } | 2584 } |
| 2648 | 2585 |
| 2649 net::CookieStore* | 2586 net::CookieStore* |
| 2650 ChromeContentBrowserClient::OverrideCookieStoreForRenderProcess( | 2587 ChromeContentBrowserClient::OverrideCookieStoreForRenderProcess( |
| 2651 int render_process_id) { | 2588 int render_process_id) { |
| 2652 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 2589 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 2653 if (!prerender_tracker_) | 2590 if (!prerender_tracker_) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2673 switches::kDisableWebRtcEncryption, | 2610 switches::kDisableWebRtcEncryption, |
| 2674 }; | 2611 }; |
| 2675 to_command_line->CopySwitchesFrom(from_command_line, | 2612 to_command_line->CopySwitchesFrom(from_command_line, |
| 2676 kWebRtcDevSwitchNames, | 2613 kWebRtcDevSwitchNames, |
| 2677 arraysize(kWebRtcDevSwitchNames)); | 2614 arraysize(kWebRtcDevSwitchNames)); |
| 2678 } | 2615 } |
| 2679 } | 2616 } |
| 2680 #endif // defined(ENABLE_WEBRTC) | 2617 #endif // defined(ENABLE_WEBRTC) |
| 2681 | 2618 |
| 2682 } // namespace chrome | 2619 } // namespace chrome |
| OLD | NEW |