OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 2063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2074 | 2074 |
2075 #if BUILDFLAG(ENABLE_EXTENSIONS) | 2075 #if BUILDFLAG(ENABLE_EXTENSIONS) |
2076 /////////////////////////////////////////////////////////////////////////////// | 2076 /////////////////////////////////////////////////////////////////////////////// |
2077 // Browser, extensions::ExtensionRegistryObserver implementation: | 2077 // Browser, extensions::ExtensionRegistryObserver implementation: |
2078 | 2078 |
2079 void Browser::OnExtensionLoaded(content::BrowserContext* browser_context, | 2079 void Browser::OnExtensionLoaded(content::BrowserContext* browser_context, |
2080 const extensions::Extension* extension) { | 2080 const extensions::Extension* extension) { |
2081 command_controller_->ExtensionStateChanged(); | 2081 command_controller_->ExtensionStateChanged(); |
2082 } | 2082 } |
2083 | 2083 |
2084 void Browser::OnExtensionUnloaded( | 2084 void Browser::OnExtensionUnloaded(content::BrowserContext* browser_context, |
2085 content::BrowserContext* browser_context, | 2085 const extensions::Extension* extension, |
2086 const extensions::Extension* extension, | 2086 extensions::UnloadedExtensionReason reason) { |
2087 extensions::UnloadedExtensionInfo::Reason reason) { | |
2088 command_controller_->ExtensionStateChanged(); | 2087 command_controller_->ExtensionStateChanged(); |
2089 | 2088 |
2090 // Close any tabs from the unloaded extension, unless it's terminated, | 2089 // Close any tabs from the unloaded extension, unless it's terminated, |
2091 // in which case let the sad tabs remain. | 2090 // in which case let the sad tabs remain. |
2092 // Also, if tab is muted and the cause is the unloaded extension, unmute it. | 2091 // Also, if tab is muted and the cause is the unloaded extension, unmute it. |
2093 if (reason != extensions::UnloadedExtensionInfo::REASON_TERMINATE) { | 2092 if (reason != extensions::UnloadedExtensionReason::TERMINATE) { |
2094 // Iterate backwards as we may remove items while iterating. | 2093 // Iterate backwards as we may remove items while iterating. |
2095 for (int i = tab_strip_model_->count() - 1; i >= 0; --i) { | 2094 for (int i = tab_strip_model_->count() - 1; i >= 0; --i) { |
2096 WebContents* web_contents = tab_strip_model_->GetWebContentsAt(i); | 2095 WebContents* web_contents = tab_strip_model_->GetWebContentsAt(i); |
2097 // Two cases are handled here: | 2096 // Two cases are handled here: |
2098 | 2097 |
2099 // - The scheme check is for when an extension page is loaded in a | 2098 // - The scheme check is for when an extension page is loaded in a |
2100 // tab, e.g. chrome-extension://id/page.html. | 2099 // tab, e.g. chrome-extension://id/page.html. |
2101 // - The extension_app check is for apps, which can have non-extension | 2100 // - The extension_app check is for apps, which can have non-extension |
2102 // schemes, e.g. https://mail.google.com if you have the Gmail app | 2101 // schemes, e.g. https://mail.google.com if you have the Gmail app |
2103 // installed. | 2102 // installed. |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2629 // new window later, thus we need to navigate the window now. | 2628 // new window later, thus we need to navigate the window now. |
2630 if (contents) { | 2629 if (contents) { |
2631 contents->web_contents()->GetController().LoadURL( | 2630 contents->web_contents()->GetController().LoadURL( |
2632 target_url, content::Referrer(), ui::PAGE_TRANSITION_LINK, | 2631 target_url, content::Referrer(), ui::PAGE_TRANSITION_LINK, |
2633 std::string()); // No extra headers. | 2632 std::string()); // No extra headers. |
2634 } | 2633 } |
2635 } | 2634 } |
2636 | 2635 |
2637 return contents != NULL; | 2636 return contents != NULL; |
2638 } | 2637 } |
OLD | NEW |