| 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/launcher/app_shortcut_launcher_item_controller.h
" | 5 #include "chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.h
" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
| 10 #include "chrome/browser/extensions/launch_util.h" | 10 #include "chrome/browser/extensions/launch_util.h" |
| 11 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h" | 11 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h" |
| 12 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.h" | 12 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.h" |
| 13 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 13 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 14 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" | 14 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" |
| 15 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" | 15 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" |
| 16 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" |
| 16 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" | 17 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" |
| 17 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 18 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
| 18 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 19 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
| 19 #include "chrome/browser/ui/browser.h" | 20 #include "chrome/browser/ui/browser.h" |
| 20 #include "chrome/browser/ui/browser_finder.h" | 21 #include "chrome/browser/ui/browser_finder.h" |
| 21 #include "chrome/browser/ui/browser_list.h" | 22 #include "chrome/browser/ui/browser_list.h" |
| 22 #include "chrome/browser/ui/browser_window.h" | 23 #include "chrome/browser/ui/browser_window.h" |
| 23 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 24 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 24 #include "chrome/browser/web_applications/web_app.h" | 25 #include "chrome/browser/web_applications/web_app.h" |
| 25 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" | 26 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 // In case of a keyboard event, we were called by a hotkey. In that case we | 194 // In case of a keyboard event, we were called by a hotkey. In that case we |
| 194 // activate the next item in line if an item of our list is already active. | 195 // activate the next item in line if an item of our list is already active. |
| 195 if (event.type() == ui::ET_KEY_RELEASED) { | 196 if (event.type() == ui::ET_KEY_RELEASED) { |
| 196 if (AdvanceToNextApp()) | 197 if (AdvanceToNextApp()) |
| 197 return kExistingWindowActivated; | 198 return kExistingWindowActivated; |
| 198 } | 199 } |
| 199 return Activate(ash::LAUNCH_FROM_UNKNOWN); | 200 return Activate(ash::LAUNCH_FROM_UNKNOWN); |
| 200 } | 201 } |
| 201 | 202 |
| 202 base::string16 AppShortcutLauncherItemController::GetTitle() { | 203 base::string16 AppShortcutLauncherItemController::GetTitle() { |
| 203 return GetAppTitle(); | 204 return LauncherControllerHelper::GetAppTitle(launcher_controller()->profile(), |
| 205 app_id()); |
| 204 } | 206 } |
| 205 | 207 |
| 206 ash::ShelfMenuModel* AppShortcutLauncherItemController::CreateApplicationMenu( | 208 ash::ShelfMenuModel* AppShortcutLauncherItemController::CreateApplicationMenu( |
| 207 int event_flags) { | 209 int event_flags) { |
| 208 return new LauncherApplicationMenuItemModel(GetApplicationList(event_flags)); | 210 return new LauncherApplicationMenuItemModel(GetApplicationList(event_flags)); |
| 209 } | 211 } |
| 210 | 212 |
| 211 bool AppShortcutLauncherItemController::IsDraggable() { | 213 bool AppShortcutLauncherItemController::IsDraggable() { |
| 212 return CanPin(); | 214 return CanPin(); |
| 213 } | 215 } |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 | 362 |
| 361 bool AppShortcutLauncherItemController::AllowNextLaunchAttempt() { | 363 bool AppShortcutLauncherItemController::AllowNextLaunchAttempt() { |
| 362 if (last_launch_attempt_.is_null() || | 364 if (last_launch_attempt_.is_null() || |
| 363 last_launch_attempt_ + base::TimeDelta::FromMilliseconds( | 365 last_launch_attempt_ + base::TimeDelta::FromMilliseconds( |
| 364 kClickSuppressionInMS) < base::Time::Now()) { | 366 kClickSuppressionInMS) < base::Time::Now()) { |
| 365 last_launch_attempt_ = base::Time::Now(); | 367 last_launch_attempt_ = base::Time::Now(); |
| 366 return true; | 368 return true; |
| 367 } | 369 } |
| 368 return false; | 370 return false; |
| 369 } | 371 } |
| OLD | NEW |