Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / views / frame / desktop_user_action_handler_aura.cc
blobc2f6e984352a2ed38e86215e7fcc7624c5d1b9e3
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)
12 : browser_(browser) {
15 DesktopUserActionHandlerAura::~DesktopUserActionHandlerAura() {}
17 bool DesktopUserActionHandlerAura::OnUserAction(
18 aura::client::UserActionClient::Command command) {
19 switch (command) {
20 case aura::client::UserActionClient::BACK: {
21 content::WebContents* contents = GetActiveWebContents();
22 if (contents && contents->GetController().CanGoBack()) {
23 contents->GetController().GoBack();
24 return true;
26 break;
28 case aura::client::UserActionClient::FORWARD: {
29 content::WebContents* contents = GetActiveWebContents();
30 if (contents && contents->GetController().CanGoForward()) {
31 contents->GetController().GoForward();
32 return true;
34 break;
36 default:
37 break;
39 return false;
42 content::WebContents*
43 DesktopUserActionHandlerAura::GetActiveWebContents() const {
44 return browser_->tab_strip_model()->GetActiveWebContents();