| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 200 |
| 201 #if !defined(OS_CHROMEOS) || defined(USE_AURA) | 201 #if !defined(OS_CHROMEOS) || defined(USE_AURA) |
| 202 #include "chrome/browser/download/download_shelf.h" | 202 #include "chrome/browser/download/download_shelf.h" |
| 203 #endif | 203 #endif |
| 204 | 204 |
| 205 #if defined(FILE_MANAGER_EXTENSION) | 205 #if defined(FILE_MANAGER_EXTENSION) |
| 206 #include "chrome/browser/extensions/file_manager_util.h" | 206 #include "chrome/browser/extensions/file_manager_util.h" |
| 207 #endif | 207 #endif |
| 208 | 208 |
| 209 using base::TimeDelta; | 209 using base::TimeDelta; |
| 210 using content::NavigationEntry; |
| 210 using content::OpenURLParams; | 211 using content::OpenURLParams; |
| 211 using content::PluginService; | 212 using content::PluginService; |
| 212 using content::Referrer; | 213 using content::Referrer; |
| 213 using content::SSLStatus; | 214 using content::SSLStatus; |
| 214 using content::UserMetricsAction; | 215 using content::UserMetricsAction; |
| 215 using content::WebContents; | 216 using content::WebContents; |
| 216 | 217 |
| 217 /////////////////////////////////////////////////////////////////////////////// | 218 /////////////////////////////////////////////////////////////////////////////// |
| 218 | 219 |
| 219 namespace { | 220 namespace { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 245 | 246 |
| 246 // The URL for the privacy dashboard. | 247 // The URL for the privacy dashboard. |
| 247 const char kPrivacyDashboardUrl[] = "https://www.google.com/dashboard"; | 248 const char kPrivacyDashboardUrl[] = "https://www.google.com/dashboard"; |
| 248 | 249 |
| 249 // How long we wait before updating the browser chrome while loading a page. | 250 // How long we wait before updating the browser chrome while loading a page. |
| 250 const int kUIUpdateCoalescingTimeMS = 200; | 251 const int kUIUpdateCoalescingTimeMS = 200; |
| 251 | 252 |
| 252 const char kHashMark[] = "#"; | 253 const char kHashMark[] = "#"; |
| 253 | 254 |
| 254 // Returns |true| if entry has an internal chrome:// URL, |false| otherwise. | 255 // Returns |true| if entry has an internal chrome:// URL, |false| otherwise. |
| 255 bool HasInternalURL(const content::NavigationEntry* entry) { | 256 bool HasInternalURL(const NavigationEntry* entry) { |
| 256 if (!entry) | 257 if (!entry) |
| 257 return false; | 258 return false; |
| 258 | 259 |
| 259 // Check the |virtual_url()| first. This catches regular chrome:// URLs | 260 // Check the |virtual_url()| first. This catches regular chrome:// URLs |
| 260 // including URLs that were rewritten (such as chrome://bookmarks). | 261 // including URLs that were rewritten (such as chrome://bookmarks). |
| 261 if (entry->GetVirtualURL().SchemeIs(chrome::kChromeUIScheme)) | 262 if (entry->GetVirtualURL().SchemeIs(chrome::kChromeUIScheme)) |
| 262 return true; | 263 return true; |
| 263 | 264 |
| 264 // If the |virtual_url()| isn't a chrome:// URL, check if it's actually | 265 // If the |virtual_url()| isn't a chrome:// URL, check if it's actually |
| 265 // view-source: of a chrome:// URL. | 266 // view-source: of a chrome:// URL. |
| (...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1299 SessionStorageNamespace* session_storage_namespace) { | 1300 SessionStorageNamespace* session_storage_namespace) { |
| 1300 GURL restore_url = navigations.at(selected_navigation).virtual_url(); | 1301 GURL restore_url = navigations.at(selected_navigation).virtual_url(); |
| 1301 TabContentsWrapper* wrapper = TabContentsFactory( | 1302 TabContentsWrapper* wrapper = TabContentsFactory( |
| 1302 profile(), | 1303 profile(), |
| 1303 tab_util::GetSiteInstanceForNewTab(NULL, profile_, restore_url), | 1304 tab_util::GetSiteInstanceForNewTab(NULL, profile_, restore_url), |
| 1304 MSG_ROUTING_NONE, | 1305 MSG_ROUTING_NONE, |
| 1305 GetSelectedTabContents(), | 1306 GetSelectedTabContents(), |
| 1306 session_storage_namespace); | 1307 session_storage_namespace); |
| 1307 TabContents* new_tab = wrapper->tab_contents(); | 1308 TabContents* new_tab = wrapper->tab_contents(); |
| 1308 wrapper->extension_tab_helper()->SetExtensionAppById(extension_app_id); | 1309 wrapper->extension_tab_helper()->SetExtensionAppById(extension_app_id); |
| 1309 std::vector<content::NavigationEntry*> entries; | 1310 std::vector<NavigationEntry*> entries; |
| 1310 TabNavigation::CreateNavigationEntriesFromTabNavigations( | 1311 TabNavigation::CreateNavigationEntriesFromTabNavigations( |
| 1311 profile_, navigations, &entries); | 1312 profile_, navigations, &entries); |
| 1312 new_tab->GetController().Restore( | 1313 new_tab->GetController().Restore( |
| 1313 selected_navigation, from_last_session, &entries); | 1314 selected_navigation, from_last_session, &entries); |
| 1314 DCHECK_EQ(0u, entries.size()); | 1315 DCHECK_EQ(0u, entries.size()); |
| 1315 | 1316 |
| 1316 int add_types = select ? TabStripModel::ADD_ACTIVE : | 1317 int add_types = select ? TabStripModel::ADD_ACTIVE : |
| 1317 TabStripModel::ADD_NONE; | 1318 TabStripModel::ADD_NONE; |
| 1318 if (pin) { | 1319 if (pin) { |
| 1319 tab_index = std::min(tab_index, tabstrip_model()->IndexOfFirstNonMiniTab()); | 1320 tab_index = std::min(tab_index, tabstrip_model()->IndexOfFirstNonMiniTab()); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1349 SessionStorageNamespace* session_storage_namespace) { | 1350 SessionStorageNamespace* session_storage_namespace) { |
| 1350 GURL restore_url = navigations.at(selected_navigation).virtual_url(); | 1351 GURL restore_url = navigations.at(selected_navigation).virtual_url(); |
| 1351 TabContentsWrapper* wrapper = TabContentsFactory( | 1352 TabContentsWrapper* wrapper = TabContentsFactory( |
| 1352 profile(), | 1353 profile(), |
| 1353 tab_util::GetSiteInstanceForNewTab(NULL, profile_, restore_url), | 1354 tab_util::GetSiteInstanceForNewTab(NULL, profile_, restore_url), |
| 1354 MSG_ROUTING_NONE, | 1355 MSG_ROUTING_NONE, |
| 1355 GetSelectedTabContents(), | 1356 GetSelectedTabContents(), |
| 1356 session_storage_namespace); | 1357 session_storage_namespace); |
| 1357 wrapper->extension_tab_helper()->SetExtensionAppById(extension_app_id); | 1358 wrapper->extension_tab_helper()->SetExtensionAppById(extension_app_id); |
| 1358 TabContents* replacement = wrapper->tab_contents(); | 1359 TabContents* replacement = wrapper->tab_contents(); |
| 1359 std::vector<content::NavigationEntry*> entries; | 1360 std::vector<NavigationEntry*> entries; |
| 1360 TabNavigation::CreateNavigationEntriesFromTabNavigations( | 1361 TabNavigation::CreateNavigationEntriesFromTabNavigations( |
| 1361 profile_, navigations, &entries); | 1362 profile_, navigations, &entries); |
| 1362 replacement->GetController().Restore( | 1363 replacement->GetController().Restore( |
| 1363 selected_navigation, from_last_session, &entries); | 1364 selected_navigation, from_last_session, &entries); |
| 1364 DCHECK_EQ(0u, entries.size()); | 1365 DCHECK_EQ(0u, entries.size()); |
| 1365 | 1366 |
| 1366 tab_handler_->GetTabStripModel()->ReplaceNavigationControllerAt( | 1367 tab_handler_->GetTabStripModel()->ReplaceNavigationControllerAt( |
| 1367 tab_handler_->GetTabStripModel()->active_index(), | 1368 tab_handler_->GetTabStripModel()->active_index(), |
| 1368 wrapper); | 1369 wrapper); |
| 1369 } | 1370 } |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1541 void Browser::ReloadIgnoringCache(WindowOpenDisposition disposition) { | 1542 void Browser::ReloadIgnoringCache(WindowOpenDisposition disposition) { |
| 1542 content::RecordAction(UserMetricsAction("ReloadIgnoringCache")); | 1543 content::RecordAction(UserMetricsAction("ReloadIgnoringCache")); |
| 1543 ReloadInternal(disposition, true); | 1544 ReloadInternal(disposition, true); |
| 1544 } | 1545 } |
| 1545 | 1546 |
| 1546 void Browser::ReloadInternal(WindowOpenDisposition disposition, | 1547 void Browser::ReloadInternal(WindowOpenDisposition disposition, |
| 1547 bool ignore_cache) { | 1548 bool ignore_cache) { |
| 1548 // If we are showing an interstitial, treat this as an OpenURL. | 1549 // If we are showing an interstitial, treat this as an OpenURL. |
| 1549 TabContents* current_tab = GetSelectedTabContents(); | 1550 TabContents* current_tab = GetSelectedTabContents(); |
| 1550 if (current_tab && current_tab->ShowingInterstitialPage()) { | 1551 if (current_tab && current_tab->ShowingInterstitialPage()) { |
| 1551 content::NavigationEntry* entry = | 1552 NavigationEntry* entry = current_tab->GetController().GetActiveEntry(); |
| 1552 current_tab->GetController().GetActiveEntry(); | |
| 1553 DCHECK(entry); // Should exist if interstitial is showing. | 1553 DCHECK(entry); // Should exist if interstitial is showing. |
| 1554 OpenURL(OpenURLParams( | 1554 OpenURL(OpenURLParams( |
| 1555 entry->GetURL(), Referrer(), disposition, | 1555 entry->GetURL(), Referrer(), disposition, |
| 1556 content::PAGE_TRANSITION_RELOAD, false)); | 1556 content::PAGE_TRANSITION_RELOAD, false)); |
| 1557 return; | 1557 return; |
| 1558 } | 1558 } |
| 1559 | 1559 |
| 1560 // As this is caused by a user action, give the focus to the page. | 1560 // As this is caused by a user action, give the focus to the page. |
| 1561 TabContents* tab = GetOrCloneTabForDisposition(disposition); | 1561 TabContents* tab = GetOrCloneTabForDisposition(disposition); |
| 1562 if (!tab->FocusLocationBarByDefault()) | 1562 if (!tab->FocusLocationBarByDefault()) |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2061 } | 2061 } |
| 2062 | 2062 |
| 2063 void Browser::OpenCreateShortcutsDialog() { | 2063 void Browser::OpenCreateShortcutsDialog() { |
| 2064 content::RecordAction(UserMetricsAction("CreateShortcut")); | 2064 content::RecordAction(UserMetricsAction("CreateShortcut")); |
| 2065 #if !defined(OS_MACOSX) | 2065 #if !defined(OS_MACOSX) |
| 2066 TabContentsWrapper* current_tab = GetSelectedTabContentsWrapper(); | 2066 TabContentsWrapper* current_tab = GetSelectedTabContentsWrapper(); |
| 2067 DCHECK(current_tab && | 2067 DCHECK(current_tab && |
| 2068 web_app::IsValidUrl(current_tab->tab_contents()->GetURL())) << | 2068 web_app::IsValidUrl(current_tab->tab_contents()->GetURL())) << |
| 2069 "Menu item should be disabled."; | 2069 "Menu item should be disabled."; |
| 2070 | 2070 |
| 2071 content::NavigationEntry* entry = | 2071 NavigationEntry* entry = |
| 2072 current_tab->tab_contents()->GetController().GetLastCommittedEntry(); | 2072 current_tab->tab_contents()->GetController().GetLastCommittedEntry(); |
| 2073 if (!entry) | 2073 if (!entry) |
| 2074 return; | 2074 return; |
| 2075 | 2075 |
| 2076 // RVH's GetApplicationInfo should not be called before it returns. | 2076 // RVH's GetApplicationInfo should not be called before it returns. |
| 2077 DCHECK(pending_web_app_action_ == NONE); | 2077 DCHECK(pending_web_app_action_ == NONE); |
| 2078 pending_web_app_action_ = CREATE_SHORTCUT; | 2078 pending_web_app_action_ = CREATE_SHORTCUT; |
| 2079 | 2079 |
| 2080 // Start fetching web app info for CreateApplicationShortcut dialog and show | 2080 // Start fetching web app info for CreateApplicationShortcut dialog and show |
| 2081 // the dialog when the data is available in OnDidGetApplicationInfo. | 2081 // the dialog when the data is available in OnDidGetApplicationInfo. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2176 } | 2176 } |
| 2177 | 2177 |
| 2178 void Browser::ShowAboutConflictsTab() { | 2178 void Browser::ShowAboutConflictsTab() { |
| 2179 content::RecordAction(UserMetricsAction("AboutConflicts")); | 2179 content::RecordAction(UserMetricsAction("AboutConflicts")); |
| 2180 ShowSingletonTab(GURL(chrome::kChromeUIConflictsURL)); | 2180 ShowSingletonTab(GURL(chrome::kChromeUIConflictsURL)); |
| 2181 } | 2181 } |
| 2182 | 2182 |
| 2183 void Browser::ShowBrokenPageTab(TabContents* contents) { | 2183 void Browser::ShowBrokenPageTab(TabContents* contents) { |
| 2184 content::RecordAction(UserMetricsAction("ReportBug")); | 2184 content::RecordAction(UserMetricsAction("ReportBug")); |
| 2185 string16 page_title = contents->GetTitle(); | 2185 string16 page_title = contents->GetTitle(); |
| 2186 content::NavigationEntry* entry = contents->GetController().GetActiveEntry(); | 2186 NavigationEntry* entry = contents->GetController().GetActiveEntry(); |
| 2187 if (!entry) | 2187 if (!entry) |
| 2188 return; | 2188 return; |
| 2189 std::string page_url = entry->GetURL().spec(); | 2189 std::string page_url = entry->GetURL().spec(); |
| 2190 std::vector<std::string> subst; | 2190 std::vector<std::string> subst; |
| 2191 subst.push_back(UTF16ToASCII(page_title)); | 2191 subst.push_back(UTF16ToASCII(page_title)); |
| 2192 subst.push_back(page_url); | 2192 subst.push_back(page_url); |
| 2193 std::string report_page_url = | 2193 std::string report_page_url = |
| 2194 ReplaceStringPlaceholders(kBrokenPageUrl, subst, NULL); | 2194 ReplaceStringPlaceholders(kBrokenPageUrl, subst, NULL); |
| 2195 ShowSingletonTab(GURL(report_page_url)); | 2195 ShowSingletonTab(GURL(report_page_url)); |
| 2196 } | 2196 } |
| (...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3538 if (GetStatusBubble()) { | 3538 if (GetStatusBubble()) { |
| 3539 GetStatusBubble()->SetStatus( | 3539 GetStatusBubble()->SetStatus( |
| 3540 GetSelectedTabContentsWrapper()->core_tab_helper()->GetStatusText()); | 3540 GetSelectedTabContentsWrapper()->core_tab_helper()->GetStatusText()); |
| 3541 } | 3541 } |
| 3542 | 3542 |
| 3543 if (!is_loading && pending_web_app_action_ == UPDATE_SHORTCUT) { | 3543 if (!is_loading && pending_web_app_action_ == UPDATE_SHORTCUT) { |
| 3544 // Schedule a shortcut update when web application info is available if | 3544 // Schedule a shortcut update when web application info is available if |
| 3545 // last committed entry is not NULL. Last committed entry could be NULL | 3545 // last committed entry is not NULL. Last committed entry could be NULL |
| 3546 // when an interstitial page is injected (e.g. bad https certificate, | 3546 // when an interstitial page is injected (e.g. bad https certificate, |
| 3547 // malware site etc). When this happens, we abort the shortcut update. | 3547 // malware site etc). When this happens, we abort the shortcut update. |
| 3548 content::NavigationEntry* entry = | 3548 NavigationEntry* entry = source->GetController().GetLastCommittedEntry(); |
| 3549 source->GetController().GetLastCommittedEntry(); | |
| 3550 if (entry) { | 3549 if (entry) { |
| 3551 TabContentsWrapper::GetCurrentWrapperForContents(source)-> | 3550 TabContentsWrapper::GetCurrentWrapperForContents(source)-> |
| 3552 extension_tab_helper()->GetApplicationInfo(entry->GetPageID()); | 3551 extension_tab_helper()->GetApplicationInfo(entry->GetPageID()); |
| 3553 } else { | 3552 } else { |
| 3554 pending_web_app_action_ = NONE; | 3553 pending_web_app_action_ = NONE; |
| 3555 } | 3554 } |
| 3556 } | 3555 } |
| 3557 } | 3556 } |
| 3558 } | 3557 } |
| 3559 | 3558 |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3984 | 3983 |
| 3985 | 3984 |
| 3986 /////////////////////////////////////////////////////////////////////////////// | 3985 /////////////////////////////////////////////////////////////////////////////// |
| 3987 // Browser, CoreTabHelperDelegate implementation: | 3986 // Browser, CoreTabHelperDelegate implementation: |
| 3988 | 3987 |
| 3989 void Browser::OnDidGetApplicationInfo(TabContentsWrapper* source, | 3988 void Browser::OnDidGetApplicationInfo(TabContentsWrapper* source, |
| 3990 int32 page_id) { | 3989 int32 page_id) { |
| 3991 if (GetSelectedTabContentsWrapper() != source) | 3990 if (GetSelectedTabContentsWrapper() != source) |
| 3992 return; | 3991 return; |
| 3993 | 3992 |
| 3994 content::NavigationEntry* entry = | 3993 NavigationEntry* entry = |
| 3995 source->tab_contents()->GetController().GetLastCommittedEntry(); | 3994 source->tab_contents()->GetController().GetLastCommittedEntry(); |
| 3996 if (!entry || (entry->GetPageID() != page_id)) | 3995 if (!entry || (entry->GetPageID() != page_id)) |
| 3997 return; | 3996 return; |
| 3998 | 3997 |
| 3999 switch (pending_web_app_action_) { | 3998 switch (pending_web_app_action_) { |
| 4000 case CREATE_SHORTCUT: { | 3999 case CREATE_SHORTCUT: { |
| 4001 window()->ShowCreateWebAppShortcutsDialog(source); | 4000 window()->ShowCreateWebAppShortcutsDialog(source); |
| 4002 break; | 4001 break; |
| 4003 } | 4002 } |
| 4004 case UPDATE_SHORTCUT: { | 4003 case UPDATE_SHORTCUT: { |
| (...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5204 if (is_type_tabbed() && InstantController::IsEnabled(profile()) && | 5203 if (is_type_tabbed() && InstantController::IsEnabled(profile()) && |
| 5205 !profile()->IsOffTheRecord()) { | 5204 !profile()->IsOffTheRecord()) { |
| 5206 instant_.reset(new InstantController(profile_, this)); | 5205 instant_.reset(new InstantController(profile_, this)); |
| 5207 instant_unload_handler_.reset(new InstantUnloadHandler(this)); | 5206 instant_unload_handler_.reset(new InstantUnloadHandler(this)); |
| 5208 } | 5207 } |
| 5209 } | 5208 } |
| 5210 | 5209 |
| 5211 void Browser::ViewSource(TabContentsWrapper* contents) { | 5210 void Browser::ViewSource(TabContentsWrapper* contents) { |
| 5212 DCHECK(contents); | 5211 DCHECK(contents); |
| 5213 | 5212 |
| 5214 content::NavigationEntry* active_entry = | 5213 NavigationEntry* active_entry = |
| 5215 contents->tab_contents()->GetController().GetActiveEntry(); | 5214 contents->tab_contents()->GetController().GetActiveEntry(); |
| 5216 if (!active_entry) | 5215 if (!active_entry) |
| 5217 return; | 5216 return; |
| 5218 | 5217 |
| 5219 ViewSource(contents, active_entry->GetURL(), active_entry->GetContentState()); | 5218 ViewSource(contents, active_entry->GetURL(), active_entry->GetContentState()); |
| 5220 } | 5219 } |
| 5221 | 5220 |
| 5222 void Browser::ViewSource(TabContentsWrapper* contents, | 5221 void Browser::ViewSource(TabContentsWrapper* contents, |
| 5223 const GURL& url, | 5222 const GURL& url, |
| 5224 const std::string& content_state) { | 5223 const std::string& content_state) { |
| 5225 content::RecordAction(UserMetricsAction("ViewSource")); | 5224 content::RecordAction(UserMetricsAction("ViewSource")); |
| 5226 DCHECK(contents); | 5225 DCHECK(contents); |
| 5227 | 5226 |
| 5228 TabContentsWrapper* view_source_contents = contents->Clone(); | 5227 TabContentsWrapper* view_source_contents = contents->Clone(); |
| 5229 view_source_contents->tab_contents()->GetController().PruneAllButActive(); | 5228 view_source_contents->tab_contents()->GetController().PruneAllButActive(); |
| 5230 content::NavigationEntry* active_entry = | 5229 NavigationEntry* active_entry = |
| 5231 view_source_contents->tab_contents()->GetController().GetActiveEntry(); | 5230 view_source_contents->tab_contents()->GetController().GetActiveEntry(); |
| 5232 if (!active_entry) | 5231 if (!active_entry) |
| 5233 return; | 5232 return; |
| 5234 | 5233 |
| 5235 GURL view_source_url = GURL(chrome::kViewSourceScheme + std::string(":") + | 5234 GURL view_source_url = GURL(chrome::kViewSourceScheme + std::string(":") + |
| 5236 url.spec()); | 5235 url.spec()); |
| 5237 active_entry->SetVirtualURL(view_source_url); | 5236 active_entry->SetVirtualURL(view_source_url); |
| 5238 | 5237 |
| 5239 // Do not restore scroller position. | 5238 // Do not restore scroller position. |
| 5240 active_entry->SetContentState( | 5239 active_entry->SetContentState( |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5275 SessionServiceFactory::GetForProfileIfExisting(profile_); | 5274 SessionServiceFactory::GetForProfileIfExisting(profile_); |
| 5276 if (session_service) | 5275 if (session_service) |
| 5277 session_service->TabRestored(view_source_contents, false); | 5276 session_service->TabRestored(view_source_contents, false); |
| 5278 } | 5277 } |
| 5279 | 5278 |
| 5280 int Browser::GetContentRestrictionsForSelectedTab() { | 5279 int Browser::GetContentRestrictionsForSelectedTab() { |
| 5281 int content_restrictions = 0; | 5280 int content_restrictions = 0; |
| 5282 TabContents* current_tab = GetSelectedTabContents(); | 5281 TabContents* current_tab = GetSelectedTabContents(); |
| 5283 if (current_tab) { | 5282 if (current_tab) { |
| 5284 content_restrictions = current_tab->GetContentRestrictions(); | 5283 content_restrictions = current_tab->GetContentRestrictions(); |
| 5285 content::NavigationEntry* active_entry = | 5284 NavigationEntry* active_entry = |
| 5286 current_tab->GetController().GetActiveEntry(); | 5285 current_tab->GetController().GetActiveEntry(); |
| 5287 // See comment in UpdateCommandsForTabState about why we call url(). | 5286 // See comment in UpdateCommandsForTabState about why we call url(). |
| 5288 if (!SavePackage::IsSavableURL( | 5287 if (!SavePackage::IsSavableURL( |
| 5289 active_entry ? active_entry->GetURL() : GURL()) | 5288 active_entry ? active_entry->GetURL() : GURL()) |
| 5290 || current_tab->ShowingInterstitialPage()) | 5289 || current_tab->ShowingInterstitialPage()) |
| 5291 content_restrictions |= content::CONTENT_RESTRICTION_SAVE; | 5290 content_restrictions |= content::CONTENT_RESTRICTION_SAVE; |
| 5292 if (current_tab->ShowingInterstitialPage()) | 5291 if (current_tab->ShowingInterstitialPage()) |
| 5293 content_restrictions |= content::CONTENT_RESTRICTION_PRINT; | 5292 content_restrictions |= content::CONTENT_RESTRICTION_PRINT; |
| 5294 } | 5293 } |
| 5295 return content_restrictions; | 5294 return content_restrictions; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5380 window_->GetLocationBar()->ShowFirstRunBubble(bubble_type); | 5379 window_->GetLocationBar()->ShowFirstRunBubble(bubble_type); |
| 5381 } else { | 5380 } else { |
| 5382 GlobalErrorService* service = | 5381 GlobalErrorService* service = |
| 5383 GlobalErrorServiceFactory::GetForProfile(profile()); | 5382 GlobalErrorServiceFactory::GetForProfile(profile()); |
| 5384 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); | 5383 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); |
| 5385 if (error) { | 5384 if (error) { |
| 5386 error->ShowBubbleView(this); | 5385 error->ShowBubbleView(this); |
| 5387 } | 5386 } |
| 5388 } | 5387 } |
| 5389 } | 5388 } |
| OLD | NEW |