| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/extensions/chrome_content_browser_client_extensions_par
t.h" | 5 #include "chrome/browser/extensions/chrome_content_browser_client_extensions_par
t.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/extensions/api/web_request/web_request_api.h" | 11 #include "chrome/browser/extensions/api/web_request/web_request_api.h" |
| 12 #include "chrome/browser/extensions/browser_permissions_policy_delegate.h" | 12 #include "chrome/browser/extensions/browser_permissions_policy_delegate.h" |
| 13 #include "chrome/browser/extensions/extension_service.h" | 13 #include "chrome/browser/extensions/extension_service.h" |
| 14 #include "chrome/browser/extensions/extension_web_ui.h" | 14 #include "chrome/browser/extensions/extension_web_ui.h" |
| 15 #include "chrome/browser/extensions/extension_webkit_preferences.h" | 15 #include "chrome/browser/extensions/extension_webkit_preferences.h" |
| 16 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" | 16 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/profiles/profile_io_data.h" | 18 #include "chrome/browser/profiles/profile_io_data.h" |
| 19 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
| 20 #include "chrome/browser/renderer_host/chrome_extension_message_filter.h" | 20 #include "chrome/browser/renderer_host/chrome_extension_message_filter.h" |
| 21 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" | 21 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" |
| 22 #include "chrome/common/chrome_constants.h" | 22 #include "chrome/common/chrome_constants.h" |
| 23 #include "chrome/common/extensions/extension_constants.h" | |
| 24 #include "chrome/common/extensions/extension_process_policy.h" | 23 #include "chrome/common/extensions/extension_process_policy.h" |
| 25 #include "chrome/common/extensions/manifest_handlers/app_isolation_info.h" | 24 #include "chrome/common/extensions/manifest_handlers/app_isolation_info.h" |
| 26 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
| 27 #include "content/public/browser/browser_url_handler.h" | 26 #include "content/public/browser/browser_url_handler.h" |
| 28 #include "content/public/browser/render_process_host.h" | 27 #include "content/public/browser/render_process_host.h" |
| 29 #include "content/public/browser/render_view_host.h" | 28 #include "content/public/browser/render_view_host.h" |
| 30 #include "content/public/browser/site_instance.h" | 29 #include "content/public/browser/site_instance.h" |
| 31 #include "content/public/browser/web_contents.h" | 30 #include "content/public/browser/web_contents.h" |
| 32 #include "content/public/common/content_switches.h" | 31 #include "content/public/common/content_switches.h" |
| 33 #include "extensions/browser/extension_host.h" | 32 #include "extensions/browser/extension_host.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 Profile::FromBrowserContext(process_host->GetBrowserContext()); | 189 Profile::FromBrowserContext(process_host->GetBrowserContext()); |
| 191 ExtensionService* service = | 190 ExtensionService* service = |
| 192 ExtensionSystem::Get(profile)->extension_service(); | 191 ExtensionSystem::Get(profile)->extension_service(); |
| 193 if (!service) | 192 if (!service) |
| 194 return true; | 193 return true; |
| 195 | 194 |
| 196 const Extension* new_extension = | 195 const Extension* new_extension = |
| 197 service->extensions()->GetExtensionOrAppByURL(url); | 196 service->extensions()->GetExtensionOrAppByURL(url); |
| 198 if (new_extension && | 197 if (new_extension && |
| 199 new_extension->is_hosted_app() && | 198 new_extension->is_hosted_app() && |
| 200 new_extension->id() == extension_misc::kWebStoreAppId && | 199 new_extension->id() == extensions::kWebStoreAppId && |
| 201 !ProcessMap::Get(profile)->Contains( | 200 !ProcessMap::Get(profile)->Contains( |
| 202 new_extension->id(), process_host->GetID())) { | 201 new_extension->id(), process_host->GetID())) { |
| 203 return false; | 202 return false; |
| 204 } | 203 } |
| 205 return true; | 204 return true; |
| 206 } | 205 } |
| 207 | 206 |
| 208 // static | 207 // static |
| 209 bool ChromeContentBrowserClientExtensionsPart::IsSuitableHost( | 208 bool ChromeContentBrowserClientExtensionsPart::IsSuitableHost( |
| 210 Profile* profile, | 209 Profile* profile, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 // | 291 // |
| 293 // We ignore hosted apps here so that other tabs in their BrowsingInstance can | 292 // We ignore hosted apps here so that other tabs in their BrowsingInstance can |
| 294 // use postMessage with them. (The exception is the Chrome Web Store, which | 293 // use postMessage with them. (The exception is the Chrome Web Store, which |
| 295 // is a hosted app that requires its own BrowsingInstance.) Navigations | 294 // is a hosted app that requires its own BrowsingInstance.) Navigations |
| 296 // to/from a hosted app will still trigger a SiteInstance swap in | 295 // to/from a hosted app will still trigger a SiteInstance swap in |
| 297 // RenderFrameHostManager. | 296 // RenderFrameHostManager. |
| 298 const Extension* current_extension = | 297 const Extension* current_extension = |
| 299 service->extensions()->GetExtensionOrAppByURL(current_url); | 298 service->extensions()->GetExtensionOrAppByURL(current_url); |
| 300 if (current_extension && | 299 if (current_extension && |
| 301 current_extension->is_hosted_app() && | 300 current_extension->is_hosted_app() && |
| 302 current_extension->id() != extension_misc::kWebStoreAppId) | 301 current_extension->id() != extensions::kWebStoreAppId) |
| 303 current_extension = NULL; | 302 current_extension = NULL; |
| 304 | 303 |
| 305 const Extension* new_extension = | 304 const Extension* new_extension = |
| 306 service->extensions()->GetExtensionOrAppByURL(new_url); | 305 service->extensions()->GetExtensionOrAppByURL(new_url); |
| 307 if (new_extension && | 306 if (new_extension && |
| 308 new_extension->is_hosted_app() && | 307 new_extension->is_hosted_app() && |
| 309 new_extension->id() != extension_misc::kWebStoreAppId) | 308 new_extension->id() != extensions::kWebStoreAppId) |
| 310 new_extension = NULL; | 309 new_extension = NULL; |
| 311 | 310 |
| 312 // First do a process check. We should force a BrowsingInstance swap if the | 311 // First do a process check. We should force a BrowsingInstance swap if the |
| 313 // current process doesn't know about new_extension, even if current_extension | 312 // current process doesn't know about new_extension, even if current_extension |
| 314 // is somehow the same as new_extension. | 313 // is somehow the same as new_extension. |
| 315 ProcessMap* process_map = ProcessMap::Get(profile); | 314 ProcessMap* process_map = ProcessMap::Get(profile); |
| 316 if (new_extension && | 315 if (new_extension && |
| 317 site_instance->HasProcess() && | 316 site_instance->HasProcess() && |
| 318 !process_map->Contains( | 317 !process_map->Contains( |
| 319 new_extension->id(), site_instance->GetProcess()->GetID())) | 318 new_extension->id(), site_instance->GetProcess()->GetID())) |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 DCHECK(profile); | 528 DCHECK(profile); |
| 530 if (ProcessMap::Get(profile)->Contains(process->GetID())) { | 529 if (ProcessMap::Get(profile)->Contains(process->GetID())) { |
| 531 command_line->AppendSwitch(switches::kExtensionProcess); | 530 command_line->AppendSwitch(switches::kExtensionProcess); |
| 532 #if defined(ENABLE_WEBRTC) | 531 #if defined(ENABLE_WEBRTC) |
| 533 command_line->AppendSwitch(::switches::kEnableWebRtcHWH264Encoding); | 532 command_line->AppendSwitch(::switches::kEnableWebRtcHWH264Encoding); |
| 534 #endif | 533 #endif |
| 535 } | 534 } |
| 536 } | 535 } |
| 537 | 536 |
| 538 } // namespace extensions | 537 } // namespace extensions |
| OLD | NEW |