Chromium Code Reviews| 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 "base/command_line.h" | |
| 7 #include "chrome/browser/profiles/profile_manager.h" | 8 #include "chrome/browser/profiles/profile_manager.h" |
| 8 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/views/aura/app_list_window.h" | 10 #include "chrome/browser/ui/views/aura/app_list_window.h" |
| 11 #include "chrome/browser/ui/views/aura/app_list/app_list_model.h" | |
| 12 #include "chrome/browser/ui/views/aura/app_list/app_list_view_delegate.h" | |
| 10 #include "chrome/browser/ui/views/aura/status_area_host_aura.h" | 13 #include "chrome/browser/ui/views/aura/status_area_host_aura.h" |
| 11 #include "chrome/browser/ui/views/frame/browser_view.h" | 14 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 15 #include "ui/aura/aura_switches.h" | |
| 12 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 17 #include "ui/aura_shell/app_list/app_list_view.h" | |
| 13 #include "ui/aura_shell/launcher/launcher_types.h" | 18 #include "ui/aura_shell/launcher/launcher_types.h" |
| 14 #include "ui/aura_shell/window_util.h" | 19 #include "ui/aura_shell/window_util.h" |
| 15 | 20 |
| 16 // static | 21 // static |
| 17 ChromeShellDelegate* ChromeShellDelegate::instance_ = NULL; | 22 ChromeShellDelegate* ChromeShellDelegate::instance_ = NULL; |
| 18 | 23 |
| 19 ChromeShellDelegate::ChromeShellDelegate() { | 24 ChromeShellDelegate::ChromeShellDelegate() { |
| 20 instance_ = this; | 25 instance_ = this; |
| 21 } | 26 } |
| 22 | 27 |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 53 views::Widget* ChromeShellDelegate::CreateStatusArea() { | 58 views::Widget* ChromeShellDelegate::CreateStatusArea() { |
| 54 status_area_host_.reset(new StatusAreaHostAura()); | 59 status_area_host_.reset(new StatusAreaHostAura()); |
| 55 views::Widget* status_area_widget = | 60 views::Widget* status_area_widget = |
| 56 status_area_host_.get()->CreateStatusArea(); | 61 status_area_host_.get()->CreateStatusArea(); |
| 57 return status_area_widget; | 62 return status_area_widget; |
| 58 } | 63 } |
| 59 | 64 |
| 60 void ChromeShellDelegate::RequestAppListWidget( | 65 void ChromeShellDelegate::RequestAppListWidget( |
| 61 const gfx::Rect& bounds, | 66 const gfx::Rect& bounds, |
| 62 const SetWidgetCallback& callback) { | 67 const SetWidgetCallback& callback) { |
| 63 // AppListWindow deletes itself when closed. | 68 // AppListWindow and AppListView deletes itself when closed. |
| 64 new AppListWindow(bounds, callback); | 69 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 70 switches::kAuraViewsAppList)) { | |
| 71 scoped_ptr<AppListModel> model( | |
| 72 new AppListModel(ProfileManager::GetDefaultProfile())); | |
| 73 model->Init(); | |
| 74 | |
| 75 new aura_shell::AppListView(model.release(), | |
|
Ben Goodger (Google)
2011/12/20 19:07:18
can you just return the model instance and do this
xiyuan
2011/12/20 21:55:50
Done.
| |
| 76 new AppListViewDelegate, | |
| 77 bounds, | |
| 78 callback); | |
| 79 } else { | |
| 80 new AppListWindow(bounds, callback); | |
| 81 } | |
| 65 } | 82 } |
| 66 | 83 |
| 67 void ChromeShellDelegate::LauncherItemClicked( | 84 void ChromeShellDelegate::LauncherItemClicked( |
| 68 const aura_shell::LauncherItem& item) { | 85 const aura_shell::LauncherItem& item) { |
| 69 aura_shell::ActivateWindow(item.window); | 86 aura_shell::ActivateWindow(item.window); |
| 70 } | 87 } |
| 71 | 88 |
| 72 bool ChromeShellDelegate::ConfigureLauncherItem( | 89 bool ChromeShellDelegate::ConfigureLauncherItem( |
| 73 aura_shell::LauncherItem* item) { | 90 aura_shell::LauncherItem* item) { |
| 74 BrowserView* view = BrowserView::GetBrowserViewForNativeWindow(item->window); | 91 BrowserView* view = BrowserView::GetBrowserViewForNativeWindow(item->window); |
| 75 return view && | 92 return view && |
| 76 ShouldCreateLauncherItemForBrowser(view->browser(), &(item->type)); | 93 ShouldCreateLauncherItemForBrowser(view->browser(), &(item->type)); |
| 77 } | 94 } |
| OLD | NEW |