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 17 matching lines...) Expand all Loading... |
28 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
29 #include "content/public/browser/web_contents_view.h" | 29 #include "content/public/browser/web_contents_view.h" |
30 #include "ipc/ipc_message_macros.h" | 30 #include "ipc/ipc_message_macros.h" |
31 | 31 |
32 #if defined(OS_ANDROID) | 32 #if defined(OS_ANDROID) |
33 #include "chrome/browser/android/password_authentication_manager.h" | 33 #include "chrome/browser/android/password_authentication_manager.h" |
34 #endif // OS_ANDROID | 34 #endif // OS_ANDROID |
35 | 35 |
36 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient); | 36 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient); |
37 | 37 |
| 38 // static |
| 39 void |
| 40 ChromePasswordManagerClient::CreateForWebContentsWithAutofillManagerDelegate( |
| 41 content::WebContents* contents, |
| 42 autofill::AutofillManagerDelegate* delegate) { |
| 43 if (FromWebContents(contents)) |
| 44 return; |
| 45 |
| 46 contents->SetUserData(UserDataKey(), |
| 47 new ChromePasswordManagerClient(contents, delegate)); |
| 48 } |
| 49 |
38 ChromePasswordManagerClient::ChromePasswordManagerClient( | 50 ChromePasswordManagerClient::ChromePasswordManagerClient( |
39 content::WebContents* web_contents) | 51 content::WebContents* web_contents, |
| 52 autofill::AutofillManagerDelegate* autofill_manager_delegate) |
40 : content::WebContentsObserver(web_contents), | 53 : content::WebContentsObserver(web_contents), |
41 driver_(web_contents, this), | 54 driver_(web_contents, this, autofill_manager_delegate), |
42 observer_(NULL), | 55 observer_(NULL), |
43 weak_factory_(this), | 56 weak_factory_(this), |
44 logger_(NULL) {} | 57 logger_(NULL) {} |
45 | 58 |
46 ChromePasswordManagerClient::~ChromePasswordManagerClient() {} | 59 ChromePasswordManagerClient::~ChromePasswordManagerClient() {} |
47 | 60 |
48 void ChromePasswordManagerClient::PromptUserToSavePassword( | 61 void ChromePasswordManagerClient::PromptUserToSavePassword( |
49 PasswordFormManager* form_to_save) { | 62 PasswordFormManager* form_to_save) { |
50 if (CommandLine::ForCurrentProcess()->HasSwitch( | 63 if (CommandLine::ForCurrentProcess()->HasSwitch( |
51 switches::kEnableSavePasswordBubble)) { | 64 switches::kEnableSavePasswordBubble)) { |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 web_contents(), | 262 web_contents(), |
250 web_contents()->GetView()->GetNativeView()); | 263 web_contents()->GetView()->GetNativeView()); |
251 popup_controller_->Show(false /* display_password */); | 264 popup_controller_->Show(false /* display_password */); |
252 #endif // #if defined(USE_AURA) | 265 #endif // #if defined(USE_AURA) |
253 } | 266 } |
254 | 267 |
255 void ChromePasswordManagerClient::CommitFillPasswordForm( | 268 void ChromePasswordManagerClient::CommitFillPasswordForm( |
256 autofill::PasswordFormFillData* data) { | 269 autofill::PasswordFormFillData* data) { |
257 driver_.FillPasswordForm(*data); | 270 driver_.FillPasswordForm(*data); |
258 } | 271 } |
OLD | NEW |