OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser_signin.h" | 5 #include "chrome/browser/browser_signin.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 signin_->Cancel(); | 210 signin_->Cancel(); |
211 } | 211 } |
212 signin_->GetProfileSyncService()->OnUserSubmittedAuth( | 212 signin_->GetProfileSyncService()->OnUserSubmittedAuth( |
213 username, password, captcha, access_code); | 213 username, password, captcha, access_code); |
214 } | 214 } |
215 | 215 |
216 BrowserSignin::BrowserSignin(Profile* profile) | 216 BrowserSignin::BrowserSignin(Profile* profile) |
217 : profile_(profile), | 217 : profile_(profile), |
218 delegate_(NULL), | 218 delegate_(NULL), |
219 html_dialog_ui_delegate_(NULL) { | 219 html_dialog_ui_delegate_(NULL) { |
220 BrowserSigninResourcesSource* source = new BrowserSigninResourcesSource(); | 220 // profile is NULL during testing. |
221 BrowserThread::PostTask( | 221 if (profile) { |
222 BrowserThread::IO, FROM_HERE, | 222 BrowserSigninResourcesSource* source = new BrowserSigninResourcesSource(); |
223 NewRunnableMethod(ChromeURLDataManager::GetInstance(), | 223 profile->GetChromeURLDataManager()->AddDataSource(source); |
224 &ChromeURLDataManager::AddDataSource, | 224 } |
225 make_scoped_refptr(source))); | |
226 } | 225 } |
227 | 226 |
228 BrowserSignin::~BrowserSignin() { | 227 BrowserSignin::~BrowserSignin() { |
229 delegate_ = NULL; | 228 delegate_ = NULL; |
230 } | 229 } |
231 | 230 |
232 void BrowserSignin::RequestSignin(TabContents* tab_contents, | 231 void BrowserSignin::RequestSignin(TabContents* tab_contents, |
233 const string16& suggested_email, | 232 const string16& suggested_email, |
234 const string16& login_message, | 233 const string16& login_message, |
235 SigninDelegate* delegate) { | 234 SigninDelegate* delegate) { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 | 324 |
326 void BrowserSignin::ShowSigninTabModal(TabContents* tab_contents) { | 325 void BrowserSignin::ShowSigninTabModal(TabContents* tab_contents) { |
327 // TODO(johnnyg): Need a linux views implementation for ConstrainedHtmlDialog. | 326 // TODO(johnnyg): Need a linux views implementation for ConstrainedHtmlDialog. |
328 #if defined(OS_WIN) || defined(OS_CHROMEOS) || !defined(TOOLKIT_VIEWS) | 327 #if defined(OS_WIN) || defined(OS_CHROMEOS) || !defined(TOOLKIT_VIEWS) |
329 html_dialog_ui_delegate_ = CreateHtmlDialogUI(); | 328 html_dialog_ui_delegate_ = CreateHtmlDialogUI(); |
330 ConstrainedHtmlUI::CreateConstrainedHtmlDialog(profile_, | 329 ConstrainedHtmlUI::CreateConstrainedHtmlDialog(profile_, |
331 html_dialog_ui_delegate_, | 330 html_dialog_ui_delegate_, |
332 tab_contents); | 331 tab_contents); |
333 #endif | 332 #endif |
334 } | 333 } |
OLD | NEW |