Chromium Code Reviews| 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/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 798 // Close remaining views. | 798 // Close remaining views. |
| 799 std::vector<content::RenderFrameHost*> frames_to_close; | 799 std::vector<content::RenderFrameHost*> frames_to_close; |
| 800 for (const auto& key_value : all_extension_frames_) { | 800 for (const auto& key_value : all_extension_frames_) { |
| 801 if (key_value.second.CanKeepalive() && | 801 if (key_value.second.CanKeepalive() && |
| 802 GetExtensionID(key_value.first) == extension_id) { | 802 GetExtensionID(key_value.first) == extension_id) { |
| 803 DCHECK(!key_value.second.has_keepalive); | 803 DCHECK(!key_value.second.has_keepalive); |
| 804 frames_to_close.push_back(key_value.first); | 804 frames_to_close.push_back(key_value.first); |
| 805 } | 805 } |
| 806 } | 806 } |
| 807 for (content::RenderFrameHost* frame : frames_to_close) { | 807 for (content::RenderFrameHost* frame : frames_to_close) { |
| 808 frame->GetRenderViewHost()->ClosePage(); | 808 content::WebContents::FromRenderFrameHost(frame)->ClosePage(); |
| 809 // RenderViewHost::ClosePage() may result in calling | 809 // RenderViewHost::ClosePage() may result in calling |
|
Charlie Reis
2015/04/21 17:28:09
nit: Update comment.
nasko
2015/04/29 17:09:27
Done.
| |
| 810 // UnregisterRenderViewHost() asynchronously and may cause race conditions | 810 // UnregisterRenderViewHost() asynchronously and may cause race conditions |
| 811 // when the background page is reloaded. | 811 // when the background page is reloaded. |
| 812 // To avoid this, unregister the view now. | 812 // To avoid this, unregister the view now. |
| 813 UnregisterRenderFrameHost(frame); | 813 UnregisterRenderFrameHost(frame); |
| 814 } | 814 } |
| 815 | 815 |
| 816 ExtensionHost* host = GetBackgroundHostForExtension(extension_id); | 816 ExtensionHost* host = GetBackgroundHostForExtension(extension_id); |
| 817 if (host) | 817 if (host) |
| 818 CloseBackgroundHost(host); | 818 CloseBackgroundHost(host); |
| 819 } | 819 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 915 if (extension && !IncognitoInfo::IsSplitMode(extension)) { | 915 if (extension && !IncognitoInfo::IsSplitMode(extension)) { |
| 916 BrowserContext* original_context = | 916 BrowserContext* original_context = |
| 917 ExtensionsBrowserClient::Get()->GetOriginalContext(browser_context()); | 917 ExtensionsBrowserClient::Get()->GetOriginalContext(browser_context()); |
| 918 return ProcessManager::Get(original_context)->GetSiteInstanceForURL(url); | 918 return ProcessManager::Get(original_context)->GetSiteInstanceForURL(url); |
| 919 } | 919 } |
| 920 | 920 |
| 921 return ProcessManager::GetSiteInstanceForURL(url); | 921 return ProcessManager::GetSiteInstanceForURL(url); |
| 922 } | 922 } |
| 923 | 923 |
| 924 } // namespace extensions | 924 } // namespace extensions |
| OLD | NEW |