| 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/login/login_prompt.h" | 5 #include "chrome/browser/ui/login/login_prompt.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 13 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 14 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 14 #include "chrome/browser/ui/webui/constrained_html_ui.h" | 15 #include "chrome/browser/ui/webui/constrained_html_ui.h" |
| 15 #include "chrome/browser/ui/webui/html_dialog_ui.h" | 16 #include "chrome/browser/ui/webui/html_dialog_ui.h" |
| 16 #include "chrome/common/jstemplate_builder.h" | 17 #include "chrome/common/jstemplate_builder.h" |
| 17 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
| 18 #include "content/browser/tab_contents/tab_contents.h" | 19 #include "content/browser/tab_contents/tab_contents.h" |
| 19 #include "grit/browser_resources.h" | 20 #include "grit/browser_resources.h" |
| 20 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
| 21 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
| 22 #include "ui/base/resource/resource_bundle.h" | 23 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 web_ui_->CallJavascriptFunction("setAutofillCredentials", | 230 web_ui_->CallJavascriptFunction("setAutofillCredentials", |
| 230 username_v, password_v); | 231 username_v, password_v); |
| 231 } | 232 } |
| 232 } | 233 } |
| 233 | 234 |
| 234 void LoginHandlerHtml::BuildViewForPasswordManager( | 235 void LoginHandlerHtml::BuildViewForPasswordManager( |
| 235 PasswordManager* manager, const string16& explanation) { | 236 PasswordManager* manager, const string16& explanation) { |
| 236 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 237 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 237 | 238 |
| 238 TabContents* tab_contents = GetTabContentsForLogin(); | 239 TabContents* tab_contents = GetTabContentsForLogin(); |
| 239 Profile* profile = | 240 TabContentsWrapper* wrapper = |
| 240 Profile::FromBrowserContext(tab_contents->browser_context()); | 241 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents); |
| 242 Profile* profile = wrapper->profile(); |
| 241 LoginHandlerSource::RegisterDataSource(profile); | 243 LoginHandlerSource::RegisterDataSource(profile); |
| 242 delegate_ = new LoginHandlerHtmlDelegate(this, explanation); | 244 delegate_ = new LoginHandlerHtmlDelegate(this, explanation); |
| 243 ConstrainedWindow* dialog = ConstrainedHtmlUI::CreateConstrainedHtmlDialog( | 245 ConstrainedWindow* dialog = ConstrainedHtmlUI::CreateConstrainedHtmlDialog( |
| 244 profile, delegate_, tab_contents); | 246 profile, delegate_, wrapper); |
| 245 | 247 |
| 246 SetModel(manager); | 248 SetModel(manager); |
| 247 SetDialog(dialog); | 249 SetDialog(dialog); |
| 248 | 250 |
| 249 NotifyAuthNeeded(); | 251 NotifyAuthNeeded(); |
| 250 } | 252 } |
| 251 | 253 |
| 252 // static | 254 // static |
| 253 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, | 255 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, |
| 254 net::URLRequest* request) { | 256 net::URLRequest* request) { |
| 255 return new LoginHandlerHtml(auth_info, request); | 257 return new LoginHandlerHtml(auth_info, request); |
| 256 } | 258 } |
| OLD | NEW |