| 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/chromeos/arc/arc_support_host.h" | 10 #include "chrome/browser/chromeos/arc/arc_support_host.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 for (size_t i = 0; i < content.size(); i++) { | 104 for (size_t i = 0; i < content.size(); i++) { |
| 105 Browser* browser = chrome::FindBrowserWithWebContents(content[i]); | 105 Browser* browser = chrome::FindBrowserWithWebContents(content[i]); |
| 106 if (browser && browser->window()->GetNativeWindow()->IsVisible()) | 106 if (browser && browser->window()->GetNativeWindow()->IsVisible()) |
| 107 return true; | 107 return true; |
| 108 } | 108 } |
| 109 return false; | 109 return false; |
| 110 } | 110 } |
| 111 | 111 |
| 112 void AppShortcutLauncherItemController::Launch(ash::LaunchSource source, | 112 void AppShortcutLauncherItemController::Launch(ash::LaunchSource source, |
| 113 int event_flags) { | 113 int event_flags) { |
| 114 launcher_controller()->LaunchApp(app_id(), source, event_flags); | 114 launcher_controller()->LaunchApp(std::string(app_id()), source, event_flags); |
| 115 } | 115 } |
| 116 | 116 |
| 117 ash::ShelfItemDelegate::PerformedAction | 117 ash::ShelfItemDelegate::PerformedAction |
| 118 AppShortcutLauncherItemController::Activate(ash::LaunchSource source) { | 118 AppShortcutLauncherItemController::Activate(ash::LaunchSource source) { |
| 119 content::WebContents* content = GetLRUApplication(); | 119 content::WebContents* content = GetLRUApplication(); |
| 120 if (!content) { | 120 if (!content) { |
| 121 if (IsV2App()) { | 121 if (IsV2App()) { |
| 122 // Ideally we come here only once. After that ShellLauncherItemController | 122 // Ideally we come here only once. After that ShellLauncherItemController |
| 123 // will take over when the shell window gets opened. However there are | 123 // will take over when the shell window gets opened. However there are |
| 124 // apps which take a lot of time for pre-processing (like the files app) | 124 // apps which take a lot of time for pre-processing (like the files app) |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 | 374 |
| 375 bool AppShortcutLauncherItemController::AllowNextLaunchAttempt() { | 375 bool AppShortcutLauncherItemController::AllowNextLaunchAttempt() { |
| 376 if (last_launch_attempt_.is_null() || | 376 if (last_launch_attempt_.is_null() || |
| 377 last_launch_attempt_ + base::TimeDelta::FromMilliseconds( | 377 last_launch_attempt_ + base::TimeDelta::FromMilliseconds( |
| 378 kClickSuppressionInMS) < base::Time::Now()) { | 378 kClickSuppressionInMS) < base::Time::Now()) { |
| 379 last_launch_attempt_ = base::Time::Now(); | 379 last_launch_attempt_ = base::Time::Now(); |
| 380 return true; | 380 return true; |
| 381 } | 381 } |
| 382 return false; | 382 return false; |
| 383 } | 383 } |
| OLD | NEW |