| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #include <shellapi.h> | 9 #include <shellapi.h> |
| 10 #endif // OS_WIN | 10 #endif // OS_WIN |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 using base::TimeDelta; | 217 using base::TimeDelta; |
| 218 using content::NavigationController; | 218 using content::NavigationController; |
| 219 using content::NavigationEntry; | 219 using content::NavigationEntry; |
| 220 using content::OpenURLParams; | 220 using content::OpenURLParams; |
| 221 using content::PluginService; | 221 using content::PluginService; |
| 222 using content::Referrer; | 222 using content::Referrer; |
| 223 using content::SiteInstance; | 223 using content::SiteInstance; |
| 224 using content::SSLStatus; | 224 using content::SSLStatus; |
| 225 using content::UserMetricsAction; | 225 using content::UserMetricsAction; |
| 226 using content::WebContents; | 226 using content::WebContents; |
| 227 using extensions::Extension; |
| 227 | 228 |
| 228 /////////////////////////////////////////////////////////////////////////////// | 229 /////////////////////////////////////////////////////////////////////////////// |
| 229 | 230 |
| 230 namespace { | 231 namespace { |
| 231 | 232 |
| 232 // The URL to be loaded to display the "Report a broken page" form. | 233 // The URL to be loaded to display the "Report a broken page" form. |
| 233 const char kBrokenPageUrl[] = | 234 const char kBrokenPageUrl[] = |
| 234 "https://www.google.com/support/chrome/bin/request.py?contact_type=" | 235 "https://www.google.com/support/chrome/bin/request.py?contact_type=" |
| 235 "broken_website&format=inproduct&p.page_title=$1&p.page_url=$2"; | 236 "broken_website&format=inproduct&p.page_title=$1&p.page_url=$2"; |
| 236 | 237 |
| (...skipping 3918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4155 content::Source<NavigationController>(source).ptr()) | 4156 content::Source<NavigationController>(source).ptr()) |
| 4156 UpdateToolbar(false); | 4157 UpdateToolbar(false); |
| 4157 break; | 4158 break; |
| 4158 | 4159 |
| 4159 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { | 4160 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { |
| 4160 if (window()->GetLocationBar()) | 4161 if (window()->GetLocationBar()) |
| 4161 window()->GetLocationBar()->UpdatePageActions(); | 4162 window()->GetLocationBar()->UpdatePageActions(); |
| 4162 | 4163 |
| 4163 // Close any tabs from the unloaded extension, unless it's terminated, | 4164 // Close any tabs from the unloaded extension, unless it's terminated, |
| 4164 // in which case let the sad tabs remain. | 4165 // in which case let the sad tabs remain. |
| 4165 if (content::Details<UnloadedExtensionInfo>(details)->reason != | 4166 if (content::Details<extensions::UnloadedExtensionInfo>( |
| 4166 extension_misc::UNLOAD_REASON_TERMINATE) { | 4167 details)->reason != extension_misc::UNLOAD_REASON_TERMINATE) { |
| 4167 const Extension* extension = | 4168 const Extension* extension = |
| 4168 content::Details<UnloadedExtensionInfo>(details)->extension; | 4169 content::Details<extensions::UnloadedExtensionInfo>( |
| 4170 details)->extension; |
| 4169 for (int i = tab_strip_model_->count() - 1; i >= 0; --i) { | 4171 for (int i = tab_strip_model_->count() - 1; i >= 0; --i) { |
| 4170 WebContents* tc = | 4172 WebContents* tc = |
| 4171 tab_strip_model_->GetTabContentsAt(i)->web_contents(); | 4173 tab_strip_model_->GetTabContentsAt(i)->web_contents(); |
| 4172 bool close_tab_contents = | 4174 bool close_tab_contents = |
| 4173 tc->GetURL().SchemeIs(chrome::kExtensionScheme) && | 4175 tc->GetURL().SchemeIs(chrome::kExtensionScheme) && |
| 4174 tc->GetURL().host() == extension->id(); | 4176 tc->GetURL().host() == extension->id(); |
| 4175 // We want to close all panels originated by the unloaded extension. | 4177 // We want to close all panels originated by the unloaded extension. |
| 4176 close_tab_contents = close_tab_contents || | 4178 close_tab_contents = close_tab_contents || |
| 4177 (type_ == TYPE_PANEL && | 4179 (type_ == TYPE_PANEL && |
| 4178 (web_app::GetExtensionIdFromApplicationName(app_name_) == | 4180 (web_app::GetExtensionIdFromApplicationName(app_name_) == |
| (...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5476 if (contents && !allow_js_access) { | 5478 if (contents && !allow_js_access) { |
| 5477 contents->web_contents()->GetController().LoadURL( | 5479 contents->web_contents()->GetController().LoadURL( |
| 5478 target_url, | 5480 target_url, |
| 5479 content::Referrer(), | 5481 content::Referrer(), |
| 5480 content::PAGE_TRANSITION_LINK, | 5482 content::PAGE_TRANSITION_LINK, |
| 5481 std::string()); // No extra headers. | 5483 std::string()); // No extra headers. |
| 5482 } | 5484 } |
| 5483 | 5485 |
| 5484 return contents != NULL; | 5486 return contents != NULL; |
| 5485 } | 5487 } |
| OLD | NEW |