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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 using content::NativeWebKeyboardEvent; | 219 using content::NativeWebKeyboardEvent; |
220 using content::NavigationController; | 220 using content::NavigationController; |
221 using content::NavigationEntry; | 221 using content::NavigationEntry; |
222 using content::OpenURLParams; | 222 using content::OpenURLParams; |
223 using content::PluginService; | 223 using content::PluginService; |
224 using content::Referrer; | 224 using content::Referrer; |
225 using content::SiteInstance; | 225 using content::SiteInstance; |
226 using content::SSLStatus; | 226 using content::SSLStatus; |
227 using content::UserMetricsAction; | 227 using content::UserMetricsAction; |
228 using content::WebContents; | 228 using content::WebContents; |
| 229 using extensions::Extension; |
229 | 230 |
230 /////////////////////////////////////////////////////////////////////////////// | 231 /////////////////////////////////////////////////////////////////////////////// |
231 | 232 |
232 namespace { | 233 namespace { |
233 | 234 |
234 // The URL to be loaded to display the "Report a broken page" form. | 235 // The URL to be loaded to display the "Report a broken page" form. |
235 const char kBrokenPageUrl[] = | 236 const char kBrokenPageUrl[] = |
236 "https://www.google.com/support/chrome/bin/request.py?contact_type=" | 237 "https://www.google.com/support/chrome/bin/request.py?contact_type=" |
237 "broken_website&format=inproduct&p.page_title=$1&p.page_url=$2"; | 238 "broken_website&format=inproduct&p.page_title=$1&p.page_url=$2"; |
238 | 239 |
(...skipping 3866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4105 content::Source<NavigationController>(source).ptr()) | 4106 content::Source<NavigationController>(source).ptr()) |
4106 UpdateToolbar(false); | 4107 UpdateToolbar(false); |
4107 break; | 4108 break; |
4108 | 4109 |
4109 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { | 4110 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { |
4110 if (window()->GetLocationBar()) | 4111 if (window()->GetLocationBar()) |
4111 window()->GetLocationBar()->UpdatePageActions(); | 4112 window()->GetLocationBar()->UpdatePageActions(); |
4112 | 4113 |
4113 // Close any tabs from the unloaded extension, unless it's terminated, | 4114 // Close any tabs from the unloaded extension, unless it's terminated, |
4114 // in which case let the sad tabs remain. | 4115 // in which case let the sad tabs remain. |
4115 if (content::Details<UnloadedExtensionInfo>(details)->reason != | 4116 if (content::Details<extensions::UnloadedExtensionInfo>( |
4116 extension_misc::UNLOAD_REASON_TERMINATE) { | 4117 details)->reason != extension_misc::UNLOAD_REASON_TERMINATE) { |
4117 const Extension* extension = | 4118 const Extension* extension = |
4118 content::Details<UnloadedExtensionInfo>(details)->extension; | 4119 content::Details<extensions::UnloadedExtensionInfo>( |
| 4120 details)->extension; |
4119 for (int i = tab_strip_model_->count() - 1; i >= 0; --i) { | 4121 for (int i = tab_strip_model_->count() - 1; i >= 0; --i) { |
4120 WebContents* tc = | 4122 WebContents* tc = |
4121 tab_strip_model_->GetTabContentsAt(i)->web_contents(); | 4123 tab_strip_model_->GetTabContentsAt(i)->web_contents(); |
4122 bool close_tab_contents = | 4124 bool close_tab_contents = |
4123 tc->GetURL().SchemeIs(chrome::kExtensionScheme) && | 4125 tc->GetURL().SchemeIs(chrome::kExtensionScheme) && |
4124 tc->GetURL().host() == extension->id(); | 4126 tc->GetURL().host() == extension->id(); |
4125 // We want to close all panels originated by the unloaded extension. | 4127 // We want to close all panels originated by the unloaded extension. |
4126 close_tab_contents = close_tab_contents || | 4128 close_tab_contents = close_tab_contents || |
4127 (type_ == TYPE_PANEL && | 4129 (type_ == TYPE_PANEL && |
4128 (web_app::GetExtensionIdFromApplicationName(app_name_) == | 4130 (web_app::GetExtensionIdFromApplicationName(app_name_) == |
(...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5423 if (contents && !allow_js_access) { | 5425 if (contents && !allow_js_access) { |
5424 contents->web_contents()->GetController().LoadURL( | 5426 contents->web_contents()->GetController().LoadURL( |
5425 target_url, | 5427 target_url, |
5426 content::Referrer(), | 5428 content::Referrer(), |
5427 content::PAGE_TRANSITION_LINK, | 5429 content::PAGE_TRANSITION_LINK, |
5428 std::string()); // No extra headers. | 5430 std::string()); // No extra headers. |
5429 } | 5431 } |
5430 | 5432 |
5431 return contents != NULL; | 5433 return contents != NULL; |
5432 } | 5434 } |
OLD | NEW |