Chromium Code Reviews| 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/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 Loading... | |
| 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 if (app_id == kPlayStoreAppId) { | |
|
Yusuke Sato
2017/03/13 18:05:56
qq: When this can be false? Is it okay to execute
khmel
2017/03/13 19:44:19
Another default app may activate this flow, for ex
Yusuke Sato
2017/03/13 20:08:18
Can you copy the summary of your comment to the co
khmel
2017/03/13 21:42:34
Done.
| |
| 300 prefs->SetLastLaunchTime(app_id, base::Time::Now()); | |
| 301 return true; | |
| 302 } | |
| 303 } | |
| 292 } | 304 } |
| 293 | 305 |
| 294 ChromeLauncherController* chrome_controller = | 306 ChromeLauncherController* chrome_controller = |
| 295 ChromeLauncherController::instance(); | 307 ChromeLauncherController::instance(); |
| 296 DCHECK(chrome_controller || !ash::Shell::HasInstance()); | 308 DCHECK(chrome_controller || !ash::Shell::HasInstance()); |
| 297 if (chrome_controller) { | 309 if (chrome_controller) { |
| 298 chrome_controller->GetArcDeferredLauncher()->RegisterDeferredLaunch( | 310 chrome_controller->GetArcDeferredLauncher()->RegisterDeferredLaunch( |
| 299 app_id, event_flags); | 311 app_id, event_flags); |
| 300 | 312 |
| 301 // On some boards, ARC is booted with a restricted set of resources by | 313 // 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 Loading... | |
| 437 return false; | 449 return false; |
| 438 | 450 |
| 439 const ArcAppListPrefs* const arc_prefs = ArcAppListPrefs::Get(context); | 451 const ArcAppListPrefs* const arc_prefs = ArcAppListPrefs::Get(context); |
| 440 if (!arc_prefs) | 452 if (!arc_prefs) |
| 441 return false; | 453 return false; |
| 442 | 454 |
| 443 return arc_prefs->IsRegistered(ArcAppShelfId::FromString(id).app_id()); | 455 return arc_prefs->IsRegistered(ArcAppShelfId::FromString(id).app_id()); |
| 444 } | 456 } |
| 445 | 457 |
| 446 } // namespace arc | 458 } // namespace arc |
| OLD | NEW |