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

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

Issue 2707133006: Start ARC and sign in after Chrome OS login (Closed)
Patch Set: test coverage in chrome_launcher_controller_impl_unittest.cc 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/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" 16 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
17 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h" 17 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h"
18 #include "chrome/browser/ui/ash/launcher/arc_app_shelf_id.h" 18 #include "chrome/browser/ui/ash/launcher/arc_app_shelf_id.h"
19 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 19 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
20 #include "chromeos/dbus/dbus_thread_manager.h" 20 #include "chromeos/dbus/dbus_thread_manager.h"
21 #include "chromeos/dbus/session_manager_client.h" 21 #include "chromeos/dbus/session_manager_client.h"
22 #include "components/arc/arc_bridge_service.h" 22 #include "components/arc/arc_bridge_service.h"
23 #include "components/arc/arc_service_manager.h" 23 #include "components/arc/arc_service_manager.h"
24 #include "components/arc/arc_util.h"
24 #include "components/arc/common/intent_helper.mojom.h" 25 #include "components/arc/common/intent_helper.mojom.h"
25 #include "ui/aura/window.h" 26 #include "ui/aura/window.h"
26 #include "ui/display/display.h" 27 #include "ui/display/display.h"
27 #include "ui/display/screen.h" 28 #include "ui/display/screen.h"
28 #include "ui/events/event_constants.h" 29 #include "ui/events/event_constants.h"
29 30
30 // Helper macro which returns the AppInstance. 31 // Helper macro which returns the AppInstance.
31 #define GET_APP_INSTANCE(method_name) \ 32 #define GET_APP_INSTANCE(method_name) \
32 (arc::ArcServiceManager::Get() \ 33 (arc::ArcServiceManager::Get() \
33 ? ARC_GET_INSTANCE_FOR_METHOD( \ 34 ? ARC_GET_INSTANCE_FOR_METHOD( \
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 bool landscape_layout, 264 bool landscape_layout,
264 int event_flags) { 265 int event_flags) {
265 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(context); 266 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(context);
266 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(app_id); 267 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(app_id);
267 if (app_info && !app_info->ready) { 268 if (app_info && !app_info->ready) {
268 ArcSessionManager* arc_session_manager = ArcSessionManager::Get(); 269 ArcSessionManager* arc_session_manager = ArcSessionManager::Get();
269 DCHECK(arc_session_manager); 270 DCHECK(arc_session_manager);
270 271
271 bool arc_activated = false; 272 bool arc_activated = false;
272 if (!arc_session_manager->IsArcPlayStoreEnabled()) { 273 if (!arc_session_manager->IsArcPlayStoreEnabled()) {
273 if (!prefs->IsDefault(app_id)) { 274 if (prefs->IsDefault(app_id)) {
274 NOTREACHED(); 275 arc_session_manager->SetArcPlayStoreEnabled(true);
275 return false; 276 if (!arc_session_manager->IsArcPlayStoreEnabled()) {
277 NOTREACHED();
278 return false;
279 }
280 arc_activated = true;
281 } else {
282 if (arc::ShouldAlwaysStartArc()) {
283 arc_activated = true;
284 } else {
285 NOTREACHED();
286 return false;
287 }
276 } 288 }
277
278 arc_session_manager->SetArcPlayStoreEnabled(true);
279 if (!arc_session_manager->IsArcPlayStoreEnabled()) {
280 NOTREACHED();
281 return false;
282 }
283 arc_activated = true;
284 } 289 }
285 290
286 // PlayStore item has special handling for shelf controllers. In order to 291 // PlayStore item has special handling for shelf controllers. In order to
287 // avoid unwanted initial animation for PlayStore item do not create 292 // avoid unwanted initial animation for PlayStore item do not create
288 // deferred launch request when PlayStore item enables ARC. 293 // deferred launch request when PlayStore item enables ARC.
289 if (!arc_activated || app_id != kPlayStoreAppId) { 294 if (!arc_activated || app_id != kPlayStoreAppId) {
290 ChromeLauncherController* chrome_controller = 295 ChromeLauncherController* chrome_controller =
291 ChromeLauncherController::instance(); 296 ChromeLauncherController::instance();
292 DCHECK(chrome_controller || !ash::Shell::HasInstance()); 297 DCHECK(chrome_controller || !ash::Shell::HasInstance());
293 if (chrome_controller) { 298 if (chrome_controller) {
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 return false; 440 return false;
436 441
437 const ArcAppListPrefs* const arc_prefs = ArcAppListPrefs::Get(context); 442 const ArcAppListPrefs* const arc_prefs = ArcAppListPrefs::Get(context);
438 if (!arc_prefs) 443 if (!arc_prefs)
439 return false; 444 return false;
440 445
441 return arc_prefs->IsRegistered(ArcAppShelfId::FromString(id).app_id()); 446 return arc_prefs->IsRegistered(ArcAppShelfId::FromString(id).app_id());
442 } 447 }
443 448
444 } // namespace arc 449 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698