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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 #include "chrome/browser/ui/sync/sync_promo_ui.h" | 84 #include "chrome/browser/ui/sync/sync_promo_ui.h" |
85 #include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h" | 85 #include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h" |
86 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" | 86 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" |
87 #include "chrome/browser/validation_message_message_filter.h" | 87 #include "chrome/browser/validation_message_message_filter.h" |
88 #include "chrome/common/chrome_constants.h" | 88 #include "chrome/common/chrome_constants.h" |
89 #include "chrome/common/chrome_paths.h" | 89 #include "chrome/common/chrome_paths.h" |
90 #include "chrome/common/chrome_switches.h" | 90 #include "chrome/common/chrome_switches.h" |
91 #include "chrome/common/chrome_version_info.h" | 91 #include "chrome/common/chrome_version_info.h" |
92 #include "chrome/common/env_vars.h" | 92 #include "chrome/common/env_vars.h" |
93 #include "chrome/common/extensions/extension_process_policy.h" | 93 #include "chrome/common/extensions/extension_process_policy.h" |
94 #include "chrome/common/extensions/extension_set.h" | |
95 #include "chrome/common/extensions/manifest_handlers/app_isolation_info.h" | 94 #include "chrome/common/extensions/manifest_handlers/app_isolation_info.h" |
96 #include "chrome/common/extensions/permissions/socket_permission.h" | 95 #include "chrome/common/extensions/permissions/socket_permission.h" |
97 #include "chrome/common/extensions/web_accessible_resources_handler.h" | 96 #include "chrome/common/extensions/web_accessible_resources_handler.h" |
98 #include "chrome/common/logging_chrome.h" | 97 #include "chrome/common/logging_chrome.h" |
99 #include "chrome/common/pepper_permission_util.h" | 98 #include "chrome/common/pepper_permission_util.h" |
100 #include "chrome/common/pref_names.h" | 99 #include "chrome/common/pref_names.h" |
101 #include "chrome/common/render_messages.h" | 100 #include "chrome/common/render_messages.h" |
102 #include "chrome/common/url_constants.h" | 101 #include "chrome/common/url_constants.h" |
103 #include "chrome/installer/util/google_update_settings.h" | 102 #include "chrome/installer/util/google_update_settings.h" |
104 #include "chromeos/chromeos_constants.h" | 103 #include "chromeos/chromeos_constants.h" |
(...skipping 17 matching lines...) Expand all Loading... |
122 #include "content/public/browser/web_contents.h" | 121 #include "content/public/browser/web_contents.h" |
123 #include "content/public/browser/web_contents_view.h" | 122 #include "content/public/browser/web_contents_view.h" |
124 #include "content/public/common/child_process_host.h" | 123 #include "content/public/common/child_process_host.h" |
125 #include "content/public/common/content_descriptors.h" | 124 #include "content/public/common/content_descriptors.h" |
126 #include "content/public/common/url_utils.h" | 125 #include "content/public/common/url_utils.h" |
127 #include "extensions/browser/info_map.h" | 126 #include "extensions/browser/info_map.h" |
128 #include "extensions/browser/process_manager.h" | 127 #include "extensions/browser/process_manager.h" |
129 #include "extensions/browser/view_type_utils.h" | 128 #include "extensions/browser/view_type_utils.h" |
130 #include "extensions/common/constants.h" | 129 #include "extensions/common/constants.h" |
131 #include "extensions/common/extension.h" | 130 #include "extensions/common/extension.h" |
| 131 #include "extensions/common/extension_set.h" |
132 #include "extensions/common/manifest_handlers/background_info.h" | 132 #include "extensions/common/manifest_handlers/background_info.h" |
133 #include "extensions/common/manifest_handlers/shared_module_info.h" | 133 #include "extensions/common/manifest_handlers/shared_module_info.h" |
134 #include "extensions/common/permissions/permissions_data.h" | 134 #include "extensions/common/permissions/permissions_data.h" |
135 #include "extensions/common/switches.h" | 135 #include "extensions/common/switches.h" |
136 #include "grit/generated_resources.h" | 136 #include "grit/generated_resources.h" |
137 #include "grit/ui_resources.h" | 137 #include "grit/ui_resources.h" |
138 #include "net/base/mime_util.h" | 138 #include "net/base/mime_util.h" |
139 #include "net/cookies/canonical_cookie.h" | 139 #include "net/cookies/canonical_cookie.h" |
140 #include "net/cookies/cookie_options.h" | 140 #include "net/cookies/cookie_options.h" |
141 #include "net/ssl/ssl_cert_request_info.h" | 141 #include "net/ssl/ssl_cert_request_info.h" |
(...skipping 1765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1907 // Skip showing the infobar if the request comes from an extension, and that | 1907 // Skip showing the infobar if the request comes from an extension, and that |
1908 // extension has the 'notify' permission. (If the extension does not have the | 1908 // extension has the 'notify' permission. (If the extension does not have the |
1909 // permission, the user will still be prompted.) | 1909 // permission, the user will still be prompted.) |
1910 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); | 1910 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); |
1911 InfoMap* extension_info_map = | 1911 InfoMap* extension_info_map = |
1912 extensions::ExtensionSystem::Get(profile)->info_map(); | 1912 extensions::ExtensionSystem::Get(profile)->info_map(); |
1913 DesktopNotificationService* notification_service = | 1913 DesktopNotificationService* notification_service = |
1914 DesktopNotificationServiceFactory::GetForProfile(profile); | 1914 DesktopNotificationServiceFactory::GetForProfile(profile); |
1915 const Extension* extension = NULL; | 1915 const Extension* extension = NULL; |
1916 if (extension_info_map) { | 1916 if (extension_info_map) { |
1917 ExtensionSet extensions; | 1917 extensions::ExtensionSet extensions; |
1918 extension_info_map->GetExtensionsWithAPIPermissionForSecurityOrigin( | 1918 extension_info_map->GetExtensionsWithAPIPermissionForSecurityOrigin( |
1919 source_origin, render_process_id, | 1919 source_origin, render_process_id, |
1920 extensions::APIPermission::kNotification, &extensions); | 1920 extensions::APIPermission::kNotification, &extensions); |
1921 for (ExtensionSet::const_iterator iter = extensions.begin(); | 1921 for (extensions::ExtensionSet::const_iterator iter = extensions.begin(); |
1922 iter != extensions.end(); ++iter) { | 1922 iter != extensions.end(); ++iter) { |
1923 if (notification_service->IsNotifierEnabled(NotifierId( | 1923 if (notification_service->IsNotifierEnabled(NotifierId( |
1924 NotifierId::APPLICATION, (*iter)->id()))) { | 1924 NotifierId::APPLICATION, (*iter)->id()))) { |
1925 extension = iter->get(); | 1925 extension = iter->get(); |
1926 break; | 1926 break; |
1927 } | 1927 } |
1928 } | 1928 } |
1929 } | 1929 } |
1930 RenderViewHost* rvh = | 1930 RenderViewHost* rvh = |
1931 RenderViewHost::FromID(render_process_id, render_view_id); | 1931 RenderViewHost::FromID(render_process_id, render_view_id); |
(...skipping 18 matching lines...) Expand all Loading... |
1950 int render_process_id) { | 1950 int render_process_id) { |
1951 #if defined(ENABLE_NOTIFICATIONS) | 1951 #if defined(ENABLE_NOTIFICATIONS) |
1952 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 1952 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
1953 | 1953 |
1954 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); | 1954 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); |
1955 InfoMap* extension_info_map = io_data->GetExtensionInfoMap(); | 1955 InfoMap* extension_info_map = io_data->GetExtensionInfoMap(); |
1956 | 1956 |
1957 // We want to see if there is an extension that hasn't been manually disabled | 1957 // We want to see if there is an extension that hasn't been manually disabled |
1958 // that has the notifications permission and applies to this security origin. | 1958 // that has the notifications permission and applies to this security origin. |
1959 // First, get the list of extensions with permission for the origin. | 1959 // First, get the list of extensions with permission for the origin. |
1960 ExtensionSet extensions; | 1960 extensions::ExtensionSet extensions; |
1961 extension_info_map->GetExtensionsWithAPIPermissionForSecurityOrigin( | 1961 extension_info_map->GetExtensionsWithAPIPermissionForSecurityOrigin( |
1962 source_origin, render_process_id, | 1962 source_origin, render_process_id, |
1963 extensions::APIPermission::kNotification, &extensions); | 1963 extensions::APIPermission::kNotification, &extensions); |
1964 for (ExtensionSet::const_iterator iter = extensions.begin(); | 1964 for (extensions::ExtensionSet::const_iterator iter = extensions.begin(); |
1965 iter != extensions.end(); ++iter) { | 1965 iter != extensions.end(); ++iter) { |
1966 // Then, check to see if it's been disabled by the user. | 1966 // Then, check to see if it's been disabled by the user. |
1967 if (!extension_info_map->AreNotificationsDisabled((*iter)->id())) | 1967 if (!extension_info_map->AreNotificationsDisabled((*iter)->id())) |
1968 return blink::WebNotificationPresenter::PermissionAllowed; | 1968 return blink::WebNotificationPresenter::PermissionAllowed; |
1969 } | 1969 } |
1970 | 1970 |
1971 // No enabled extensions exist, so check the normal host content settings. | 1971 // No enabled extensions exist, so check the normal host content settings. |
1972 HostContentSettingsMap* host_content_settings_map = | 1972 HostContentSettingsMap* host_content_settings_map = |
1973 io_data->GetHostContentSettingsMap(); | 1973 io_data->GetHostContentSettingsMap(); |
1974 ContentSetting setting = host_content_settings_map->GetContentSetting( | 1974 ContentSetting setting = host_content_settings_map->GetContentSetting( |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2439 extension->HasAPIPermission(APIPermission::kAdView); | 2439 extension->HasAPIPermission(APIPermission::kAdView); |
2440 } | 2440 } |
2441 | 2441 |
2442 bool ChromeContentBrowserClient::AllowPepperSocketAPI( | 2442 bool ChromeContentBrowserClient::AllowPepperSocketAPI( |
2443 content::BrowserContext* browser_context, | 2443 content::BrowserContext* browser_context, |
2444 const GURL& url, | 2444 const GURL& url, |
2445 bool private_api, | 2445 bool private_api, |
2446 const content::SocketPermissionRequest* params) { | 2446 const content::SocketPermissionRequest* params) { |
2447 #if defined(ENABLE_PLUGINS) | 2447 #if defined(ENABLE_PLUGINS) |
2448 Profile* profile = Profile::FromBrowserContext(browser_context); | 2448 Profile* profile = Profile::FromBrowserContext(browser_context); |
2449 const ExtensionSet* extension_set = NULL; | 2449 const extensions::ExtensionSet* extension_set = NULL; |
2450 if (profile) { | 2450 if (profile) { |
2451 extension_set = extensions::ExtensionSystem::Get(profile)-> | 2451 extension_set = extensions::ExtensionSystem::Get(profile)-> |
2452 extension_service()->extensions(); | 2452 extension_service()->extensions(); |
2453 } | 2453 } |
2454 | 2454 |
2455 if (private_api) { | 2455 if (private_api) { |
2456 // Access to private socket APIs is controlled by the whitelist. | 2456 // Access to private socket APIs is controlled by the whitelist. |
2457 if (IsExtensionOrSharedModuleWhitelisted(url, extension_set, | 2457 if (IsExtensionOrSharedModuleWhitelisted(url, extension_set, |
2458 allowed_socket_origins_)) { | 2458 allowed_socket_origins_)) { |
2459 return true; | 2459 return true; |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2632 return chrome::NewCryptoModuleBlockingDialogDelegate( | 2632 return chrome::NewCryptoModuleBlockingDialogDelegate( |
2633 chrome::kCryptoModulePasswordKeygen, url.host()); | 2633 chrome::kCryptoModulePasswordKeygen, url.host()); |
2634 } | 2634 } |
2635 #endif | 2635 #endif |
2636 | 2636 |
2637 bool ChromeContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle( | 2637 bool ChromeContentBrowserClient::IsPluginAllowedToCallRequestOSFileHandle( |
2638 content::BrowserContext* browser_context, | 2638 content::BrowserContext* browser_context, |
2639 const GURL& url) { | 2639 const GURL& url) { |
2640 #if defined(ENABLE_PLUGINS) | 2640 #if defined(ENABLE_PLUGINS) |
2641 Profile* profile = Profile::FromBrowserContext(browser_context); | 2641 Profile* profile = Profile::FromBrowserContext(browser_context); |
2642 const ExtensionSet* extension_set = NULL; | 2642 const extensions::ExtensionSet* extension_set = NULL; |
2643 if (profile) { | 2643 if (profile) { |
2644 extension_set = extensions::ExtensionSystem::Get(profile)-> | 2644 extension_set = extensions::ExtensionSystem::Get(profile)-> |
2645 extension_service()->extensions(); | 2645 extension_service()->extensions(); |
2646 } | 2646 } |
2647 // TODO(teravest): Populate allowed_file_handle_origins_ when FileIO is moved | 2647 // TODO(teravest): Populate allowed_file_handle_origins_ when FileIO is moved |
2648 // from the renderer to the browser. | 2648 // from the renderer to the browser. |
2649 return IsExtensionOrSharedModuleWhitelisted(url, extension_set, | 2649 return IsExtensionOrSharedModuleWhitelisted(url, extension_set, |
2650 allowed_file_handle_origins_) || | 2650 allowed_file_handle_origins_) || |
2651 IsHostAllowedByCommandLine(url, extension_set, | 2651 IsHostAllowedByCommandLine(url, extension_set, |
2652 switches::kAllowNaClFileHandleAPI); | 2652 switches::kAllowNaClFileHandleAPI); |
2653 #else | 2653 #else |
2654 return false; | 2654 return false; |
2655 #endif | 2655 #endif |
2656 } | 2656 } |
2657 | 2657 |
2658 } // namespace chrome | 2658 } // namespace chrome |
OLD | NEW |