| 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/shelf/shelf_model.h" | 7 #include "ash/shelf/shelf_model.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 10 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 return gfx::Rect(); | 37 return gfx::Rect(); |
| 38 } | 38 } |
| 39 | 39 |
| 40 bool AppListControllerDelegateAsh::IsAppPinned(const std::string& app_id) { | 40 bool AppListControllerDelegateAsh::IsAppPinned(const std::string& app_id) { |
| 41 return ash::Shell::Get()->shelf_model()->IsAppPinned(app_id); | 41 return ash::Shell::Get()->shelf_model()->IsAppPinned(app_id); |
| 42 } | 42 } |
| 43 | 43 |
| 44 bool AppListControllerDelegateAsh::IsAppOpen(const std::string& app_id) const { | 44 bool AppListControllerDelegateAsh::IsAppOpen(const std::string& app_id) const { |
| 45 ash::ShelfID id = | 45 ash::ShelfID id = |
| 46 ash::Shell::Get()->shelf_model()->GetShelfIDForAppID(app_id); | 46 ash::Shell::Get()->shelf_model()->GetShelfIDForAppID(app_id); |
| 47 return id && ChromeLauncherController::instance()->IsOpen(id); | 47 return !id.IsNull() && ChromeLauncherController::instance()->IsOpen(id); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void AppListControllerDelegateAsh::PinApp(const std::string& app_id) { | 50 void AppListControllerDelegateAsh::PinApp(const std::string& app_id) { |
| 51 ash::Shell::Get()->shelf_model()->PinAppWithID(app_id); | 51 ash::Shell::Get()->shelf_model()->PinAppWithID(app_id); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void AppListControllerDelegateAsh::UnpinApp(const std::string& app_id) { | 54 void AppListControllerDelegateAsh::UnpinApp(const std::string& app_id) { |
| 55 ash::Shell::Get()->shelf_model()->UnpinAppWithID(app_id); | 55 ash::Shell::Get()->shelf_model()->UnpinAppWithID(app_id); |
| 56 } | 56 } |
| 57 | 57 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 109 |
| 110 DismissView(); | 110 DismissView(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void AppListControllerDelegateAsh::LaunchApp( | 113 void AppListControllerDelegateAsh::LaunchApp( |
| 114 Profile* profile, | 114 Profile* profile, |
| 115 const extensions::Extension* extension, | 115 const extensions::Extension* extension, |
| 116 AppListSource source, | 116 AppListSource source, |
| 117 int event_flags) { | 117 int event_flags) { |
| 118 ChromeLauncherController::instance()->LaunchApp( | 118 ChromeLauncherController::instance()->LaunchApp( |
| 119 ash::AppLaunchId(extension->id()), AppListSourceToLaunchSource(source), | 119 ash::ShelfID(extension->id()), AppListSourceToLaunchSource(source), |
| 120 event_flags); | 120 event_flags); |
| 121 DismissView(); | 121 DismissView(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 ash::ShelfLaunchSource | 124 ash::ShelfLaunchSource |
| 125 AppListControllerDelegateAsh::AppListSourceToLaunchSource( | 125 AppListControllerDelegateAsh::AppListSourceToLaunchSource( |
| 126 AppListSource source) { | 126 AppListSource source) { |
| 127 switch (source) { | 127 switch (source) { |
| 128 case LAUNCH_FROM_APP_LIST: | 128 case LAUNCH_FROM_APP_LIST: |
| 129 return ash::LAUNCH_FROM_APP_LIST; | 129 return ash::LAUNCH_FROM_APP_LIST; |
| 130 case LAUNCH_FROM_APP_LIST_SEARCH: | 130 case LAUNCH_FROM_APP_LIST_SEARCH: |
| 131 return ash::LAUNCH_FROM_APP_LIST_SEARCH; | 131 return ash::LAUNCH_FROM_APP_LIST_SEARCH; |
| 132 default: | 132 default: |
| 133 return ash::LAUNCH_FROM_UNKNOWN; | 133 return ash::LAUNCH_FROM_UNKNOWN; |
| 134 } | 134 } |
| 135 } | 135 } |
| OLD | NEW |