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

Side by Side Diff: chrome/browser/ui/views/ash/user_action_handler.cc

Issue 10832287: ash: Remove old files and update DEPS whitelist. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/views/ash/user_action_handler.h"
6
7 #include "ash/wm/window_util.h"
8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_list.h"
10 #include "chrome/browser/ui/browser_tabstrip.h"
11 #include "chrome/browser/ui/browser_window.h"
12 #include "chrome/browser/ui/tab_contents/tab_contents.h"
13 #include "content/public/browser/web_contents.h"
14
15 // Returns the currently-active WebContents belonging to the active browser, or
16 // NULL if there's no currently-active browser.
17 content::WebContents* GetActiveWebContents() {
18 Browser* browser = BrowserList::GetLastActive();
19 if (!browser)
20 return NULL;
21 if (!ash::wm::IsActiveWindow(browser->window()->GetNativeWindow()))
22 return NULL;
23
24 return chrome::GetActiveWebContents(browser);
25 }
26
27 UserActionHandler::UserActionHandler() {}
28
29 UserActionHandler::~UserActionHandler() {}
30
31 bool UserActionHandler::OnUserAction(
32 aura::client::UserActionClient::Command command) {
33 switch (command) {
34 case aura::client::UserActionClient::BACK: {
35 content::WebContents* contents = GetActiveWebContents();
36 if (contents && contents->GetController().CanGoBack()) {
37 contents->GetController().GoBack();
38 return true;
39 }
40 break;
41 }
42 case aura::client::UserActionClient::FORWARD: {
43 content::WebContents* contents = GetActiveWebContents();
44 if (contents && contents->GetController().CanGoForward()) {
45 contents->GetController().GoForward();
46 return true;
47 }
48 break;
49 }
50 default:
51 break;
52 }
53 return false;
54 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/ash/user_action_handler.h ('k') | chrome/browser/ui/views/ash/window_positioner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698