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/ui/auto_login_prompter.h" | 5 #include "chrome/browser/ui/auto_login_prompter.h" |
6 | 6 |
| 7 #include "base/bind.h" |
7 #include "base/command_line.h" | 8 #include "base/command_line.h" |
8 #include "base/logging.h" | 9 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
10 #include "base/string_split.h" | 11 #include "base/string_split.h" |
11 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
12 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
13 #include "chrome/browser/infobars/infobar_tab_helper.h" | 14 #include "chrome/browser/infobars/infobar_tab_helper.h" |
14 #include "chrome/browser/net/gaia/token_service.h" | 15 #include "chrome/browser/net/gaia/token_service.h" |
15 #include "chrome/browser/prefs/pref_service.h" | 16 #include "chrome/browser/prefs/pref_service.h" |
16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 account = pair.second; | 265 account = pair.second; |
265 } else if (pair.first == "args") { | 266 } else if (pair.first == "args") { |
266 args = pair.second; | 267 args = pair.second; |
267 } | 268 } |
268 } | 269 } |
269 | 270 |
270 // Currently we only accept GAIA credentials. | 271 // Currently we only accept GAIA credentials. |
271 if (realm != "com.google") | 272 if (realm != "com.google") |
272 return; | 273 return; |
273 | 274 |
274 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 275 BrowserThread::PostTask( |
275 NewRunnableFunction(&AutoLoginPrompter::ShowInfoBarUIThread, account, | 276 BrowserThread::UI, FROM_HERE, |
276 args, child_id, route_id)); | 277 base::Bind(&AutoLoginPrompter::ShowInfoBarUIThread, account, args, |
| 278 child_id, route_id)); |
277 } | 279 } |
278 | 280 |
279 // static | 281 // static |
280 void AutoLoginPrompter::ShowInfoBarUIThread(const std::string& account, | 282 void AutoLoginPrompter::ShowInfoBarUIThread(const std::string& account, |
281 const std::string& args, | 283 const std::string& args, |
282 int child_id, | 284 int child_id, |
283 int route_id) { | 285 int route_id) { |
284 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 286 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
285 | 287 |
286 TabContents* tab_contents = tab_util::GetTabContentsByID(child_id, route_id); | 288 TabContents* tab_contents = tab_util::GetTabContentsByID(child_id, route_id); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 infobar_helper, &tab_contents_->controller(), | 335 infobar_helper, &tab_contents_->controller(), |
334 profile->GetTokenService(), profile->GetPrefs(), | 336 profile->GetTokenService(), profile->GetPrefs(), |
335 username_, args_)); | 337 username_, args_)); |
336 } | 338 } |
337 } | 339 } |
338 // Either we couldn't add the infobar, we added the infobar, or the tab | 340 // Either we couldn't add the infobar, we added the infobar, or the tab |
339 // contents was destroyed before the navigation completed. In any case | 341 // contents was destroyed before the navigation completed. In any case |
340 // there's no reason to live further. | 342 // there's no reason to live further. |
341 delete this; | 343 delete this; |
342 } | 344 } |
OLD | NEW |