OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/login_utils.h" | 5 #include "chrome/browser/chromeos/login/login_utils.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/lock.h" | |
13 #include "base/path_service.h" | 12 #include "base/path_service.h" |
14 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
15 #include "base/singleton.h" | 14 #include "base/singleton.h" |
16 #include "base/string_util.h" | 15 #include "base/string_util.h" |
17 #include "base/stringprintf.h" | 16 #include "base/stringprintf.h" |
| 17 #include "base/synchronization/lock.h" |
18 #include "base/time.h" | 18 #include "base/time.h" |
19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
21 #include "chrome/browser/browser_thread.h" | 21 #include "chrome/browser/browser_thread.h" |
22 #include "chrome/browser/chromeos/boot_times_loader.h" | 22 #include "chrome/browser/chromeos/boot_times_loader.h" |
23 #include "chrome/browser/chromeos/cros/login_library.h" | 23 #include "chrome/browser/chromeos/cros/login_library.h" |
24 #include "chrome/browser/chromeos/cros/network_library.h" | 24 #include "chrome/browser/chromeos/cros/network_library.h" |
25 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 25 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
26 #include "chrome/browser/chromeos/login/cookie_fetcher.h" | 26 #include "chrome/browser/chromeos/login/cookie_fetcher.h" |
27 #include "chrome/browser/chromeos/login/google_authenticator.h" | 27 #include "chrome/browser/chromeos/login/google_authenticator.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 DISALLOW_COPY_AND_ASSIGN(LoginUtilsImpl); | 153 DISALLOW_COPY_AND_ASSIGN(LoginUtilsImpl); |
154 }; | 154 }; |
155 | 155 |
156 class LoginUtilsWrapper { | 156 class LoginUtilsWrapper { |
157 public: | 157 public: |
158 static LoginUtilsWrapper* GetInstance() { | 158 static LoginUtilsWrapper* GetInstance() { |
159 return Singleton<LoginUtilsWrapper>::get(); | 159 return Singleton<LoginUtilsWrapper>::get(); |
160 } | 160 } |
161 | 161 |
162 LoginUtils* get() { | 162 LoginUtils* get() { |
163 AutoLock create(create_lock_); | 163 base::AutoLock create(create_lock_); |
164 if (!ptr_.get()) | 164 if (!ptr_.get()) |
165 reset(new LoginUtilsImpl); | 165 reset(new LoginUtilsImpl); |
166 return ptr_.get(); | 166 return ptr_.get(); |
167 } | 167 } |
168 | 168 |
169 void reset(LoginUtils* ptr) { | 169 void reset(LoginUtils* ptr) { |
170 ptr_.reset(ptr); | 170 ptr_.reset(ptr); |
171 } | 171 } |
172 | 172 |
173 private: | 173 private: |
174 friend struct DefaultSingletonTraits<LoginUtilsWrapper>; | 174 friend struct DefaultSingletonTraits<LoginUtilsWrapper>; |
175 | 175 |
176 LoginUtilsWrapper() {} | 176 LoginUtilsWrapper() {} |
177 | 177 |
178 Lock create_lock_; | 178 base::Lock create_lock_; |
179 scoped_ptr<LoginUtils> ptr_; | 179 scoped_ptr<LoginUtils> ptr_; |
180 | 180 |
181 DISALLOW_COPY_AND_ASSIGN(LoginUtilsWrapper); | 181 DISALLOW_COPY_AND_ASSIGN(LoginUtilsWrapper); |
182 }; | 182 }; |
183 | 183 |
184 void LoginUtilsImpl::CompleteLogin( | 184 void LoginUtilsImpl::CompleteLogin( |
185 const std::string& username, | 185 const std::string& username, |
186 const std::string& password, | 186 const std::string& password, |
187 const GaiaAuthConsumer::ClientLoginResult& credentials, | 187 const GaiaAuthConsumer::ClientLoginResult& credentials, |
188 bool pending_requests) { | 188 bool pending_requests) { |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 BrowserInit browser_init; | 526 BrowserInit browser_init; |
527 int return_code; | 527 int return_code; |
528 browser_init.LaunchBrowser(*CommandLine::ForCurrentProcess(), | 528 browser_init.LaunchBrowser(*CommandLine::ForCurrentProcess(), |
529 profile, | 529 profile, |
530 FilePath(), | 530 FilePath(), |
531 true, | 531 true, |
532 &return_code); | 532 &return_code); |
533 } | 533 } |
534 | 534 |
535 } // namespace chromeos | 535 } // namespace chromeos |
OLD | NEW |