OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_play_store_enabled_preference_handler.
h" | 5 #include "chrome/browser/chromeos/arc/arc_play_store_enabled_preference_handler.
h" |
6 | 6 |
7 #include "ash/shelf/shelf_delegate.h" | 7 #include "ash/shelf/shelf_model.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "chrome/browser/chromeos/arc/arc_auth_notification.h" | 12 #include "chrome/browser/chromeos/arc/arc_auth_notification.h" |
13 #include "chrome/browser/chromeos/arc/arc_optin_uma.h" | 13 #include "chrome/browser/chromeos/arc/arc_optin_uma.h" |
14 #include "chrome/browser/chromeos/arc/arc_session_manager.h" | 14 #include "chrome/browser/chromeos/arc/arc_session_manager.h" |
15 #include "chrome/browser/chromeos/arc/arc_support_host.h" | 15 #include "chrome/browser/chromeos/arc/arc_support_host.h" |
16 #include "chrome/browser/chromeos/arc/arc_util.h" | 16 #include "chrome/browser/chromeos/arc/arc_util.h" |
17 #include "chrome/browser/prefs/pref_service_syncable_util.h" | 17 #include "chrome/browser/prefs/pref_service_syncable_util.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 const bool is_play_store_enabled = IsArcPlayStoreEnabledForProfile(profile_); | 86 const bool is_play_store_enabled = IsArcPlayStoreEnabledForProfile(profile_); |
87 if (!IsArcPlayStoreEnabledPreferenceManagedForProfile(profile_)) { | 87 if (!IsArcPlayStoreEnabledPreferenceManagedForProfile(profile_)) { |
88 // Update UMA only for non-Managed cases. | 88 // Update UMA only for non-Managed cases. |
89 UpdateOptInActionUMA(is_play_store_enabled ? OptInActionType::OPTED_IN | 89 UpdateOptInActionUMA(is_play_store_enabled ? OptInActionType::OPTED_IN |
90 : OptInActionType::OPTED_OUT); | 90 : OptInActionType::OPTED_OUT); |
91 | 91 |
92 if (!is_play_store_enabled) { | 92 if (!is_play_store_enabled) { |
93 // Remove the pinned Play Store icon launcher in Shelf. | 93 // Remove the pinned Play Store icon launcher in Shelf. |
94 // This is only for non-Managed cases. In managed cases, it is expected | 94 // This is only for non-Managed cases. In managed cases, it is expected |
95 // to be "disabled" rather than "removed", so keep it here. | 95 // to be "disabled" rather than "removed", so keep it here. |
96 auto* shelf_delegate = ash::Shell::HasInstance() | 96 auto* shelf_model = ash::Shell::HasInstance() |
97 ? ash::Shell::Get()->shelf_delegate() | 97 ? ash::Shell::Get()->shelf_model() |
98 : nullptr; | 98 : nullptr; |
99 if (shelf_delegate) | 99 if (shelf_model) |
100 shelf_delegate->UnpinAppWithID(ArcSupportHost::kHostAppId); | 100 shelf_model->UnpinAppWithID(ArcSupportHost::kHostAppId); |
101 } | 101 } |
102 } | 102 } |
103 | 103 |
104 // Hide auth notification if it was opened before and arc.enabled pref was | 104 // Hide auth notification if it was opened before and arc.enabled pref was |
105 // explicitly set to true or false. | 105 // explicitly set to true or false. |
106 if (profile_->GetPrefs()->HasPrefPath(prefs::kArcEnabled)) | 106 if (profile_->GetPrefs()->HasPrefPath(prefs::kArcEnabled)) |
107 ArcAuthNotification::Hide(); | 107 ArcAuthNotification::Hide(); |
108 | 108 |
109 UpdateArcSessionManager(); | 109 UpdateArcSessionManager(); |
110 | 110 |
(...skipping 26 matching lines...) Expand all Loading... |
137 // TODO(hidehiko): Extract kEnableArcOOBEOptIn check as a utility method. | 137 // TODO(hidehiko): Extract kEnableArcOOBEOptIn check as a utility method. |
138 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 138 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
139 chromeos::switches::kEnableArcOOBEOptIn) && | 139 chromeos::switches::kEnableArcOOBEOptIn) && |
140 profile_->IsNewProfile() && | 140 profile_->IsNewProfile() && |
141 !profile_->GetPrefs()->HasPrefPath(prefs::kArcEnabled)) { | 141 !profile_->GetPrefs()->HasPrefPath(prefs::kArcEnabled)) { |
142 ArcAuthNotification::Show(profile_); | 142 ArcAuthNotification::Show(profile_); |
143 } | 143 } |
144 } | 144 } |
145 | 145 |
146 } // namespace arc | 146 } // namespace arc |
OLD | NEW |