| 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/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_code_fetcher.h" | |
| 18 #include "chrome/browser/chromeos/arc/arc_auth_context.h" | 17 #include "chrome/browser/chromeos/arc/arc_auth_context.h" |
| 19 #include "chrome/browser/chromeos/arc/arc_optin_uma.h" | 18 #include "chrome/browser/chromeos/arc/arc_optin_uma.h" |
| 20 #include "chrome/browser/chromeos/arc/arc_support_host.h" | 19 #include "chrome/browser/chromeos/arc/arc_support_host.h" |
| 21 #include "chrome/browser/chromeos/arc/auth/arc_robot_auth.h" | |
| 22 #include "chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator.h" | 20 #include "chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator.h" |
| 23 #include "chrome/browser/chromeos/arc/policy/arc_android_management_checker.h" | 21 #include "chrome/browser/chromeos/arc/policy/arc_android_management_checker.h" |
| 24 #include "chrome/browser/chromeos/arc/policy/arc_policy_util.h" | 22 #include "chrome/browser/chromeos/arc/policy/arc_policy_util.h" |
| 25 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 23 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 26 #include "chrome/browser/lifetime/application_lifetime.h" | 24 #include "chrome/browser/lifetime/application_lifetime.h" |
| 27 #include "chrome/browser/policy/profile_policy_connector.h" | 25 #include "chrome/browser/policy/profile_policy_connector.h" |
| 28 #include "chrome/browser/policy/profile_policy_connector_factory.h" | 26 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
| 29 #include "chrome/browser/prefs/pref_service_syncable_util.h" | 27 #include "chrome/browser/prefs/pref_service_syncable_util.h" |
| 30 #include "chrome/browser/profiles/profile.h" | 28 #include "chrome/browser/profiles/profile.h" |
| 31 #include "chrome/browser/ui/app_list/arc/arc_app_launcher.h" | 29 #include "chrome/browser/ui/app_list/arc/arc_app_launcher.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 reenable_arc_ = false; | 233 reenable_arc_ = false; |
| 236 VLOG(1) << "Reenable ARC"; | 234 VLOG(1) << "Reenable ARC"; |
| 237 EnableArc(); | 235 EnableArc(); |
| 238 } | 236 } |
| 239 | 237 |
| 240 void ArcSessionManager::OnProvisioningFinished(ProvisioningResult result) { | 238 void ArcSessionManager::OnProvisioningFinished(ProvisioningResult result) { |
| 241 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 239 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 242 DCHECK_EQ(state_, State::ACTIVE); | 240 DCHECK_EQ(state_, State::ACTIVE); |
| 243 | 241 |
| 244 if (result == ProvisioningResult::CHROME_SERVER_COMMUNICATION_ERROR) { | 242 if (result == ProvisioningResult::CHROME_SERVER_COMMUNICATION_ERROR) { |
| 243 if (IsArcKioskMode()) { |
| 244 VLOG(1) << "Robot account auth code fetching error"; |
| 245 // Log out the user. All the cleanup will be done in Shutdown() method. |
| 246 // The callback is not called because auth code is empty. |
| 247 chrome::AttemptUserExit(); |
| 248 return; |
| 249 } |
| 250 |
| 245 // For backwards compatibility, use NETWORK_ERROR for | 251 // For backwards compatibility, use NETWORK_ERROR for |
| 246 // CHROME_SERVER_COMMUNICATION_ERROR case. | 252 // CHROME_SERVER_COMMUNICATION_ERROR case. |
| 247 UpdateOptInCancelUMA(OptInCancelReason::NETWORK_ERROR); | 253 UpdateOptInCancelUMA(OptInCancelReason::NETWORK_ERROR); |
| 248 } else if (!sign_in_time_.is_null()) { | 254 } else if (!sign_in_time_.is_null()) { |
| 249 arc_sign_in_timer_.Stop(); | 255 arc_sign_in_timer_.Stop(); |
| 250 | 256 |
| 251 UpdateProvisioningTiming(base::Time::Now() - sign_in_time_, | 257 UpdateProvisioningTiming(base::Time::Now() - sign_in_time_, |
| 252 result == ProvisioningResult::SUCCESS, | 258 result == ProvisioningResult::SUCCESS, |
| 253 policy_util::IsAccountManaged(profile_)); | 259 policy_util::IsAccountManaged(profile_)); |
| 254 UpdateProvisioningResultUMA(result, | 260 UpdateProvisioningResultUMA(result, |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 return os << "ACTIVE"; | 844 return os << "ACTIVE"; |
| 839 } | 845 } |
| 840 | 846 |
| 841 // Some compiler reports an error even if all values of an enum-class are | 847 // Some compiler reports an error even if all values of an enum-class are |
| 842 // covered indivisually in a switch statement. | 848 // covered indivisually in a switch statement. |
| 843 NOTREACHED(); | 849 NOTREACHED(); |
| 844 return os; | 850 return os; |
| 845 } | 851 } |
| 846 | 852 |
| 847 } // namespace arc | 853 } // namespace arc |
| OLD | NEW |