| 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" | 13 #include "ui/app_list/presenter/app_list_presenter_impl.h" |
| 14 #include "ui/app_list/views/app_list_view.h" | 14 #include "ui/app_list/views/app_list_view.h" |
| 15 | 15 |
| 16 AppListControllerDelegateAsh::AppListControllerDelegateAsh( | 16 AppListControllerDelegateAsh::AppListControllerDelegateAsh( |
| 17 app_list::AppListShowerImpl* app_list_shower) | 17 app_list::AppListPresenterImpl* app_list_presenter) |
| 18 : app_list_shower_(app_list_shower) {} | 18 : app_list_presenter_(app_list_presenter) {} |
| 19 | 19 |
| 20 AppListControllerDelegateAsh::~AppListControllerDelegateAsh() {} | 20 AppListControllerDelegateAsh::~AppListControllerDelegateAsh() {} |
| 21 | 21 |
| 22 void AppListControllerDelegateAsh::DismissView() { | 22 void AppListControllerDelegateAsh::DismissView() { |
| 23 app_list_shower_->Dismiss(); | 23 app_list_presenter_->Dismiss(); |
| 24 } | 24 } |
| 25 | 25 |
| 26 gfx::NativeWindow AppListControllerDelegateAsh::GetAppListWindow() { | 26 gfx::NativeWindow AppListControllerDelegateAsh::GetAppListWindow() { |
| 27 return app_list_shower_->GetWindow(); | 27 return app_list_presenter_->GetWindow(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 gfx::Rect AppListControllerDelegateAsh::GetAppListBounds() { | 30 gfx::Rect AppListControllerDelegateAsh::GetAppListBounds() { |
| 31 app_list::AppListView* app_list_view = app_list_shower_->GetView(); | 31 app_list::AppListView* app_list_view = app_list_presenter_->GetView(); |
| 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 bool AppListControllerDelegateAsh::IsAppPinned( | 37 bool AppListControllerDelegateAsh::IsAppPinned( |
| 38 const std::string& extension_id) { | 38 const std::string& extension_id) { |
| 39 return ChromeLauncherController::instance()->IsAppPinned(extension_id); | 39 return ChromeLauncherController::instance()->IsAppPinned(extension_id); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void AppListControllerDelegateAsh::PinApp(const std::string& extension_id) { | 42 void AppListControllerDelegateAsh::PinApp(const std::string& extension_id) { |
| 43 ChromeLauncherController::instance()->PinAppWithID(extension_id); | 43 ChromeLauncherController::instance()->PinAppWithID(extension_id); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void AppListControllerDelegateAsh::UnpinApp(const std::string& extension_id) { | 46 void AppListControllerDelegateAsh::UnpinApp(const std::string& extension_id) { |
| 47 ChromeLauncherController::instance()->UnpinAppWithID(extension_id); | 47 ChromeLauncherController::instance()->UnpinAppWithID(extension_id); |
| 48 } | 48 } |
| 49 | 49 |
| 50 AppListControllerDelegate::Pinnable AppListControllerDelegateAsh::GetPinnable( | 50 AppListControllerDelegate::Pinnable AppListControllerDelegateAsh::GetPinnable( |
| 51 const std::string& extension_id) { | 51 const std::string& extension_id) { |
| 52 return ChromeLauncherController::instance()->CanPin(extension_id) | 52 return ChromeLauncherController::instance()->CanPin(extension_id) |
| 53 ? PIN_EDITABLE | 53 ? PIN_EDITABLE |
| 54 : PIN_FIXED; | 54 : PIN_FIXED; |
| 55 } | 55 } |
| 56 | 56 |
| 57 void AppListControllerDelegateAsh::OnShowChildDialog() { | 57 void AppListControllerDelegateAsh::OnShowChildDialog() { |
| 58 app_list::AppListView* app_list_view = app_list_shower_->GetView(); | 58 app_list::AppListView* app_list_view = app_list_presenter_->GetView(); |
| 59 if (app_list_view) | 59 if (app_list_view) |
| 60 app_list_view->SetAppListOverlayVisible(true); | 60 app_list_view->SetAppListOverlayVisible(true); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void AppListControllerDelegateAsh::OnCloseChildDialog() { | 63 void AppListControllerDelegateAsh::OnCloseChildDialog() { |
| 64 app_list::AppListView* app_list_view = app_list_shower_->GetView(); | 64 app_list::AppListView* app_list_view = app_list_presenter_->GetView(); |
| 65 if (app_list_view) | 65 if (app_list_view) |
| 66 app_list_view->SetAppListOverlayVisible(false); | 66 app_list_view->SetAppListOverlayVisible(false); |
| 67 } | 67 } |
| 68 | 68 |
| 69 bool AppListControllerDelegateAsh::CanDoCreateShortcutsFlow() { | 69 bool AppListControllerDelegateAsh::CanDoCreateShortcutsFlow() { |
| 70 return false; | 70 return false; |
| 71 } | 71 } |
| 72 | 72 |
| 73 void AppListControllerDelegateAsh::DoCreateShortcutsFlow( | 73 void AppListControllerDelegateAsh::DoCreateShortcutsFlow( |
| 74 Profile* profile, | 74 Profile* profile, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 AppListSource source) { | 144 AppListSource source) { |
| 145 switch (source) { | 145 switch (source) { |
| 146 case LAUNCH_FROM_APP_LIST: | 146 case LAUNCH_FROM_APP_LIST: |
| 147 return ash::LAUNCH_FROM_APP_LIST; | 147 return ash::LAUNCH_FROM_APP_LIST; |
| 148 case LAUNCH_FROM_APP_LIST_SEARCH: | 148 case LAUNCH_FROM_APP_LIST_SEARCH: |
| 149 return ash::LAUNCH_FROM_APP_LIST_SEARCH; | 149 return ash::LAUNCH_FROM_APP_LIST_SEARCH; |
| 150 default: | 150 default: |
| 151 return ash::LAUNCH_FROM_UNKNOWN; | 151 return ash::LAUNCH_FROM_UNKNOWN; |
| 152 } | 152 } |
| 153 } | 153 } |
| OLD | NEW |