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/views/ash/user_action_handler.h" | 5 #include "chrome/browser/ui/views/ash/user_action_handler.h" |
6 | 6 |
7 #include "ash/wm/window_util.h" | 7 #include "ash/wm/window_util.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/browser_list.h" | 9 #include "chrome/browser/ui/browser_list.h" |
| 10 #include "chrome/browser/ui/browser_tabstrip.h" |
10 #include "chrome/browser/ui/browser_window.h" | 11 #include "chrome/browser/ui/browser_window.h" |
11 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 12 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
12 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
13 | 14 |
14 // Returns the currently-active WebContents belonging to the active browser, or | 15 // Returns the currently-active WebContents belonging to the active browser, or |
15 // NULL if there's no currently-active browser. | 16 // NULL if there's no currently-active browser. |
16 content::WebContents* GetActiveWebContents() { | 17 content::WebContents* GetActiveWebContents() { |
17 Browser* browser = BrowserList::GetLastActive(); | 18 Browser* browser = BrowserList::GetLastActive(); |
18 if (!browser) | 19 if (!browser) |
19 return NULL; | 20 return NULL; |
20 if (!ash::wm::IsActiveWindow(browser->window()->GetNativeWindow())) | 21 if (!ash::wm::IsActiveWindow(browser->window()->GetNativeWindow())) |
21 return NULL; | 22 return NULL; |
22 | 23 |
23 return browser->GetActiveWebContents(); | 24 return chrome::GetActiveWebContents(browser); |
24 } | 25 } |
25 | 26 |
26 UserActionHandler::UserActionHandler() {} | 27 UserActionHandler::UserActionHandler() {} |
27 | 28 |
28 UserActionHandler::~UserActionHandler() {} | 29 UserActionHandler::~UserActionHandler() {} |
29 | 30 |
30 bool UserActionHandler::OnUserAction( | 31 bool UserActionHandler::OnUserAction( |
31 aura::client::UserActionClient::Command command) { | 32 aura::client::UserActionClient::Command command) { |
32 switch (command) { | 33 switch (command) { |
33 case aura::client::UserActionClient::BACK: { | 34 case aura::client::UserActionClient::BACK: { |
(...skipping 10 matching lines...) Expand all Loading... |
44 contents->GetController().GoForward(); | 45 contents->GetController().GoForward(); |
45 return true; | 46 return true; |
46 } | 47 } |
47 break; | 48 break; |
48 } | 49 } |
49 default: | 50 default: |
50 break; | 51 break; |
51 } | 52 } |
52 return false; | 53 return false; |
53 } | 54 } |
OLD | NEW |