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

Unified Diff: chrome/browser/ui/ash/launcher/arc_playstore_shortcut_launcher_item_controller.cc

Issue 2702723002: Extract kArcEnabled preference from ArcSessionManager part 1. (Closed)
Patch Set: Address comments. Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/ash/launcher/arc_playstore_shortcut_launcher_item_controller.cc
diff --git a/chrome/browser/ui/ash/launcher/arc_playstore_shortcut_launcher_item_controller.cc b/chrome/browser/ui/ash/launcher/arc_playstore_shortcut_launcher_item_controller.cc
index f0afccabc750f6a8c70139531014e1f02234967f..bd14a6c459aec3c2bd47ab57c53fa1a427643028 100644
--- a/chrome/browser/ui/ash/launcher/arc_playstore_shortcut_launcher_item_controller.cc
+++ b/chrome/browser/ui/ash/launcher/arc_playstore_shortcut_launcher_item_controller.cc
@@ -2,13 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/chromeos/arc/arc_session_manager.h"
+#include "chrome/browser/ui/ash/launcher/arc_playstore_shortcut_launcher_item_controller.h"
+
+#include "base/memory/ptr_util.h"
#include "chrome/browser/chromeos/arc/arc_support_host.h"
+#include "chrome/browser/chromeos/arc/arc_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_list/arc/arc_app_launcher.h"
#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
#include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
-#include "chrome/browser/ui/ash/launcher/arc_playstore_shortcut_launcher_item_controller.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
ArcPlaystoreShortcutLauncherItemController::
@@ -26,25 +28,23 @@ ash::ShelfAction ArcPlaystoreShortcutLauncherItemController::ItemSelected(
int event_flags,
int64_t display_id,
ash::ShelfLaunchSource source) {
- arc::ArcSessionManager* arc_session_manager = arc::ArcSessionManager::Get();
- DCHECK(arc_session_manager);
- DCHECK(arc_session_manager->IsAllowed());
-
- ArcAppListPrefs* arc_app_prefs =
- ArcAppListPrefs::Get(controller()->profile());
+ Profile* profile = controller()->profile();
+ ArcAppListPrefs* arc_app_prefs = ArcAppListPrefs::Get(profile);
DCHECK(arc_app_prefs);
- const bool arc_was_enabled = arc_session_manager->IsArcPlayStoreEnabled();
- arc_session_manager->SetArcPlayStoreEnabled(true);
+ const bool play_store_was_enabled =
+ arc::IsArcPlayStoreEnabledForProfile(profile);
+ arc::SetArcPlayStoreEnabledForProfile(profile, true);
// Deferred launcher.
- if (arc_app_prefs->IsRegistered(arc::kPlayStoreAppId) && arc_was_enabled) {
+ if (arc_app_prefs->IsRegistered(arc::kPlayStoreAppId) &&
+ play_store_was_enabled) {
// Known apps can be launched directly or deferred.
- arc::LaunchApp(controller()->profile(), arc::kPlayStoreAppId, true);
+ arc::LaunchApp(profile, arc::kPlayStoreAppId, true);
} else {
// Launch Play Store once its app appears.
- playstore_launcher_.reset(new ArcAppLauncher(controller()->profile(),
- arc::kPlayStoreAppId, true));
+ playstore_launcher_ =
+ base::MakeUnique<ArcAppLauncher>(profile, arc::kPlayStoreAppId, true);
}
return ash::SHELF_ACTION_NONE;

Powered by Google App Engine
This is Rietveld 408576698