| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/aura/chrome_shell_delegate.h" | 5 #include "chrome/browser/ui/views/aura/chrome_shell_delegate.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/browser/ui/views/aura/app_list_window.h" |
| 8 #include "chrome/browser/ui/views/frame/browser_view.h" | 9 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 9 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| 10 #include "ui/aura_shell/launcher/launcher_types.h" | 11 #include "ui/aura_shell/launcher/launcher_types.h" |
| 11 | 12 |
| 12 ChromeShellDelegate::ChromeShellDelegate() { | 13 ChromeShellDelegate::ChromeShellDelegate() { |
| 13 } | 14 } |
| 14 | 15 |
| 15 ChromeShellDelegate::~ChromeShellDelegate() { | 16 ChromeShellDelegate::~ChromeShellDelegate() { |
| 16 } | 17 } |
| 17 | 18 |
| 18 // static | 19 // static |
| 19 bool ChromeShellDelegate::ShouldCreateLauncherItemForBrowser( | 20 bool ChromeShellDelegate::ShouldCreateLauncherItemForBrowser( |
| 20 Browser* browser, | 21 Browser* browser, |
| 21 aura_shell::LauncherItemType* type) { | 22 aura_shell::LauncherItemType* type) { |
| 22 if (browser->type() == Browser::TYPE_TABBED) { | 23 if (browser->type() == Browser::TYPE_TABBED) { |
| 23 *type = aura_shell::TYPE_TABBED; | 24 *type = aura_shell::TYPE_TABBED; |
| 24 return true; | 25 return true; |
| 25 } | 26 } |
| 26 if (browser->is_app()) { | 27 if (browser->is_app()) { |
| 27 *type = aura_shell::TYPE_APP; | 28 *type = aura_shell::TYPE_APP; |
| 28 return true; | 29 return true; |
| 29 } | 30 } |
| 30 return false; | 31 return false; |
| 31 } | 32 } |
| 32 | 33 |
| 33 void ChromeShellDelegate::CreateNewWindow() { | 34 void ChromeShellDelegate::CreateNewWindow() { |
| 34 } | 35 } |
| 35 | 36 |
| 36 void ChromeShellDelegate::ShowApps() { | 37 void ChromeShellDelegate::ShowApps() { |
| 38 AppListWindow::Toggle(); |
| 37 } | 39 } |
| 38 | 40 |
| 39 void ChromeShellDelegate::LauncherItemClicked( | 41 void ChromeShellDelegate::LauncherItemClicked( |
| 40 const aura_shell::LauncherItem& item) { | 42 const aura_shell::LauncherItem& item) { |
| 41 item.window->Activate(); | 43 item.window->Activate(); |
| 42 } | 44 } |
| 43 | 45 |
| 44 bool ChromeShellDelegate::ConfigureLauncherItem( | 46 bool ChromeShellDelegate::ConfigureLauncherItem( |
| 45 aura_shell::LauncherItem* item) { | 47 aura_shell::LauncherItem* item) { |
| 46 BrowserView* view = BrowserView::GetBrowserViewForNativeWindow(item->window); | 48 BrowserView* view = BrowserView::GetBrowserViewForNativeWindow(item->window); |
| 47 return view && | 49 return view && |
| 48 ShouldCreateLauncherItemForBrowser(view->browser(), &(item->type)); | 50 ShouldCreateLauncherItemForBrowser(view->browser(), &(item->type)); |
| 49 } | 51 } |
| OLD | NEW |