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

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

Issue 2739323004: arc: Reactivate OptIn flow on clicking Play Store. (Closed)
Patch Set: TODO added/rebased Created 3 years, 9 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 <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "ash/shell.h" 10 #include "ash/shell.h"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/json/json_writer.h" 12 #include "base/json/json_writer.h"
13 #include "base/synchronization/waitable_event.h" 13 #include "base/synchronization/waitable_event.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "chrome/browser/chromeos/arc/arc_session_manager.h"
15 #include "chrome/browser/chromeos/arc/arc_util.h" 16 #include "chrome/browser/chromeos/arc/arc_util.h"
16 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" 18 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
18 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h" 19 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h"
19 #include "chrome/browser/ui/ash/launcher/arc_app_shelf_id.h" 20 #include "chrome/browser/ui/ash/launcher/arc_app_shelf_id.h"
20 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 21 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
21 #include "chromeos/dbus/dbus_thread_manager.h" 22 #include "chromeos/dbus/dbus_thread_manager.h"
22 #include "chromeos/dbus/session_manager_client.h" 23 #include "chromeos/dbus/session_manager_client.h"
23 #include "components/arc/arc_bridge_service.h" 24 #include "components/arc/arc_bridge_service.h"
24 #include "components/arc/arc_service_manager.h" 25 #include "components/arc/arc_service_manager.h"
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 // deferred launch request when PlayStore item enables Google Play 283 // deferred launch request when PlayStore item enables Google Play
283 // Store. 284 // Store.
284 if (app_id == kPlayStoreAppId) { 285 if (app_id == kPlayStoreAppId) {
285 prefs->SetLastLaunchTime(app_id, base::Time::Now()); 286 prefs->SetLastLaunchTime(app_id, base::Time::Now());
286 return true; 287 return true;
287 } 288 }
288 } else { 289 } else {
289 // Only reachable when ARC always starts. 290 // Only reachable when ARC always starts.
290 DCHECK(arc::ShouldArcAlwaysStart()); 291 DCHECK(arc::ShouldArcAlwaysStart());
291 } 292 }
293 } else {
294 // Handle the case when default app tries to re-activate OptIn flow.
295 if (IsArcPlayStoreEnabledPreferenceManagedForProfile(profile) &&
296 !ArcSessionManager::Get()->enable_requested() &&
297 prefs->IsDefault(app_id)) {
298 SetArcPlayStoreEnabledForProfile(profile, true);
299 // PlayStore item has special handling for shelf controllers. In order
300 // to avoid unwanted initial animation for PlayStore item do not create
301 // deferred launch request when PlayStore item enables Google Play
302 // Store.
303 if (app_id == kPlayStoreAppId) {
304 prefs->SetLastLaunchTime(app_id, base::Time::Now());
305 return true;
306 }
307 }
292 } 308 }
293 309
294 ChromeLauncherController* chrome_controller = 310 ChromeLauncherController* chrome_controller =
295 ChromeLauncherController::instance(); 311 ChromeLauncherController::instance();
296 DCHECK(chrome_controller || !ash::Shell::HasInstance()); 312 DCHECK(chrome_controller || !ash::Shell::HasInstance());
297 if (chrome_controller) { 313 if (chrome_controller) {
298 chrome_controller->GetArcDeferredLauncher()->RegisterDeferredLaunch( 314 chrome_controller->GetArcDeferredLauncher()->RegisterDeferredLaunch(
299 app_id, event_flags); 315 app_id, event_flags);
300 316
301 // On some boards, ARC is booted with a restricted set of resources by 317 // On some boards, ARC is booted with a restricted set of resources by
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 return false; 453 return false;
438 454
439 const ArcAppListPrefs* const arc_prefs = ArcAppListPrefs::Get(context); 455 const ArcAppListPrefs* const arc_prefs = ArcAppListPrefs::Get(context);
440 if (!arc_prefs) 456 if (!arc_prefs)
441 return false; 457 return false;
442 458
443 return arc_prefs->IsRegistered(ArcAppShelfId::FromString(id).app_id()); 459 return arc_prefs->IsRegistered(ArcAppShelfId::FromString(id).app_id());
444 } 460 }
445 461
446 } // namespace arc 462 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698