| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/login/managed/locally_managed_user_login_flow.
h" | 5 #include "chrome/browser/chromeos/login/managed/locally_managed_user_login_flow.
h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 return false; | 64 return false; |
| 65 } | 65 } |
| 66 | 66 |
| 67 void LocallyManagedUserLoginFlow::HandleOAuthTokenStatusChange( | 67 void LocallyManagedUserLoginFlow::HandleOAuthTokenStatusChange( |
| 68 User::OAuthTokenStatus status) { | 68 User::OAuthTokenStatus status) { |
| 69 } | 69 } |
| 70 | 70 |
| 71 void LocallyManagedUserLoginFlow::OnSyncSetupDataLoaded( | 71 void LocallyManagedUserLoginFlow::OnSyncSetupDataLoaded( |
| 72 const std::string& token) { | 72 const std::string& token) { |
| 73 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 73 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 74 // TODO(antrim): add error handling (no token loaded). | |
| 75 ConfigureSync(token); | 74 ConfigureSync(token); |
| 76 } | 75 } |
| 77 | 76 |
| 78 void LocallyManagedUserLoginFlow::ConfigureSync(const std::string& token) { | 77 void LocallyManagedUserLoginFlow::ConfigureSync(const std::string& token) { |
| 79 data_loaded_ = true; | 78 data_loaded_ = true; |
| 80 ManagedUserServiceFactory::GetForProfile(profile_)->InitSync(token); | 79 // TODO(antrim): add error handling (no token loaded). |
| 80 // See also: http://crbug.com/312751 |
| 81 if (!token.empty()) |
| 82 ManagedUserServiceFactory::GetForProfile(profile_)->InitSync(token); |
| 83 |
| 81 LoginUtils::Get()->DoBrowserLaunch(profile_, host()); | 84 LoginUtils::Get()->DoBrowserLaunch(profile_, host()); |
| 82 profile_ = NULL; | 85 profile_ = NULL; |
| 83 UnregisterFlowSoon(); | 86 UnregisterFlowSoon(); |
| 84 } | 87 } |
| 85 | 88 |
| 86 void LocallyManagedUserLoginFlow::LaunchExtraSteps( | 89 void LocallyManagedUserLoginFlow::LaunchExtraSteps( |
| 87 Profile* profile) { | 90 Profile* profile) { |
| 88 profile_ = profile; | 91 profile_ = profile; |
| 89 const std::string token; | 92 const std::string token; |
| 90 if (token.empty()) { | 93 if (token.empty()) { |
| 91 PostTaskAndReplyWithResult( | 94 PostTaskAndReplyWithResult( |
| 92 content::BrowserThread::GetBlockingPool(), | 95 content::BrowserThread::GetBlockingPool(), |
| 93 FROM_HERE, | 96 FROM_HERE, |
| 94 base::Bind(&LoadSyncToken), | 97 base::Bind(&LoadSyncToken), |
| 95 base::Bind( | 98 base::Bind( |
| 96 &LocallyManagedUserLoginFlow::OnSyncSetupDataLoaded, | 99 &LocallyManagedUserLoginFlow::OnSyncSetupDataLoaded, |
| 97 weak_factory_.GetWeakPtr())); | 100 weak_factory_.GetWeakPtr())); |
| 98 } else { | 101 } else { |
| 99 ConfigureSync(token); | 102 ConfigureSync(token); |
| 100 } | 103 } |
| 101 } | 104 } |
| 102 | 105 |
| 103 } // namespace chromeos | 106 } // namespace chromeos |
| OLD | NEW |