Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 9296040: mac: Always do history swiping on the NTP on lion devices with touchpad. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disable swipes to the left as well Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« chrome/browser/ui/browser.h ('K') | « chrome/browser/ui/browser.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
1524 bool Browser::IsOnNtp() const {
1525 WebContents* contents = GetSelectedWebContents();
1526 return contents && contents->GetURL() == GURL(chrome::kChromeUINewTabURL);
1527 }
1528
1526 void Browser::Reload(WindowOpenDisposition disposition) { 1529 void Browser::Reload(WindowOpenDisposition disposition) {
1527 content::RecordAction(UserMetricsAction("Reload")); 1530 content::RecordAction(UserMetricsAction("Reload"));
1528 ReloadInternal(disposition, false); 1531 ReloadInternal(disposition, false);
1529 } 1532 }
1530 1533
1531 void Browser::ReloadIgnoringCache(WindowOpenDisposition disposition) { 1534 void Browser::ReloadIgnoringCache(WindowOpenDisposition disposition) {
1532 content::RecordAction(UserMetricsAction("ReloadIgnoringCache")); 1535 content::RecordAction(UserMetricsAction("ReloadIgnoringCache"));
1533 ReloadInternal(disposition, true); 1536 ReloadInternal(disposition, true);
1534 } 1537 }
1535 1538
(...skipping 3964 matching lines...) Expand 10 before | Expand all | Expand 10 after
5500 local_state->SetBoolean(prefs::kShouldShowFirstRunBubble, false); 5503 local_state->SetBoolean(prefs::kShouldShowFirstRunBubble, false);
5501 window_->GetLocationBar()->ShowFirstRunBubble(); 5504 window_->GetLocationBar()->ShowFirstRunBubble();
5502 } else { 5505 } else {
5503 GlobalErrorService* service = 5506 GlobalErrorService* service =
5504 GlobalErrorServiceFactory::GetForProfile(profile()); 5507 GlobalErrorServiceFactory::GetForProfile(profile());
5505 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); 5508 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView();
5506 if (error) 5509 if (error)
5507 error->ShowBubbleView(this); 5510 error->ShowBubbleView(this);
5508 } 5511 }
5509 } 5512 }
OLDNEW
« chrome/browser/ui/browser.h ('K') | « chrome/browser/ui/browser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698