1 // Copyright (c) 2013 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.
5 #include "chrome/browser/ui/views/frame/desktop_user_action_handler_aura.h"
7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/tabs/tab_strip_model.h"
9 #include "content/public/browser/web_contents.h"
11 DesktopUserActionHandlerAura::DesktopUserActionHandlerAura(Browser
* browser
)
15 DesktopUserActionHandlerAura::~DesktopUserActionHandlerAura() {}
17 bool DesktopUserActionHandlerAura::OnUserAction(
18 aura::client::UserActionClient::Command command
) {
20 case aura::client::UserActionClient::BACK
: {
21 content::WebContents
* contents
= GetActiveWebContents();
22 if (contents
&& contents
->GetController().CanGoBack()) {
23 contents
->GetController().GoBack();
28 case aura::client::UserActionClient::FORWARD
: {
29 content::WebContents
* contents
= GetActiveWebContents();
30 if (contents
&& contents
->GetController().CanGoForward()) {
31 contents
->GetController().GoForward();
43 DesktopUserActionHandlerAura::GetActiveWebContents() const {
44 return browser_
->tab_strip_model()->GetActiveWebContents();