| 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/extensions/launch_util.h" | 11 #include "chrome/browser/extensions/launch_util.h" | 
|  | 12 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" | 
|  | 13 #include "chrome/browser/ui/ash/launcher/arc_playstore_shortcut_launcher_item_co
     ntroller.h" | 
| 11 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h" | 14 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h" | 
| 12 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.h" | 15 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.h" | 
| 13 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 16 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 
| 14 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" | 17 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" | 
| 15 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" | 18 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" | 
| 16 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" | 19 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" | 
| 17 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" | 20 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" | 
| 18 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 21 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 
| 19 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 22 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 
| 20 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" | 
| (...skipping 30 matching lines...) Expand all  Loading... | 
| 51 bool CanBrowserBeUsedForDirectActivation(Browser* browser, | 54 bool CanBrowserBeUsedForDirectActivation(Browser* browser, | 
| 52                                          ChromeLauncherController* launcher) { | 55                                          ChromeLauncherController* launcher) { | 
| 53   if (chrome::MultiUserWindowManager::GetMultiProfileMode() == | 56   if (chrome::MultiUserWindowManager::GetMultiProfileMode() == | 
| 54           chrome::MultiUserWindowManager::MULTI_PROFILE_MODE_OFF) | 57           chrome::MultiUserWindowManager::MULTI_PROFILE_MODE_OFF) | 
| 55     return true; | 58     return true; | 
| 56   return multi_user_util::IsProfileFromActiveUser(browser->profile()); | 59   return multi_user_util::IsProfileFromActiveUser(browser->profile()); | 
| 57 } | 60 } | 
| 58 | 61 | 
| 59 }  // namespace | 62 }  // namespace | 
| 60 | 63 | 
|  | 64 // static | 
|  | 65 AppShortcutLauncherItemController* AppShortcutLauncherItemController::Create( | 
|  | 66     const std::string& app_id, | 
|  | 67     ChromeLauncherController* controller) { | 
|  | 68   if (app_id == ArcSupportHost::kHostAppId || app_id == arc::kPlayStoreAppId) | 
|  | 69     return new ArcPlaystoreShortcutLauncherItemController(controller); | 
|  | 70   return new AppShortcutLauncherItemController(app_id, controller); | 
|  | 71 } | 
|  | 72 | 
| 61 // Item controller for an app shortcut. Shortcuts track app and launcher ids, | 73 // Item controller for an app shortcut. Shortcuts track app and launcher ids, | 
| 62 // but do not have any associated windows (opening a shortcut will replace the | 74 // but do not have any associated windows (opening a shortcut will replace the | 
| 63 // item with the appropriate LauncherItemController type). | 75 // item with the appropriate LauncherItemController type). | 
| 64 AppShortcutLauncherItemController::AppShortcutLauncherItemController( | 76 AppShortcutLauncherItemController::AppShortcutLauncherItemController( | 
| 65     const std::string& app_id, | 77     const std::string& app_id, | 
| 66     ChromeLauncherController* controller) | 78     ChromeLauncherController* controller) | 
| 67     : LauncherItemController(TYPE_SHORTCUT, app_id, controller), | 79     : LauncherItemController(TYPE_SHORTCUT, app_id, controller), | 
| 68       chrome_launcher_controller_(controller) { | 80       chrome_launcher_controller_(controller) { | 
| 69   // To detect V1 applications we use their domain and match them against the | 81   // To detect V1 applications we use their domain and match them against the | 
| 70   // used URL. This will also work with applications like Google Drive. | 82   // used URL. This will also work with applications like Google Drive. | 
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 362 | 374 | 
| 363 bool AppShortcutLauncherItemController::AllowNextLaunchAttempt() { | 375 bool AppShortcutLauncherItemController::AllowNextLaunchAttempt() { | 
| 364   if (last_launch_attempt_.is_null() || | 376   if (last_launch_attempt_.is_null() || | 
| 365       last_launch_attempt_ + base::TimeDelta::FromMilliseconds( | 377       last_launch_attempt_ + base::TimeDelta::FromMilliseconds( | 
| 366           kClickSuppressionInMS) < base::Time::Now()) { | 378           kClickSuppressionInMS) < base::Time::Now()) { | 
| 367     last_launch_attempt_ = base::Time::Now(); | 379     last_launch_attempt_ = base::Time::Now(); | 
| 368     return true; | 380     return true; | 
| 369   } | 381   } | 
| 370   return false; | 382   return false; | 
| 371 } | 383 } | 
| OLD | NEW | 
|---|