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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 if (command_line->HasSwitch(switches::kEnableSavePasswordBubble)) | 46 if (command_line->HasSwitch(switches::kEnableSavePasswordBubble)) |
47 return true; | 47 return true; |
48 | 48 |
49 return group_name == "Bubble"; | 49 return group_name == "Bubble"; |
50 } | 50 } |
51 | 51 |
52 } // namespace | 52 } // namespace |
53 | 53 |
54 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient); | 54 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient); |
55 | 55 |
| 56 // static |
| 57 void |
| 58 ChromePasswordManagerClient::CreateForWebContentsWithAutofillManagerDelegate( |
| 59 content::WebContents* contents, |
| 60 autofill::AutofillManagerDelegate* delegate) { |
| 61 if (FromWebContents(contents)) |
| 62 return; |
| 63 |
| 64 contents->SetUserData(UserDataKey(), |
| 65 new ChromePasswordManagerClient(contents, delegate)); |
| 66 } |
| 67 |
56 ChromePasswordManagerClient::ChromePasswordManagerClient( | 68 ChromePasswordManagerClient::ChromePasswordManagerClient( |
57 content::WebContents* web_contents) | 69 content::WebContents* web_contents, |
| 70 autofill::AutofillManagerDelegate* autofill_manager_delegate) |
58 : content::WebContentsObserver(web_contents), | 71 : content::WebContentsObserver(web_contents), |
59 driver_(web_contents, this), | 72 driver_(web_contents, this, autofill_manager_delegate), |
60 observer_(NULL), | 73 observer_(NULL), |
61 weak_factory_(this), | 74 weak_factory_(this), |
62 logger_(NULL) {} | 75 logger_(NULL) {} |
63 | 76 |
64 ChromePasswordManagerClient::~ChromePasswordManagerClient() {} | 77 ChromePasswordManagerClient::~ChromePasswordManagerClient() {} |
65 | 78 |
66 void ChromePasswordManagerClient::PromptUserToSavePassword( | 79 void ChromePasswordManagerClient::PromptUserToSavePassword( |
67 password_manager::PasswordFormManager* form_to_save) { | 80 password_manager::PasswordFormManager* form_to_save) { |
68 if (IsTheHotNewBubbleUIEnabled()) { | 81 if (IsTheHotNewBubbleUIEnabled()) { |
69 ManagePasswordsBubbleUIController* manage_passwords_bubble_ui_controller = | 82 ManagePasswordsBubbleUIController* manage_passwords_bubble_ui_controller = |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 web_contents(), | 297 web_contents(), |
285 web_contents()->GetView()->GetNativeView()); | 298 web_contents()->GetView()->GetNativeView()); |
286 popup_controller_->Show(false /* display_password */); | 299 popup_controller_->Show(false /* display_password */); |
287 #endif // #if defined(USE_AURA) | 300 #endif // #if defined(USE_AURA) |
288 } | 301 } |
289 | 302 |
290 void ChromePasswordManagerClient::CommitFillPasswordForm( | 303 void ChromePasswordManagerClient::CommitFillPasswordForm( |
291 autofill::PasswordFormFillData* data) { | 304 autofill::PasswordFormFillData* data) { |
292 driver_.FillPasswordForm(*data); | 305 driver_.FillPasswordForm(*data); |
293 } | 306 } |
OLD | NEW |