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 "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // they open a window. Since there is currently no other way to detect if an | 112 // they open a window. Since there is currently no other way to detect if an |
113 // app was started we suppress any further clicks within a special time out. | 113 // app was started we suppress any further clicks within a special time out. |
114 if (IsV2App() && !AllowNextLaunchAttempt()) { | 114 if (IsV2App() && !AllowNextLaunchAttempt()) { |
115 callback.Run(ash::SHELF_ACTION_NONE, | 115 callback.Run(ash::SHELF_ACTION_NONE, |
116 GetAppMenuItems(event ? event->flags() : ui::EF_NONE)); | 116 GetAppMenuItems(event ? event->flags() : ui::EF_NONE)); |
117 return; | 117 return; |
118 } | 118 } |
119 | 119 |
120 // Launching some items replaces this item controller instance, which | 120 // Launching some items replaces this item controller instance, which |
121 // destroys the app and launch id strings; making copies avoid crashes. | 121 // destroys the app and launch id strings; making copies avoid crashes. |
122 launcher_controller()->LaunchApp(ash::AppLauncherId(app_id(), launch_id()), | 122 launcher_controller()->LaunchApp(ash::AppLaunchId(app_id(), launch_id()), |
123 source, ui::EF_NONE); | 123 source, ui::EF_NONE); |
124 callback.Run(ash::SHELF_ACTION_NEW_WINDOW_CREATED, base::nullopt); | 124 callback.Run(ash::SHELF_ACTION_NEW_WINDOW_CREATED, base::nullopt); |
125 return; | 125 return; |
126 } | 126 } |
127 | 127 |
128 const ash::ShelfAction action = ActivateContent(content); | 128 const ash::ShelfAction action = ActivateContent(content); |
129 callback.Run(action, GetAppMenuItems(event ? event->flags() : ui::EF_NONE)); | 129 callback.Run(action, GetAppMenuItems(event ? event->flags() : ui::EF_NONE)); |
130 } | 130 } |
131 | 131 |
132 MenuItemList AppShortcutLauncherItemController::GetAppMenuItems( | 132 MenuItemList AppShortcutLauncherItemController::GetAppMenuItems( |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 | 359 |
360 bool AppShortcutLauncherItemController::AllowNextLaunchAttempt() { | 360 bool AppShortcutLauncherItemController::AllowNextLaunchAttempt() { |
361 if (last_launch_attempt_.is_null() || | 361 if (last_launch_attempt_.is_null() || |
362 last_launch_attempt_ + base::TimeDelta::FromMilliseconds( | 362 last_launch_attempt_ + base::TimeDelta::FromMilliseconds( |
363 kClickSuppressionInMS) < base::Time::Now()) { | 363 kClickSuppressionInMS) < base::Time::Now()) { |
364 last_launch_attempt_ = base::Time::Now(); | 364 last_launch_attempt_ = base::Time::Now(); |
365 return true; | 365 return true; |
366 } | 366 } |
367 return false; | 367 return false; |
368 } | 368 } |
OLD | NEW |