| 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 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1486 bool Browser::IsClosingPermitted() { | 1486 bool Browser::IsClosingPermitted() { |
| 1487 TabCloseableStateWatcher* watcher = | 1487 TabCloseableStateWatcher* watcher = |
| 1488 g_browser_process->tab_closeable_state_watcher(); | 1488 g_browser_process->tab_closeable_state_watcher(); |
| 1489 bool can_close = !watcher || watcher->CanCloseBrowser(this); | 1489 bool can_close = !watcher || watcher->CanCloseBrowser(this); |
| 1490 if (!can_close && is_attempting_to_close_browser_) | 1490 if (!can_close && is_attempting_to_close_browser_) |
| 1491 CancelWindowClose(); | 1491 CancelWindowClose(); |
| 1492 return can_close; | 1492 return can_close; |
| 1493 } | 1493 } |
| 1494 | 1494 |
| 1495 bool Browser::CanGoBack() const { | 1495 bool Browser::CanGoBack() const { |
| 1496 return GetSelectedTabContentsWrapper()-> | 1496 return GetSelectedWebContents()->GetController().CanGoBack(); |
| 1497 web_contents()->GetController().CanGoBack(); | |
| 1498 } | 1497 } |
| 1499 | 1498 |
| 1500 void Browser::GoBack(WindowOpenDisposition disposition) { | 1499 void Browser::GoBack(WindowOpenDisposition disposition) { |
| 1501 content::RecordAction(UserMetricsAction("Back")); | 1500 content::RecordAction(UserMetricsAction("Back")); |
| 1502 | 1501 |
| 1503 TabContentsWrapper* current_tab = GetSelectedTabContentsWrapper(); | 1502 TabContentsWrapper* current_tab = GetSelectedTabContentsWrapper(); |
| 1504 if (CanGoBack()) { | 1503 if (CanGoBack()) { |
| 1505 WebContents* new_tab = GetOrCloneTabForDisposition(disposition); | 1504 WebContents* new_tab = GetOrCloneTabForDisposition(disposition); |
| 1506 // If we are on an interstitial page and clone the tab, it won't be copied | 1505 // If we are on an interstitial page and clone the tab, it won't be copied |
| 1507 // to the new tab, so we don't need to go back. | 1506 // to the new tab, so we don't need to go back. |
| 1508 if (current_tab->web_contents()->ShowingInterstitialPage() && | 1507 if (current_tab->web_contents()->ShowingInterstitialPage() && |
| 1509 (new_tab != current_tab->web_contents())) | 1508 (new_tab != current_tab->web_contents())) |
| 1510 return; | 1509 return; |
| 1511 new_tab->GetController().GoBack(); | 1510 new_tab->GetController().GoBack(); |
| 1512 } | 1511 } |
| 1513 } | 1512 } |
| 1514 | 1513 |
| 1515 bool Browser::CanGoForward() const { | 1514 bool Browser::CanGoForward() const { |
| 1516 return GetSelectedTabContentsWrapper()-> | 1515 return GetSelectedWebContents()->GetController().CanGoForward(); |
| 1517 web_contents()->GetController().CanGoForward(); | |
| 1518 } | 1516 } |
| 1519 | 1517 |
| 1520 void Browser::GoForward(WindowOpenDisposition disposition) { | 1518 void Browser::GoForward(WindowOpenDisposition disposition) { |
| 1521 content::RecordAction(UserMetricsAction("Forward")); | 1519 content::RecordAction(UserMetricsAction("Forward")); |
| 1522 if (CanGoForward()) | 1520 if (CanGoForward()) |
| 1523 GetOrCloneTabForDisposition(disposition)->GetController().GoForward(); | 1521 GetOrCloneTabForDisposition(disposition)->GetController().GoForward(); |
| 1524 } | 1522 } |
| 1525 | 1523 |
| 1526 void Browser::Reload(WindowOpenDisposition disposition) { | 1524 void Browser::Reload(WindowOpenDisposition disposition) { |
| 1527 content::RecordAction(UserMetricsAction("Reload")); | 1525 content::RecordAction(UserMetricsAction("Reload")); |
| (...skipping 3972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5500 local_state->SetBoolean(prefs::kShouldShowFirstRunBubble, false); | 5498 local_state->SetBoolean(prefs::kShouldShowFirstRunBubble, false); |
| 5501 window_->GetLocationBar()->ShowFirstRunBubble(); | 5499 window_->GetLocationBar()->ShowFirstRunBubble(); |
| 5502 } else { | 5500 } else { |
| 5503 GlobalErrorService* service = | 5501 GlobalErrorService* service = |
| 5504 GlobalErrorServiceFactory::GetForProfile(profile()); | 5502 GlobalErrorServiceFactory::GetForProfile(profile()); |
| 5505 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); | 5503 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); |
| 5506 if (error) | 5504 if (error) |
| 5507 error->ShowBubbleView(this); | 5505 error->ShowBubbleView(this); |
| 5508 } | 5506 } |
| 5509 } | 5507 } |
| OLD | NEW |