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

Side by Side Diff: chrome/browser/chromeos/arc/arc_session_manager.cc

Issue 2709393003: Split ArcAuthNotification UI control flag from ArcSessionManager. (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
« no previous file with comments | « chrome/browser/chromeos/arc/arc_auth_notification.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/chromeos/arc/arc_session_manager.h" 5 #include "chrome/browser/chromeos/arc/arc_session_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/common/shelf/shelf_delegate.h" 9 #include "ash/common/shelf/shelf_delegate.h"
10 #include "ash/common/wm_shell.h" 10 #include "ash/common/wm_shell.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 chromeos::switches::kEnableArcOOBEOptIn)) 136 chromeos::switches::kEnableArcOOBEOptIn))
137 return false; 137 return false;
138 if (!chromeos::LoginDisplayHost::default_host()) 138 if (!chromeos::LoginDisplayHost::default_host())
139 return false; 139 return false;
140 return true; 140 return true;
141 } 141 }
142 142
143 // static 143 // static
144 void ArcSessionManager::DisableUIForTesting() { 144 void ArcSessionManager::DisableUIForTesting() {
145 g_disable_ui_for_testing = true; 145 g_disable_ui_for_testing = true;
146 // TODO(hidehiko): When the dependency to ArcAuthNotification from this
147 // class is removed, we should remove this as well.
148 ArcAuthNotification::DisableForTesting();
146 } 149 }
147 150
148 // static 151 // static
149 void ArcSessionManager::SetShelfDelegateForTesting( 152 void ArcSessionManager::SetShelfDelegateForTesting(
150 ash::ShelfDelegate* shelf_delegate) { 153 ash::ShelfDelegate* shelf_delegate) {
151 g_shelf_delegate_for_testing = shelf_delegate; 154 g_shelf_delegate_for_testing = shelf_delegate;
152 } 155 }
153 156
154 // static 157 // static
155 void ArcSessionManager::EnableCheckAndroidManagementForTesting() { 158 void ArcSessionManager::EnableCheckAndroidManagementForTesting() {
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 } 465 }
463 } 466 }
464 467
465 void ArcSessionManager::OnIsSyncingChanged() { 468 void ArcSessionManager::OnIsSyncingChanged() {
466 sync_preferences::PrefServiceSyncable* const pref_service_syncable = 469 sync_preferences::PrefServiceSyncable* const pref_service_syncable =
467 PrefServiceSyncableFromProfile(profile_); 470 PrefServiceSyncableFromProfile(profile_);
468 if (!pref_service_syncable->IsSyncing()) 471 if (!pref_service_syncable->IsSyncing())
469 return; 472 return;
470 473
471 pref_service_syncable->RemoveObserver(this); 474 pref_service_syncable->RemoveObserver(this);
472 if (!g_disable_ui_for_testing && 475 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
473 !base::CommandLine::ForCurrentProcess()->HasSwitch(
474 chromeos::switches::kEnableArcOOBEOptIn) && 476 chromeos::switches::kEnableArcOOBEOptIn) &&
475 profile_->IsNewProfile() && 477 profile_->IsNewProfile() &&
476 !profile_->GetPrefs()->HasPrefPath(prefs::kArcEnabled)) { 478 !profile_->GetPrefs()->HasPrefPath(prefs::kArcEnabled)) {
477 ArcAuthNotification::Show(profile_); 479 ArcAuthNotification::Show(profile_);
478 } 480 }
479 } 481 }
480 482
481 void ArcSessionManager::Shutdown() { 483 void ArcSessionManager::Shutdown() {
482 if (!g_disable_ui_for_testing) 484 ArcAuthNotification::Hide();
483 ArcAuthNotification::Hide();
484 485
485 enable_requested_ = false; 486 enable_requested_ = false;
486 ShutdownSession(); 487 ShutdownSession();
487 if (support_host_) { 488 if (support_host_) {
488 support_host_->Close(); 489 support_host_->Close();
489 support_host_->RemoveObserver(this); 490 support_host_->RemoveObserver(this);
490 support_host_.reset(); 491 support_host_.reset();
491 } 492 }
492 if (profile_) { 493 if (profile_) {
493 sync_preferences::PrefServiceSyncable* pref_service_syncable = 494 sync_preferences::PrefServiceSyncable* pref_service_syncable =
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 if (shelf_delegate) 531 if (shelf_delegate)
531 shelf_delegate->UnpinAppWithID(ArcSupportHost::kHostAppId); 532 shelf_delegate->UnpinAppWithID(ArcSupportHost::kHostAppId);
532 } 533 }
533 } 534 }
534 535
535 if (support_host_) 536 if (support_host_)
536 support_host_->SetArcManaged(is_play_store_managed); 537 support_host_->SetArcManaged(is_play_store_managed);
537 538
538 // Hide auth notification if it was opened before and arc.enabled pref was 539 // Hide auth notification if it was opened before and arc.enabled pref was
539 // explicitly set to true or false. 540 // explicitly set to true or false.
540 if (!g_disable_ui_for_testing && 541 if (profile_->GetPrefs()->HasPrefPath(prefs::kArcEnabled))
541 profile_->GetPrefs()->HasPrefPath(prefs::kArcEnabled)) {
542 ArcAuthNotification::Hide(); 542 ArcAuthNotification::Hide();
543 }
544 543
545 if (is_play_store_enabled) 544 if (is_play_store_enabled)
546 RequestEnable(); 545 RequestEnable();
547 else 546 else
548 RequestDisable(); 547 RequestDisable();
549 548
550 for (auto& observer : observer_list_) 549 for (auto& observer : observer_list_)
551 observer.OnArcPlayStoreEnabledChanged(is_play_store_enabled); 550 observer.OnArcPlayStoreEnabledChanged(is_play_store_enabled);
552 } 551 }
553 552
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 983
985 #undef MAP_STATE 984 #undef MAP_STATE
986 985
987 // Some compilers report an error even if all values of an enum-class are 986 // Some compilers report an error even if all values of an enum-class are
988 // covered exhaustively in a switch statement. 987 // covered exhaustively in a switch statement.
989 NOTREACHED() << "Invalid value " << static_cast<int>(state); 988 NOTREACHED() << "Invalid value " << static_cast<int>(state);
990 return os; 989 return os;
991 } 990 }
992 991
993 } // namespace arc 992 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/arc/arc_auth_notification.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698