| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "extensions/browser/process_manager.h" | 5 #include "extensions/browser/process_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 } | 331 } |
| 332 | 332 |
| 333 ExtensionHost* ProcessManager::GetBackgroundHostForExtension( | 333 ExtensionHost* ProcessManager::GetBackgroundHostForExtension( |
| 334 const std::string& extension_id) { | 334 const std::string& extension_id) { |
| 335 for (ExtensionHostSet::iterator iter = background_hosts_.begin(); | 335 for (ExtensionHostSet::iterator iter = background_hosts_.begin(); |
| 336 iter != background_hosts_.end(); ++iter) { | 336 iter != background_hosts_.end(); ++iter) { |
| 337 ExtensionHost* host = *iter; | 337 ExtensionHost* host = *iter; |
| 338 if (host->extension_id() == extension_id) | 338 if (host->extension_id() == extension_id) |
| 339 return host; | 339 return host; |
| 340 } | 340 } |
| 341 return NULL; | 341 return nullptr; |
| 342 } | 342 } |
| 343 | 343 |
| 344 std::set<RenderViewHost*> ProcessManager::GetRenderViewHostsForExtension( | 344 std::set<RenderViewHost*> ProcessManager::GetRenderViewHostsForExtension( |
| 345 const std::string& extension_id) { | 345 const std::string& extension_id) { |
| 346 std::set<RenderViewHost*> result; | 346 std::set<RenderViewHost*> result; |
| 347 | 347 |
| 348 SiteInstance* site_instance = GetSiteInstanceForURL( | 348 SiteInstance* site_instance = GetSiteInstanceForURL( |
| 349 Extension::GetBaseURLFromExtensionId(extension_id)); | 349 Extension::GetBaseURLFromExtensionId(extension_id)); |
| 350 if (!site_instance) | 350 if (!site_instance) |
| 351 return result; | 351 return result; |
| 352 | 352 |
| 353 // Gather up all the views for that site. | 353 // Gather up all the views for that site. |
| 354 for (ExtensionRenderViews::iterator view = all_extension_views_.begin(); | 354 for (ExtensionRenderViews::iterator view = all_extension_views_.begin(); |
| 355 view != all_extension_views_.end(); ++view) { | 355 view != all_extension_views_.end(); ++view) { |
| 356 if (view->first->GetSiteInstance() == site_instance) | 356 if (view->first->GetSiteInstance() == site_instance) |
| 357 result.insert(view->first); | 357 result.insert(view->first); |
| 358 } | 358 } |
| 359 | 359 |
| 360 return result; | 360 return result; |
| 361 } | 361 } |
| 362 | 362 |
| 363 const Extension* ProcessManager::GetExtensionForRenderViewHost( | 363 const Extension* ProcessManager::GetExtensionForRenderViewHost( |
| 364 RenderViewHost* render_view_host) { | 364 RenderViewHost* render_view_host) { |
| 365 if (!render_view_host->GetSiteInstance()) | 365 if (!render_view_host->GetSiteInstance()) |
| 366 return NULL; | 366 return nullptr; |
| 367 | 367 |
| 368 return extension_registry_->enabled_extensions().GetByID( | 368 return extension_registry_->enabled_extensions().GetByID( |
| 369 GetExtensionID(render_view_host)); | 369 GetExtensionID(render_view_host)); |
| 370 } | 370 } |
| 371 | 371 |
| 372 void ProcessManager::UnregisterRenderViewHost( | 372 void ProcessManager::UnregisterRenderViewHost( |
| 373 RenderViewHost* render_view_host) { | 373 RenderViewHost* render_view_host) { |
| 374 ExtensionRenderViews::iterator view = | 374 ExtensionRenderViews::iterator view = |
| 375 all_extension_views_.find(render_view_host); | 375 all_extension_views_.find(render_view_host); |
| 376 if (view == all_extension_views_.end()) | 376 if (view == all_extension_views_.end()) |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 SiteInstance* IncognitoProcessManager::GetSiteInstanceForURL(const GURL& url) { | 951 SiteInstance* IncognitoProcessManager::GetSiteInstanceForURL(const GURL& url) { |
| 952 const Extension* extension = | 952 const Extension* extension = |
| 953 extension_registry_->enabled_extensions().GetExtensionOrAppByURL(url); | 953 extension_registry_->enabled_extensions().GetExtensionOrAppByURL(url); |
| 954 if (extension && !IncognitoInfo::IsSplitMode(extension)) | 954 if (extension && !IncognitoInfo::IsSplitMode(extension)) |
| 955 return original_manager_->GetSiteInstanceForURL(url); | 955 return original_manager_->GetSiteInstanceForURL(url); |
| 956 | 956 |
| 957 return ProcessManager::GetSiteInstanceForURL(url); | 957 return ProcessManager::GetSiteInstanceForURL(url); |
| 958 } | 958 } |
| 959 | 959 |
| 960 } // namespace extensions | 960 } // namespace extensions |
| OLD | NEW |