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

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

Issue 2593753002: arc: Restore Arc OptIn notification. (Closed)
Patch Set: Created 4 years 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"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/callback_helpers.h" 12 #include "base/callback_helpers.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "chrome/browser/chromeos/arc/arc_auth_context.h" 17 #include "chrome/browser/chromeos/arc/arc_auth_context.h"
18 #include "chrome/browser/chromeos/arc/arc_auth_notification.h"
18 #include "chrome/browser/chromeos/arc/arc_optin_uma.h" 19 #include "chrome/browser/chromeos/arc/arc_optin_uma.h"
19 #include "chrome/browser/chromeos/arc/arc_support_host.h" 20 #include "chrome/browser/chromeos/arc/arc_support_host.h"
20 #include "chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator.h" 21 #include "chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator.h"
21 #include "chrome/browser/chromeos/arc/policy/arc_android_management_checker.h" 22 #include "chrome/browser/chromeos/arc/policy/arc_android_management_checker.h"
22 #include "chrome/browser/chromeos/arc/policy/arc_policy_util.h" 23 #include "chrome/browser/chromeos/arc/policy/arc_policy_util.h"
23 #include "chrome/browser/chromeos/login/user_flow.h" 24 #include "chrome/browser/chromeos/login/user_flow.h"
24 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" 25 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h"
25 #include "chrome/browser/chromeos/profiles/profile_helper.h" 26 #include "chrome/browser/chromeos/profiles/profile_helper.h"
26 #include "chrome/browser/lifetime/application_lifetime.h" 27 #include "chrome/browser/lifetime/application_lifetime.h"
27 #include "chrome/browser/policy/profile_policy_connector.h" 28 #include "chrome/browser/policy/profile_policy_connector.h"
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 void ArcSessionManager::OnIsSyncingChanged() { 470 void ArcSessionManager::OnIsSyncingChanged() {
470 sync_preferences::PrefServiceSyncable* const pref_service_syncable = 471 sync_preferences::PrefServiceSyncable* const pref_service_syncable =
471 PrefServiceSyncableFromProfile(profile_); 472 PrefServiceSyncableFromProfile(profile_);
472 if (!pref_service_syncable->IsSyncing()) 473 if (!pref_service_syncable->IsSyncing())
473 return; 474 return;
474 475
475 pref_service_syncable->RemoveObserver(this); 476 pref_service_syncable->RemoveObserver(this);
476 477
477 if (IsArcEnabled()) 478 if (IsArcEnabled())
478 OnOptInPreferenceChanged(); 479 OnOptInPreferenceChanged();
480
481 if (!g_disable_ui_for_testing &&
482 !base::CommandLine::ForCurrentProcess()->HasSwitch(
khmel 2016/12/20 18:48:44 New in this CL, don't show notification if Arc OOB
483 chromeos::switches::kEnableArcOOBEOptIn) &&
484 profile_->IsNewProfile() &&
485 !profile_->GetPrefs()->HasPrefPath(prefs::kArcEnabled)) {
486 ArcAuthNotification::Show(profile_);
487 }
479 } 488 }
480 489
481 void ArcSessionManager::Shutdown() { 490 void ArcSessionManager::Shutdown() {
491 if (!g_disable_ui_for_testing)
khmel 2016/12/20 18:48:44 There is no CloseUI equivalent that was in previou
xiyuan 2016/12/20 19:00:06 nit: Do we need this condition? Think we can alway
khmel 2016/12/20 19:13:12 Thank you for pointing this. Agree that there is a
xiyuan 2016/12/20 19:14:23 Acknowledged.
492 ArcAuthNotification::Hide();
493
482 ShutdownBridge(); 494 ShutdownBridge();
483 if (support_host_) { 495 if (support_host_) {
484 support_host_->Close(); 496 support_host_->Close();
485 support_host_->RemoveObserver(this); 497 support_host_->RemoveObserver(this);
486 support_host_.reset(); 498 support_host_.reset();
487 } 499 }
488 if (profile_) { 500 if (profile_) {
489 sync_preferences::PrefServiceSyncable* pref_service_syncable = 501 sync_preferences::PrefServiceSyncable* pref_service_syncable =
490 PrefServiceSyncableFromProfile(profile_); 502 PrefServiceSyncableFromProfile(profile_);
491 pref_service_syncable->RemoveObserver(this); 503 pref_service_syncable->RemoveObserver(this);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 542 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
531 DCHECK(profile_); 543 DCHECK(profile_);
532 544
533 // TODO(dspaid): Move code from OnSyncedPrefChanged into this method. 545 // TODO(dspaid): Move code from OnSyncedPrefChanged into this method.
534 OnSyncedPrefChanged(prefs::kArcEnabled, IsArcManaged()); 546 OnSyncedPrefChanged(prefs::kArcEnabled, IsArcManaged());
535 547
536 const bool arc_enabled = IsArcEnabled(); 548 const bool arc_enabled = IsArcEnabled();
537 for (auto& observer : observer_list_) 549 for (auto& observer : observer_list_)
538 observer.OnArcOptInChanged(arc_enabled); 550 observer.OnArcOptInChanged(arc_enabled);
539 551
552 // Hide auth notification if it was opened before and arc.enabled pref was
553 // explicitly set to true or false.
554 if (!g_disable_ui_for_testing &&
555 profile_->GetPrefs()->HasPrefPath(prefs::kArcEnabled)) {
khmel 2016/12/20 18:48:44 There is no CloseUI equivalent that was in previou
556 ArcAuthNotification::Hide();
557 }
558
540 if (!arc_enabled) { 559 if (!arc_enabled) {
541 // Reset any pending request to re-enable Arc. 560 // Reset any pending request to re-enable Arc.
542 reenable_arc_ = false; 561 reenable_arc_ = false;
543 StopArc(); 562 StopArc();
544 RemoveArcData(); 563 RemoveArcData();
545 return; 564 return;
546 } 565 }
547 566
548 if (state_ == State::ACTIVE) 567 if (state_ == State::ACTIVE)
549 return; 568 return;
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 return os << "ACTIVE"; 941 return os << "ACTIVE";
923 } 942 }
924 943
925 // Some compiler reports an error even if all values of an enum-class are 944 // Some compiler reports an error even if all values of an enum-class are
926 // covered indivisually in a switch statement. 945 // covered indivisually in a switch statement.
927 NOTREACHED(); 946 NOTREACHED();
928 return os; 947 return os;
929 } 948 }
930 949
931 } // namespace arc 950 } // 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