| 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 17 matching lines...) Expand all Loading... |
| 28 #include "chrome/browser/chrome_quota_permission_context.h" | 28 #include "chrome/browser/chrome_quota_permission_context.h" |
| 29 #include "chrome/browser/content_settings/content_settings_utils.h" | 29 #include "chrome/browser/content_settings/content_settings_utils.h" |
| 30 #include "chrome/browser/content_settings/cookie_settings.h" | 30 #include "chrome/browser/content_settings/cookie_settings.h" |
| 31 #include "chrome/browser/content_settings/host_content_settings_map.h" | 31 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 32 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 32 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 33 #include "chrome/browser/defaults.h" | 33 #include "chrome/browser/defaults.h" |
| 34 #include "chrome/browser/download/download_prefs.h" | 34 #include "chrome/browser/download/download_prefs.h" |
| 35 #include "chrome/browser/extensions/api/web_request/web_request_api.h" | 35 #include "chrome/browser/extensions/api/web_request/web_request_api.h" |
| 36 #include "chrome/browser/extensions/browser_permissions_policy_delegate.h" | 36 #include "chrome/browser/extensions/browser_permissions_policy_delegate.h" |
| 37 #include "chrome/browser/extensions/extension_host.h" | 37 #include "chrome/browser/extensions/extension_host.h" |
| 38 #include "chrome/browser/extensions/extension_process_manager.h" | |
| 39 #include "chrome/browser/extensions/extension_service.h" | 38 #include "chrome/browser/extensions/extension_service.h" |
| 40 #include "chrome/browser/extensions/extension_system.h" | 39 #include "chrome/browser/extensions/extension_system.h" |
| 41 #include "chrome/browser/extensions/extension_web_ui.h" | 40 #include "chrome/browser/extensions/extension_web_ui.h" |
| 42 #include "chrome/browser/extensions/extension_webkit_preferences.h" | 41 #include "chrome/browser/extensions/extension_webkit_preferences.h" |
| 43 #include "chrome/browser/extensions/suggest_permission_util.h" | 42 #include "chrome/browser/extensions/suggest_permission_util.h" |
| 44 #include "chrome/browser/geolocation/chrome_access_token_store.h" | 43 #include "chrome/browser/geolocation/chrome_access_token_store.h" |
| 45 #include "chrome/browser/google/google_util.h" | 44 #include "chrome/browser/google/google_util.h" |
| 46 #include "chrome/browser/guestview/adview/adview_guest.h" | 45 #include "chrome/browser/guestview/adview/adview_guest.h" |
| 47 #include "chrome/browser/guestview/guestview_constants.h" | 46 #include "chrome/browser/guestview/guestview_constants.h" |
| 48 #include "chrome/browser/guestview/webview/webview_guest.h" | 47 #include "chrome/browser/guestview/webview/webview_guest.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 #include "content/public/browser/render_process_host.h" | 119 #include "content/public/browser/render_process_host.h" |
| 121 #include "content/public/browser/render_view_host.h" | 120 #include "content/public/browser/render_view_host.h" |
| 122 #include "content/public/browser/resource_context.h" | 121 #include "content/public/browser/resource_context.h" |
| 123 #include "content/public/browser/site_instance.h" | 122 #include "content/public/browser/site_instance.h" |
| 124 #include "content/public/browser/web_contents.h" | 123 #include "content/public/browser/web_contents.h" |
| 125 #include "content/public/browser/web_contents_view.h" | 124 #include "content/public/browser/web_contents_view.h" |
| 126 #include "content/public/common/child_process_host.h" | 125 #include "content/public/common/child_process_host.h" |
| 127 #include "content/public/common/content_descriptors.h" | 126 #include "content/public/common/content_descriptors.h" |
| 128 #include "content/public/common/url_utils.h" | 127 #include "content/public/common/url_utils.h" |
| 129 #include "extensions/browser/info_map.h" | 128 #include "extensions/browser/info_map.h" |
| 129 #include "extensions/browser/process_manager.h" |
| 130 #include "extensions/browser/view_type_utils.h" | 130 #include "extensions/browser/view_type_utils.h" |
| 131 #include "extensions/common/constants.h" | 131 #include "extensions/common/constants.h" |
| 132 #include "extensions/common/manifest_handlers/background_info.h" | 132 #include "extensions/common/manifest_handlers/background_info.h" |
| 133 #include "extensions/common/switches.h" | 133 #include "extensions/common/switches.h" |
| 134 #include "grit/generated_resources.h" | 134 #include "grit/generated_resources.h" |
| 135 #include "grit/ui_resources.h" | 135 #include "grit/ui_resources.h" |
| 136 #include "net/base/escape.h" | 136 #include "net/base/escape.h" |
| 137 #include "net/base/mime_util.h" | 137 #include "net/base/mime_util.h" |
| 138 #include "net/cookies/canonical_cookie.h" | 138 #include "net/cookies/canonical_cookie.h" |
| 139 #include "net/cookies/cookie_options.h" | 139 #include "net/cookies/cookie_options.h" |
| (...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1214 std::set<int> process_ids; | 1214 std::set<int> process_ids; |
| 1215 size_t max_process_count = | 1215 size_t max_process_count = |
| 1216 content::RenderProcessHost::GetMaxRendererProcessCount(); | 1216 content::RenderProcessHost::GetMaxRendererProcessCount(); |
| 1217 | 1217 |
| 1218 // Go through all profiles to ensure we have total count of extension | 1218 // Go through all profiles to ensure we have total count of extension |
| 1219 // processes containing background pages, otherwise one profile can | 1219 // processes containing background pages, otherwise one profile can |
| 1220 // starve the other. | 1220 // starve the other. |
| 1221 std::vector<Profile*> profiles = g_browser_process->profile_manager()-> | 1221 std::vector<Profile*> profiles = g_browser_process->profile_manager()-> |
| 1222 GetLoadedProfiles(); | 1222 GetLoadedProfiles(); |
| 1223 for (size_t i = 0; i < profiles.size(); ++i) { | 1223 for (size_t i = 0; i < profiles.size(); ++i) { |
| 1224 ExtensionProcessManager* epm = | 1224 extensions::ProcessManager* epm = |
| 1225 extensions::ExtensionSystem::Get(profiles[i])->process_manager(); | 1225 extensions::ExtensionSystem::Get(profiles[i])->process_manager(); |
| 1226 for (ExtensionProcessManager::const_iterator iter = | 1226 for (extensions::ProcessManager::const_iterator iter = |
| 1227 epm->background_hosts().begin(); | 1227 epm->background_hosts().begin(); |
| 1228 iter != epm->background_hosts().end(); ++iter) { | 1228 iter != epm->background_hosts().end(); ++iter) { |
| 1229 const extensions::ExtensionHost* host = *iter; | 1229 const extensions::ExtensionHost* host = *iter; |
| 1230 process_ids.insert(host->render_process_host()->GetID()); | 1230 process_ids.insert(host->render_process_host()->GetID()); |
| 1231 } | 1231 } |
| 1232 } | 1232 } |
| 1233 | 1233 |
| 1234 if (process_ids.size() > | 1234 if (process_ids.size() > |
| 1235 (max_process_count * chrome::kMaxShareOfExtensionProcesses)) { | 1235 (max_process_count * chrome::kMaxShareOfExtensionProcesses)) { |
| 1236 return true; | 1236 return true; |
| (...skipping 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2630 return IsExtensionOrSharedModuleWhitelisted(url, extension_set, | 2630 return IsExtensionOrSharedModuleWhitelisted(url, extension_set, |
| 2631 allowed_file_handle_origins_) || | 2631 allowed_file_handle_origins_) || |
| 2632 IsHostAllowedByCommandLine(url, extension_set, | 2632 IsHostAllowedByCommandLine(url, extension_set, |
| 2633 switches::kAllowNaClFileHandleAPI); | 2633 switches::kAllowNaClFileHandleAPI); |
| 2634 #else | 2634 #else |
| 2635 return false; | 2635 return false; |
| 2636 #endif | 2636 #endif |
| 2637 } | 2637 } |
| 2638 | 2638 |
| 2639 } // namespace chrome | 2639 } // namespace chrome |
| OLD | NEW |