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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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& app_shelf_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, app_shelf_id, |
73 controller); | |
72 } | 74 } |
73 | 75 |
74 // Item controller for an app shortcut. Shortcuts track app and launcher ids, | 76 // 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 | 77 // but do not have any associated windows (opening a shortcut will replace the |
76 // item with the appropriate LauncherItemController type). | 78 // item with the appropriate LauncherItemController type). |
77 AppShortcutLauncherItemController::AppShortcutLauncherItemController( | 79 AppShortcutLauncherItemController::AppShortcutLauncherItemController( |
78 const std::string& app_id, | 80 const std::string& app_id, |
81 const std::string& app_shelf_id, | |
79 ChromeLauncherController* controller) | 82 ChromeLauncherController* controller) |
80 : LauncherItemController(TYPE_SHORTCUT, app_id, controller), | 83 : LauncherItemController(TYPE_SHORTCUT, app_id, controller), |
81 chrome_launcher_controller_(controller) { | 84 chrome_launcher_controller_(controller), |
85 app_id_(app_id), | |
86 app_shelf_id_(app_shelf_id) { | |
stevenjb
2016/08/29 15:56:30
These appear to be unused?
Andra Paraschiv
2016/08/30 09:58:24
They are currently used in the GetShelfIDForAppIDA
stevenjb
2016/08/30 16:12:51
Right, sorry, I was confused by the multiple meani
| |
82 // To detect V1 applications we use their domain and match them against the | 87 // 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. | 88 // used URL. This will also work with applications like Google Drive. |
84 const Extension* extension = | 89 const Extension* extension = |
85 GetExtensionForAppID(app_id, controller->GetProfile()); | 90 GetExtensionForAppID(app_id, controller->GetProfile()); |
86 // Some unit tests have no real extension. | 91 // Some unit tests have no real extension. |
87 if (extension) { | 92 if (extension) { |
88 set_refocus_url(GURL( | 93 set_refocus_url(GURL( |
89 extensions::AppLaunchInfo::GetLaunchWebURL(extension).spec() + "*")); | 94 extensions::AppLaunchInfo::GetLaunchWebURL(extension).spec() + "*")); |
90 } | 95 } |
91 } | 96 } |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
375 | 380 |
376 bool AppShortcutLauncherItemController::AllowNextLaunchAttempt() { | 381 bool AppShortcutLauncherItemController::AllowNextLaunchAttempt() { |
377 if (last_launch_attempt_.is_null() || | 382 if (last_launch_attempt_.is_null() || |
378 last_launch_attempt_ + base::TimeDelta::FromMilliseconds( | 383 last_launch_attempt_ + base::TimeDelta::FromMilliseconds( |
379 kClickSuppressionInMS) < base::Time::Now()) { | 384 kClickSuppressionInMS) < base::Time::Now()) { |
380 last_launch_attempt_ = base::Time::Now(); | 385 last_launch_attempt_ = base::Time::Now(); |
381 return true; | 386 return true; |
382 } | 387 } |
383 return false; | 388 return false; |
384 } | 389 } |
OLD | NEW |