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

Side by Side Diff: chrome/browser/chromeos/extensions/wallpaper_manager_util.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 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/chromeos/extensions/wallpaper_manager_util.h" 5 #include "chrome/browser/chromeos/extensions/wallpaper_manager_util.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "chrome/browser/chromeos/arc/arc_session_manager.h" 10 #include "chrome/browser/chromeos/arc/arc_util.h"
11 #include "chrome/browser/chromeos/profiles/profile_helper.h" 11 #include "chrome/browser/chromeos/profiles/profile_helper.h"
12 #include "chrome/browser/extensions/extension_service.h" 12 #include "chrome/browser/extensions/extension_service.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/profiles/profile_manager.h" 14 #include "chrome/browser/profiles/profile_manager.h"
15 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" 15 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
16 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" 16 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
17 #include "chrome/browser/ui/extensions/app_launch_params.h" 17 #include "chrome/browser/ui/extensions/app_launch_params.h"
18 #include "chrome/browser/ui/extensions/application_launch.h" 18 #include "chrome/browser/ui/extensions/application_launch.h"
19 #include "chrome/common/extensions/extension_constants.h" 19 #include "chrome/common/extensions/extension_constants.h"
20 #include "chromeos/chromeos_switches.h" 20 #include "chromeos/chromeos_switches.h"
(...skipping 18 matching lines...) Expand all
39 } // namespace 39 } // namespace
40 40
41 // Only if the current profile is the primary profile && ARC service is enabled 41 // Only if the current profile is the primary profile && ARC service is enabled
42 // && the Android Wallpapers App has been installed && the finch experiment or 42 // && the Android Wallpapers App has been installed && the finch experiment or
43 // chrome flag is enabled, launch the Android Wallpapers App. Otherwise launch 43 // chrome flag is enabled, launch the Android Wallpapers App. Otherwise launch
44 // the old Chrome OS Wallpaper Picker App. 44 // the old Chrome OS Wallpaper Picker App.
45 bool ShouldUseAndroidWallpapersApp(Profile* profile) { 45 bool ShouldUseAndroidWallpapersApp(Profile* profile) {
46 if (!chromeos::ProfileHelper::IsPrimaryProfile(profile)) 46 if (!chromeos::ProfileHelper::IsPrimaryProfile(profile))
47 return false; 47 return false;
48 48
49 // Check if the ARC is enabled. 49 // Check if the Google Play Store is enabled.
50 const arc::ArcSessionManager* const arc_session_manager = 50 if (!arc::IsArcPlayStoreEnabledForProfile(profile))
51 arc::ArcSessionManager::Get();
52 if (!arc_session_manager || !arc_session_manager->IsArcPlayStoreEnabled())
53 return false; 51 return false;
54 52
55 // Check if Android Wallpapers App has been installed. 53 // Check if Android Wallpapers App has been installed.
56 const ArcAppListPrefs* const prefs = ArcAppListPrefs::Get(profile); 54 const ArcAppListPrefs* const prefs = ArcAppListPrefs::Get(profile);
57 if (!prefs || prefs->GetAppsForPackage(kAndroidWallpapersAppPackage).empty()) 55 if (!prefs || prefs->GetAppsForPackage(kAndroidWallpapersAppPackage).empty())
58 return false; 56 return false;
59 57
60 // Check if the finch experiment or the chrome flag is enabled. 58 // Check if the finch experiment or the chrome flag is enabled.
61 if (base::FieldTrialList::FindFullName(kAndroidWallpapersAppTrialName) != 59 if (base::FieldTrialList::FindFullName(kAndroidWallpapersAppTrialName) !=
62 kEnableAndroidWallpapersApp && 60 kEnableAndroidWallpapersApp &&
(...skipping 24 matching lines...) Expand all
87 if (!extension) 85 if (!extension)
88 return; 86 return;
89 87
90 OpenApplication(AppLaunchParams( 88 OpenApplication(AppLaunchParams(
91 profile, extension, extensions::LAUNCH_CONTAINER_WINDOW, 89 profile, extension, extensions::LAUNCH_CONTAINER_WINDOW,
92 WindowOpenDisposition::NEW_WINDOW, extensions::SOURCE_CHROME_INTERNAL)); 90 WindowOpenDisposition::NEW_WINDOW, extensions::SOURCE_CHROME_INTERNAL));
93 } 91 }
94 } 92 }
95 93
96 } // namespace wallpaper_manager_util 94 } // namespace wallpaper_manager_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698