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

Side by Side Diff: chrome/browser/ui/app_list/arc/arc_app_utils.cc

Issue 2308643002: arc: Make Play Store item persistent in app list. (Closed)
Patch Set: cleanup Created 4 years, 3 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 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/ui/app_list/arc/arc_app_utils.h" 5 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // Now that we are done, we can delete ourselves. 156 // Now that we are done, we can delete ourselves.
157 delete this; 157 delete this;
158 } 158 }
159 159
160 DISALLOW_COPY_AND_ASSIGN(LaunchAppWithoutSize); 160 DISALLOW_COPY_AND_ASSIGN(LaunchAppWithoutSize);
161 }; 161 };
162 162
163 } // namespace 163 } // namespace
164 164
165 const char kPlayStoreAppId[] = "gpkmicpkkebkmabiaedjognfppcchdfa"; 165 const char kPlayStoreAppId[] = "gpkmicpkkebkmabiaedjognfppcchdfa";
166 const char kPlayStorePackage[] = "com.android.vending";
167 const char kPlayStoreActivity[] = "com.android.vending.AssetBrowserActivity";
166 const char kSettingsAppId[] = "mconboelelhjpkbdhhiijkgcimoangdj"; 168 const char kSettingsAppId[] = "mconboelelhjpkbdhhiijkgcimoangdj";
167 169
168 bool ShouldShowInLauncher(const std::string& app_id) { 170 bool ShouldShowInLauncher(const std::string& app_id) {
169 return (app_id != kSettingsAppId); 171 return (app_id != kSettingsAppId);
170 } 172 }
171 173
172 bool LaunchAppWithRect(content::BrowserContext* context, 174 bool LaunchAppWithRect(content::BrowserContext* context,
173 const std::string& app_id, 175 const std::string& app_id,
174 const gfx::Rect& target_rect) { 176 const gfx::Rect& target_rect) {
175 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(context); 177 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(context);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 return arc::LaunchApp(context, kSettingsAppId, kUseLandscapeLayout); 214 return arc::LaunchApp(context, kSettingsAppId, kUseLandscapeLayout);
213 } 215 }
214 216
215 bool LaunchApp(content::BrowserContext* context, const std::string& app_id) { 217 bool LaunchApp(content::BrowserContext* context, const std::string& app_id) {
216 return LaunchApp(context, app_id, true); 218 return LaunchApp(context, app_id, true);
217 } 219 }
218 220
219 bool LaunchApp(content::BrowserContext* context, 221 bool LaunchApp(content::BrowserContext* context,
220 const std::string& app_id, 222 const std::string& app_id,
221 bool landscape_layout) { 223 bool landscape_layout) {
222 const ArcAppListPrefs* prefs = ArcAppListPrefs::Get(context); 224 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(context);
223 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(app_id); 225 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(app_id);
224 if (app_info && !app_info->ready) { 226 if (app_info && !app_info->ready) {
225 if (!ash::Shell::HasInstance()) 227 if (!ash::Shell::HasInstance())
226 return false; 228 return false;
227 229
228 ArcAuthService* auth_service = ArcAuthService::Get(); 230 ArcAuthService* auth_service = ArcAuthService::Get();
229 DCHECK(auth_service); 231 DCHECK(auth_service);
230 232
231 if (!auth_service->IsArcEnabled()) { 233 if (!auth_service->IsArcEnabled()) {
232 if (!prefs->IsDefault(app_id)) { 234 if (!prefs->IsDefault(app_id)) {
233 NOTREACHED(); 235 NOTREACHED();
234 return false; 236 return false;
235 } 237 }
236 238
237 auth_service->EnableArc(); 239 auth_service->EnableArc();
238 if (!auth_service->IsArcEnabled()) { 240 if (!auth_service->IsArcEnabled()) {
239 NOTREACHED(); 241 NOTREACHED();
240 return false; 242 return false;
241 } 243 }
242 } 244 }
243 245
244 ChromeLauncherController* chrome_controller = 246 // PlayStore is automatically opened on sing in completed.
xiyuan 2016/09/06 21:24:46 nit: sing -> sign
khmel 2016/09/06 23:11:59 Done.
245 ChromeLauncherController::instance(); 247 if (app_id != kPlayStoreAppId) {
xiyuan 2016/09/06 21:24:46 What happens if arc is enabled (i.e. no opt-in nee
khmel 2016/09/06 23:11:59 Good point, I reduced check condition. (Making Pla
246 DCHECK(chrome_controller); 248 ChromeLauncherController* chrome_controller =
247 chrome_controller->GetArcDeferredLauncher()->RegisterDeferredLaunch(app_id); 249 ChromeLauncherController::instance();
250 DCHECK(chrome_controller);
251 chrome_controller->GetArcDeferredLauncher()->RegisterDeferredLaunch(
252 app_id);
253 }
254 prefs->SetLastLaunchTime(app_id, base::Time::Now());
248 return true; 255 return true;
249 } 256 }
250 257
251 return (new LaunchAppWithoutSize(context, app_id, landscape_layout)) 258 return (new LaunchAppWithoutSize(context, app_id, landscape_layout))
252 ->LaunchAndRelease(); 259 ->LaunchAndRelease();
253 } 260 }
254 261
255 void SetTaskActive(int task_id) { 262 void SetTaskActive(int task_id) {
256 arc::mojom::AppInstance* app_instance = 263 arc::mojom::AppInstance* app_instance =
257 GetAppInstance(kTaskSupportMinVersion, kSetActiveTaskStr); 264 GetAppInstance(kTaskSupportMinVersion, kSetActiveTaskStr);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 if (!app_instance) 368 if (!app_instance)
362 return false; 369 return false;
363 370
364 app_instance->ShowPackageInfoOnPage( 371 app_instance->ShowPackageInfoOnPage(
365 package_name, page, 372 package_name, page,
366 GetTargetRect(gfx::Size(kNexus7Width, kNexus7Height))); 373 GetTargetRect(gfx::Size(kNexus7Width, kNexus7Height)));
367 return true; 374 return true;
368 } 375 }
369 376
370 } // namespace arc 377 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/arc/arc_app_utils.h ('k') | chrome/browser/ui/app_list/arc/arc_default_app_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698