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

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

Issue 2290603002: Enhance chrome.app.window API for shelf integration with pinning support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review v3 Created 4 years, 3 months 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 chrome::MultiUserWindowManager::MULTI_PROFILE_MODE_OFF) 58 chrome::MultiUserWindowManager::MULTI_PROFILE_MODE_OFF)
59 return true; 59 return true;
60 return multi_user_util::IsProfileFromActiveUser(browser->profile()); 60 return multi_user_util::IsProfileFromActiveUser(browser->profile());
61 } 61 }
62 62
63 } // namespace 63 } // namespace
64 64
65 // static 65 // static
66 AppShortcutLauncherItemController* AppShortcutLauncherItemController::Create( 66 AppShortcutLauncherItemController* AppShortcutLauncherItemController::Create(
67 const std::string& app_id, 67 const std::string& app_id,
68 const std::string& launch_id,
68 ChromeLauncherController* controller) { 69 ChromeLauncherController* controller) {
69 if (app_id == ArcSupportHost::kHostAppId || app_id == arc::kPlayStoreAppId) 70 if (app_id == ArcSupportHost::kHostAppId || app_id == arc::kPlayStoreAppId)
70 return new ArcPlaystoreShortcutLauncherItemController(controller); 71 return new ArcPlaystoreShortcutLauncherItemController(controller);
71 return new AppShortcutLauncherItemController(app_id, controller); 72 return new AppShortcutLauncherItemController(app_id, launch_id, controller);
72 } 73 }
73 74
74 // Item controller for an app shortcut. Shortcuts track app and launcher ids, 75 // Item controller for an app shortcut. Shortcuts track app and launcher ids,
75 // but do not have any associated windows (opening a shortcut will replace the 76 // but do not have any associated windows (opening a shortcut will replace the
76 // item with the appropriate LauncherItemController type). 77 // item with the appropriate LauncherItemController type).
77 AppShortcutLauncherItemController::AppShortcutLauncherItemController( 78 AppShortcutLauncherItemController::AppShortcutLauncherItemController(
78 const std::string& app_id, 79 const std::string& app_id,
80 const std::string& launch_id,
79 ChromeLauncherController* controller) 81 ChromeLauncherController* controller)
80 : LauncherItemController(TYPE_SHORTCUT, app_id, controller), 82 : LauncherItemController(TYPE_SHORTCUT, app_id, launch_id, controller),
81 chrome_launcher_controller_(controller) { 83 chrome_launcher_controller_(controller),
84 app_id_(app_id),
85 launch_id_(launch_id) {
82 // To detect V1 applications we use their domain and match them against the 86 // To detect V1 applications we use their domain and match them against the
83 // used URL. This will also work with applications like Google Drive. 87 // used URL. This will also work with applications like Google Drive.
84 const Extension* extension = 88 const Extension* extension =
85 GetExtensionForAppID(app_id, controller->GetProfile()); 89 GetExtensionForAppID(app_id, controller->GetProfile());
86 // Some unit tests have no real extension. 90 // Some unit tests have no real extension.
87 if (extension) { 91 if (extension) {
88 set_refocus_url(GURL( 92 set_refocus_url(GURL(
89 extensions::AppLaunchInfo::GetLaunchWebURL(extension).spec() + "*")); 93 extensions::AppLaunchInfo::GetLaunchWebURL(extension).spec() + "*"));
90 } 94 }
91 } 95 }
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 379
376 bool AppShortcutLauncherItemController::AllowNextLaunchAttempt() { 380 bool AppShortcutLauncherItemController::AllowNextLaunchAttempt() {
377 if (last_launch_attempt_.is_null() || 381 if (last_launch_attempt_.is_null() ||
378 last_launch_attempt_ + base::TimeDelta::FromMilliseconds( 382 last_launch_attempt_ + base::TimeDelta::FromMilliseconds(
379 kClickSuppressionInMS) < base::Time::Now()) { 383 kClickSuppressionInMS) < base::Time::Now()) {
380 last_launch_attempt_ = base::Time::Now(); 384 last_launch_attempt_ = base::Time::Now();
381 return true; 385 return true;
382 } 386 }
383 return false; 387 return false;
384 } 388 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698