| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/chromeos/arc/arc_session_manager.h" | 5 #include "chrome/browser/chromeos/arc/arc_session_manager.h" |
| 6 #include "chrome/browser/chromeos/arc/arc_support_host.h" | 6 #include "chrome/browser/chromeos/arc/arc_support_host.h" |
| 7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/ui/app_list/arc/arc_app_launcher.h" | 8 #include "chrome/browser/ui/app_list/arc/arc_app_launcher.h" |
| 9 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 9 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| 10 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" | 10 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" |
| 11 #include "chrome/browser/ui/ash/launcher/arc_playstore_shortcut_launcher_item_co
ntroller.h" | 11 #include "chrome/browser/ui/ash/launcher/arc_playstore_shortcut_launcher_item_co
ntroller.h" |
| 12 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 12 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 13 | 13 |
| 14 ArcPlaystoreShortcutLauncherItemController:: | 14 ArcPlaystoreShortcutLauncherItemController:: |
| 15 ArcPlaystoreShortcutLauncherItemController( | 15 ArcPlaystoreShortcutLauncherItemController( |
| 16 ChromeLauncherController* controller) | 16 ChromeLauncherController* controller) |
| 17 : AppShortcutLauncherItemController(ArcSupportHost::kHostAppId, | 17 : AppShortcutLauncherItemController(ArcSupportHost::kHostAppId, |
| 18 "", | 18 "", |
| 19 controller) {} | 19 controller) {} |
| 20 | 20 |
| 21 ArcPlaystoreShortcutLauncherItemController:: | 21 ArcPlaystoreShortcutLauncherItemController:: |
| 22 ~ArcPlaystoreShortcutLauncherItemController() {} | 22 ~ArcPlaystoreShortcutLauncherItemController() {} |
| 23 | 23 |
| 24 ash::ShelfItemDelegate::PerformedAction | 24 ash::ShelfAction ArcPlaystoreShortcutLauncherItemController::ItemSelected( |
| 25 ArcPlaystoreShortcutLauncherItemController::Activate(ash::LaunchSource source) { | 25 ui::EventType event_type, |
| 26 int event_flags, |
| 27 int64_t display_id, |
| 28 ash::ShelfLaunchSource source) { |
| 26 arc::ArcSessionManager* arc_session_manager = arc::ArcSessionManager::Get(); | 29 arc::ArcSessionManager* arc_session_manager = arc::ArcSessionManager::Get(); |
| 27 DCHECK(arc_session_manager); | 30 DCHECK(arc_session_manager); |
| 28 DCHECK(arc_session_manager->IsAllowed()); | 31 DCHECK(arc_session_manager->IsAllowed()); |
| 29 | 32 |
| 30 ArcAppListPrefs* arc_app_prefs = | 33 ArcAppListPrefs* arc_app_prefs = |
| 31 ArcAppListPrefs::Get(controller()->profile()); | 34 ArcAppListPrefs::Get(controller()->profile()); |
| 32 DCHECK(arc_app_prefs); | 35 DCHECK(arc_app_prefs); |
| 33 | 36 |
| 34 const bool arc_was_enabled = arc_session_manager->IsArcEnabled(); | 37 const bool arc_was_enabled = arc_session_manager->IsArcEnabled(); |
| 35 arc_session_manager->EnableArc(); | 38 arc_session_manager->EnableArc(); |
| 36 | 39 |
| 37 // Deferred launcher. | 40 // Deferred launcher. |
| 38 if (arc_app_prefs->IsRegistered(arc::kPlayStoreAppId) && arc_was_enabled) { | 41 if (arc_app_prefs->IsRegistered(arc::kPlayStoreAppId) && arc_was_enabled) { |
| 39 // Known apps can be launched directly or deferred. | 42 // Known apps can be launched directly or deferred. |
| 40 arc::LaunchApp(controller()->profile(), arc::kPlayStoreAppId, true); | 43 arc::LaunchApp(controller()->profile(), arc::kPlayStoreAppId, true); |
| 41 } else { | 44 } else { |
| 42 // Launch Play Store once its app appears. | 45 // Launch Play Store once its app appears. |
| 43 playstore_launcher_.reset(new ArcAppLauncher(controller()->profile(), | 46 playstore_launcher_.reset(new ArcAppLauncher(controller()->profile(), |
| 44 arc::kPlayStoreAppId, true)); | 47 arc::kPlayStoreAppId, true)); |
| 45 } | 48 } |
| 46 | 49 |
| 47 return kNoAction; | 50 return ash::kNoAction; |
| 48 } | 51 } |
| OLD | NEW |