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" | 23 #include "chrome/common/extensions/extension_constants.h" |
Fady Samuel
2014/08/29 19:39:46
Is this still necessary?
Xi Han
2014/08/29 19:52:54
Removed.
| |
24 #include "chrome/common/extensions/extension_process_policy.h" | 24 #include "chrome/common/extensions/extension_process_policy.h" |
25 #include "chrome/common/extensions/manifest_handlers/app_isolation_info.h" | 25 #include "chrome/common/extensions/manifest_handlers/app_isolation_info.h" |
26 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
27 #include "content/public/browser/browser_url_handler.h" | 27 #include "content/public/browser/browser_url_handler.h" |
28 #include "content/public/browser/render_process_host.h" | 28 #include "content/public/browser/render_process_host.h" |
29 #include "content/public/browser/render_view_host.h" | 29 #include "content/public/browser/render_view_host.h" |
30 #include "content/public/browser/site_instance.h" | 30 #include "content/public/browser/site_instance.h" |
31 #include "content/public/browser/web_contents.h" | 31 #include "content/public/browser/web_contents.h" |
32 #include "content/public/common/content_switches.h" | 32 #include "content/public/common/content_switches.h" |
33 #include "extensions/browser/extension_host.h" | 33 #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()); | 190 Profile::FromBrowserContext(process_host->GetBrowserContext()); |
191 ExtensionService* service = | 191 ExtensionService* service = |
192 ExtensionSystem::Get(profile)->extension_service(); | 192 ExtensionSystem::Get(profile)->extension_service(); |
193 if (!service) | 193 if (!service) |
194 return true; | 194 return true; |
195 | 195 |
196 const Extension* new_extension = | 196 const Extension* new_extension = |
197 service->extensions()->GetExtensionOrAppByURL(url); | 197 service->extensions()->GetExtensionOrAppByURL(url); |
198 if (new_extension && | 198 if (new_extension && |
199 new_extension->is_hosted_app() && | 199 new_extension->is_hosted_app() && |
200 new_extension->id() == extension_misc::kWebStoreAppId && | 200 new_extension->id() == extensions::kWebStoreAppId && |
201 !ProcessMap::Get(profile)->Contains( | 201 !ProcessMap::Get(profile)->Contains( |
202 new_extension->id(), process_host->GetID())) { | 202 new_extension->id(), process_host->GetID())) { |
203 return false; | 203 return false; |
204 } | 204 } |
205 return true; | 205 return true; |
206 } | 206 } |
207 | 207 |
208 // static | 208 // static |
209 bool ChromeContentBrowserClientExtensionsPart::IsSuitableHost( | 209 bool ChromeContentBrowserClientExtensionsPart::IsSuitableHost( |
210 Profile* profile, | 210 Profile* profile, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
292 // | 292 // |
293 // We ignore hosted apps here so that other tabs in their BrowsingInstance can | 293 // 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 | 294 // use postMessage with them. (The exception is the Chrome Web Store, which |
295 // is a hosted app that requires its own BrowsingInstance.) Navigations | 295 // is a hosted app that requires its own BrowsingInstance.) Navigations |
296 // to/from a hosted app will still trigger a SiteInstance swap in | 296 // to/from a hosted app will still trigger a SiteInstance swap in |
297 // RenderFrameHostManager. | 297 // RenderFrameHostManager. |
298 const Extension* current_extension = | 298 const Extension* current_extension = |
299 service->extensions()->GetExtensionOrAppByURL(current_url); | 299 service->extensions()->GetExtensionOrAppByURL(current_url); |
300 if (current_extension && | 300 if (current_extension && |
301 current_extension->is_hosted_app() && | 301 current_extension->is_hosted_app() && |
302 current_extension->id() != extension_misc::kWebStoreAppId) | 302 current_extension->id() != extensions::kWebStoreAppId) |
303 current_extension = NULL; | 303 current_extension = NULL; |
304 | 304 |
305 const Extension* new_extension = | 305 const Extension* new_extension = |
306 service->extensions()->GetExtensionOrAppByURL(new_url); | 306 service->extensions()->GetExtensionOrAppByURL(new_url); |
307 if (new_extension && | 307 if (new_extension && |
308 new_extension->is_hosted_app() && | 308 new_extension->is_hosted_app() && |
309 new_extension->id() != extension_misc::kWebStoreAppId) | 309 new_extension->id() != extensions::kWebStoreAppId) |
310 new_extension = NULL; | 310 new_extension = NULL; |
311 | 311 |
312 // First do a process check. We should force a BrowsingInstance swap if the | 312 // 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 | 313 // current process doesn't know about new_extension, even if current_extension |
314 // is somehow the same as new_extension. | 314 // is somehow the same as new_extension. |
315 ProcessMap* process_map = ProcessMap::Get(profile); | 315 ProcessMap* process_map = ProcessMap::Get(profile); |
316 if (new_extension && | 316 if (new_extension && |
317 site_instance->HasProcess() && | 317 site_instance->HasProcess() && |
318 !process_map->Contains( | 318 !process_map->Contains( |
319 new_extension->id(), site_instance->GetProcess()->GetID())) | 319 new_extension->id(), site_instance->GetProcess()->GetID())) |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
529 DCHECK(profile); | 529 DCHECK(profile); |
530 if (ProcessMap::Get(profile)->Contains(process->GetID())) { | 530 if (ProcessMap::Get(profile)->Contains(process->GetID())) { |
531 command_line->AppendSwitch(switches::kExtensionProcess); | 531 command_line->AppendSwitch(switches::kExtensionProcess); |
532 #if defined(ENABLE_WEBRTC) | 532 #if defined(ENABLE_WEBRTC) |
533 command_line->AppendSwitch(::switches::kEnableWebRtcHWH264Encoding); | 533 command_line->AppendSwitch(::switches::kEnableWebRtcHWH264Encoding); |
534 #endif | 534 #endif |
535 } | 535 } |
536 } | 536 } |
537 | 537 |
538 } // namespace extensions | 538 } // namespace extensions |
OLD | NEW |