Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(761)

Side by Side Diff: chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.cc

Issue 2523053004: Enhance chrome.app.window API for shelf integration with restore support (Closed)
Patch Set: Review v4 Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 for (size_t i = 0; i < content.size(); i++) { 102 for (size_t i = 0; i < content.size(); i++) {
103 Browser* browser = chrome::FindBrowserWithWebContents(content[i]); 103 Browser* browser = chrome::FindBrowserWithWebContents(content[i]);
104 if (browser && browser->window()->GetNativeWindow()->IsVisible()) 104 if (browser && browser->window()->GetNativeWindow()->IsVisible())
105 return true; 105 return true;
106 } 106 }
107 return false; 107 return false;
108 } 108 }
109 109
110 void AppShortcutLauncherItemController::Launch(ash::LaunchSource source, 110 void AppShortcutLauncherItemController::Launch(ash::LaunchSource source,
111 int event_flags) { 111 int event_flags) {
112 launcher_controller()->LaunchApp(app_id(), source, event_flags); 112 launcher_controller()->LaunchAppWithLaunchId(app_id(), launch_id(), source,
113 event_flags);
stevenjb 2016/12/09 17:00:57 Why use WithLaunchId with an empty launch_id() ?
Andra Paraschiv 2016/12/12 14:28:22 Launch id should be non-empty if the window was cr
stevenjb 2016/12/13 19:31:14 Let me be more clear: Why not use launcher_contro
Andra Paraschiv 2016/12/14 14:59:38 In this case, if we use LaunchApp instead of Launc
stevenjb 2016/12/14 18:40:21 Ugh. My apologies. I was somehow reading that as L
Andra Paraschiv 2016/12/15 10:20:15 There's no problem, Steven, it's good we have this
113 } 114 }
114 115
115 ash::ShelfItemDelegate::PerformedAction 116 ash::ShelfItemDelegate::PerformedAction
116 AppShortcutLauncherItemController::Activate(ash::LaunchSource source) { 117 AppShortcutLauncherItemController::Activate(ash::LaunchSource source) {
117 content::WebContents* content = GetLRUApplication(); 118 content::WebContents* content = GetLRUApplication();
118 if (!content) { 119 if (!content) {
119 if (IsV2App()) { 120 if (IsV2App()) {
120 // Ideally we come here only once. After that ShellLauncherItemController 121 // Ideally we come here only once. After that ShellLauncherItemController
121 // will take over when the shell window gets opened. However there are 122 // will take over when the shell window gets opened. However there are
122 // apps which take a lot of time for pre-processing (like the files app) 123 // 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
372 373
373 bool AppShortcutLauncherItemController::AllowNextLaunchAttempt() { 374 bool AppShortcutLauncherItemController::AllowNextLaunchAttempt() {
374 if (last_launch_attempt_.is_null() || 375 if (last_launch_attempt_.is_null() ||
375 last_launch_attempt_ + base::TimeDelta::FromMilliseconds( 376 last_launch_attempt_ + base::TimeDelta::FromMilliseconds(
376 kClickSuppressionInMS) < base::Time::Now()) { 377 kClickSuppressionInMS) < base::Time::Now()) {
377 last_launch_attempt_ = base::Time::Now(); 378 last_launch_attempt_ = base::Time::Now();
378 return true; 379 return true;
379 } 380 }
380 return false; 381 return false;
381 } 382 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698