| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/password_manager/chrome_password_manager_client.h" | 5 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
| 6 | 6 |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 std::string group_name = | 54 std::string group_name = |
| 55 base::FieldTrialList::FindFullName("PasswordManagerUI"); | 55 base::FieldTrialList::FindFullName("PasswordManagerUI"); |
| 56 return group_name == "Bubble"; | 56 return group_name == "Bubble"; |
| 57 } | 57 } |
| 58 | 58 |
| 59 } // namespace | 59 } // namespace |
| 60 | 60 |
| 61 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient); | 61 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient); |
| 62 | 62 |
| 63 // static | 63 // static |
| 64 void | 64 void ChromePasswordManagerClient::CreateForWebContentsWithAutofillClient( |
| 65 ChromePasswordManagerClient::CreateForWebContentsWithAutofillManagerDelegate( | |
| 66 content::WebContents* contents, | 65 content::WebContents* contents, |
| 67 autofill::AutofillManagerDelegate* delegate) { | 66 autofill::AutofillClient* autofill_client) { |
| 68 if (FromWebContents(contents)) | 67 if (FromWebContents(contents)) |
| 69 return; | 68 return; |
| 70 | 69 |
| 71 contents->SetUserData(UserDataKey(), | 70 contents->SetUserData( |
| 72 new ChromePasswordManagerClient(contents, delegate)); | 71 UserDataKey(), |
| 72 new ChromePasswordManagerClient(contents, autofill_client)); |
| 73 } | 73 } |
| 74 | 74 |
| 75 ChromePasswordManagerClient::ChromePasswordManagerClient( | 75 ChromePasswordManagerClient::ChromePasswordManagerClient( |
| 76 content::WebContents* web_contents, | 76 content::WebContents* web_contents, |
| 77 autofill::AutofillManagerDelegate* autofill_manager_delegate) | 77 autofill::AutofillClient* autofill_client) |
| 78 : content::WebContentsObserver(web_contents), | 78 : content::WebContentsObserver(web_contents), |
| 79 profile_(Profile::FromBrowserContext(web_contents->GetBrowserContext())), | 79 profile_(Profile::FromBrowserContext(web_contents->GetBrowserContext())), |
| 80 driver_(web_contents, this, autofill_manager_delegate), | 80 driver_(web_contents, this, autofill_client), |
| 81 observer_(NULL), | 81 observer_(NULL), |
| 82 weak_factory_(this), | 82 weak_factory_(this), |
| 83 can_use_log_router_(false) { | 83 can_use_log_router_(false) { |
| 84 PasswordManagerInternalsService* service = | 84 PasswordManagerInternalsService* service = |
| 85 PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile_); | 85 PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile_); |
| 86 if (service) | 86 if (service) |
| 87 can_use_log_router_ = service->RegisterClient(this); | 87 can_use_log_router_ = service->RegisterClient(this); |
| 88 } | 88 } |
| 89 | 89 |
| 90 ChromePasswordManagerClient::~ChromePasswordManagerClient() { | 90 ChromePasswordManagerClient::~ChromePasswordManagerClient() { |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 web_contents(), | 327 web_contents(), |
| 328 web_contents()->GetNativeView()); | 328 web_contents()->GetNativeView()); |
| 329 popup_controller_->Show(false /* display_password */); | 329 popup_controller_->Show(false /* display_password */); |
| 330 #endif // defined(USE_AURA) || defined(OS_MACOSX) | 330 #endif // defined(USE_AURA) || defined(OS_MACOSX) |
| 331 } | 331 } |
| 332 | 332 |
| 333 void ChromePasswordManagerClient::CommitFillPasswordForm( | 333 void ChromePasswordManagerClient::CommitFillPasswordForm( |
| 334 autofill::PasswordFormFillData* data) { | 334 autofill::PasswordFormFillData* data) { |
| 335 driver_.FillPasswordForm(*data); | 335 driver_.FillPasswordForm(*data); |
| 336 } | 336 } |
| OLD | NEW |