| 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/ash/app_list/app_list_controller_ash.h" | 5 #include "chrome/browser/ui/ash/app_list/app_list_controller_ash.h" |
| 6 | 6 |
| 7 #include "ash/metrics/task_switch_metrics_recorder.h" | 7 #include "ash/metrics/task_switch_metrics_recorder.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 9 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 10 #include "chrome/browser/ui/browser_navigator.h" | 10 #include "chrome/browser/ui/browser_navigator.h" |
| 11 #include "chrome/browser/ui/browser_navigator_params.h" | 11 #include "chrome/browser/ui/browser_navigator_params.h" |
| 12 #include "extensions/common/extension.h" | 12 #include "extensions/common/extension.h" |
| 13 #include "ui/app_list/shower/app_list_shower_impl.h" | |
| 14 #include "ui/app_list/views/app_list_view.h" | 13 #include "ui/app_list/views/app_list_view.h" |
| 15 | 14 |
| 16 AppListControllerDelegateAsh::AppListControllerDelegateAsh( | 15 AppListControllerDelegateAsh::AppListControllerDelegateAsh() {} |
| 17 app_list::AppListShowerImpl* app_list_shower) | |
| 18 : app_list_shower_(app_list_shower) {} | |
| 19 | 16 |
| 20 AppListControllerDelegateAsh::~AppListControllerDelegateAsh() {} | 17 AppListControllerDelegateAsh::~AppListControllerDelegateAsh() {} |
| 21 | 18 |
| 22 void AppListControllerDelegateAsh::DismissView() { | 19 void AppListControllerDelegateAsh::DismissView() { |
| 23 app_list_shower_->Dismiss(); | 20 DCHECK(ash::Shell::HasInstance()); |
| 21 ash::Shell::GetInstance()->DismissAppList(); |
| 24 } | 22 } |
| 25 | 23 |
| 26 gfx::NativeWindow AppListControllerDelegateAsh::GetAppListWindow() { | 24 gfx::NativeWindow AppListControllerDelegateAsh::GetAppListWindow() { |
| 27 return app_list_shower_->GetWindow(); | 25 DCHECK(ash::Shell::HasInstance()); |
| 26 return ash::Shell::GetInstance()->GetAppListWindow(); |
| 28 } | 27 } |
| 29 | 28 |
| 30 gfx::Rect AppListControllerDelegateAsh::GetAppListBounds() { | 29 gfx::Rect AppListControllerDelegateAsh::GetAppListBounds() { |
| 31 app_list::AppListView* app_list_view = app_list_shower_->GetView(); | 30 app_list::AppListView* app_list_view = |
| 31 ash::Shell::GetInstance()->GetAppListView(); |
| 32 if (app_list_view) | 32 if (app_list_view) |
| 33 return app_list_view->GetBoundsInScreen(); | 33 return app_list_view->GetBoundsInScreen(); |
| 34 return gfx::Rect(); | 34 return gfx::Rect(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 gfx::ImageSkia AppListControllerDelegateAsh::GetWindowIcon() { | 37 gfx::ImageSkia AppListControllerDelegateAsh::GetWindowIcon() { |
| 38 return gfx::ImageSkia(); | 38 return gfx::ImageSkia(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 bool AppListControllerDelegateAsh::IsAppPinned( | 41 bool AppListControllerDelegateAsh::IsAppPinned( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 52 } | 52 } |
| 53 | 53 |
| 54 AppListControllerDelegate::Pinnable AppListControllerDelegateAsh::GetPinnable( | 54 AppListControllerDelegate::Pinnable AppListControllerDelegateAsh::GetPinnable( |
| 55 const std::string& extension_id) { | 55 const std::string& extension_id) { |
| 56 return ChromeLauncherController::instance()->CanPin(extension_id) | 56 return ChromeLauncherController::instance()->CanPin(extension_id) |
| 57 ? PIN_EDITABLE | 57 ? PIN_EDITABLE |
| 58 : PIN_FIXED; | 58 : PIN_FIXED; |
| 59 } | 59 } |
| 60 | 60 |
| 61 void AppListControllerDelegateAsh::OnShowChildDialog() { | 61 void AppListControllerDelegateAsh::OnShowChildDialog() { |
| 62 app_list::AppListView* app_list_view = app_list_shower_->GetView(); | 62 app_list::AppListView* app_list_view = |
| 63 ash::Shell::GetInstance()->GetAppListView(); |
| 63 if (app_list_view) | 64 if (app_list_view) |
| 64 app_list_view->SetAppListOverlayVisible(true); | 65 app_list_view->SetAppListOverlayVisible(true); |
| 65 } | 66 } |
| 66 | 67 |
| 67 void AppListControllerDelegateAsh::OnCloseChildDialog() { | 68 void AppListControllerDelegateAsh::OnCloseChildDialog() { |
| 68 app_list::AppListView* app_list_view = app_list_shower_->GetView(); | 69 app_list::AppListView* app_list_view = |
| 70 ash::Shell::GetInstance()->GetAppListView(); |
| 69 if (app_list_view) | 71 if (app_list_view) |
| 70 app_list_view->SetAppListOverlayVisible(false); | 72 app_list_view->SetAppListOverlayVisible(false); |
| 71 } | 73 } |
| 72 | 74 |
| 73 bool AppListControllerDelegateAsh::CanDoCreateShortcutsFlow() { | 75 bool AppListControllerDelegateAsh::CanDoCreateShortcutsFlow() { |
| 74 return false; | 76 return false; |
| 75 } | 77 } |
| 76 | 78 |
| 77 void AppListControllerDelegateAsh::DoCreateShortcutsFlow( | 79 void AppListControllerDelegateAsh::DoCreateShortcutsFlow( |
| 78 Profile* profile, | 80 Profile* profile, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 AppListSource source) { | 150 AppListSource source) { |
| 149 switch (source) { | 151 switch (source) { |
| 150 case LAUNCH_FROM_APP_LIST: | 152 case LAUNCH_FROM_APP_LIST: |
| 151 return ash::LAUNCH_FROM_APP_LIST; | 153 return ash::LAUNCH_FROM_APP_LIST; |
| 152 case LAUNCH_FROM_APP_LIST_SEARCH: | 154 case LAUNCH_FROM_APP_LIST_SEARCH: |
| 153 return ash::LAUNCH_FROM_APP_LIST_SEARCH; | 155 return ash::LAUNCH_FROM_APP_LIST_SEARCH; |
| 154 default: | 156 default: |
| 155 return ash::LAUNCH_FROM_UNKNOWN; | 157 return ash::LAUNCH_FROM_UNKNOWN; |
| 156 } | 158 } |
| 157 } | 159 } |
| OLD | NEW |