Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: chrome/browser/password_manager/chrome_password_manager_client.cc

Issue 256003003: Enable Automatic Passwords Saving (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: custombuildonly Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11
vabr (Chromium) 2014/04/30 07:46:31 nit: Please remove this blank line.
rchtara 2014/04/30 09:06:40 Done.
11 #include "chrome/browser/password_manager/password_manager_util.h" 12 #include "chrome/browser/password_manager/password_manager_util.h"
12 #include "chrome/browser/password_manager/password_store_factory.h" 13 #include "chrome/browser/password_manager/password_store_factory.h"
13 #include "chrome/browser/password_manager/save_password_infobar_delegate.h" 14 #include "chrome/browser/password_manager/save_password_infobar_delegate.h"
14 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/sync/profile_sync_service.h" 16 #include "chrome/browser/sync/profile_sync_service.h"
16 #include "chrome/browser/sync/profile_sync_service_factory.h" 17 #include "chrome/browser/sync/profile_sync_service_factory.h"
17 #include "chrome/browser/ui/autofill/password_generation_popup_controller_impl.h " 18 #include "chrome/browser/ui/autofill/password_generation_popup_controller_impl.h "
18 #include "chrome/browser/ui/passwords/manage_passwords_bubble_ui_controller.h" 19 #include "chrome/browser/ui/passwords/manage_passwords_bubble_ui_controller.h"
19 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
20 #include "chrome/common/chrome_version_info.h" 21 #include "chrome/common/chrome_version_info.h"
21 #include "components/autofill/content/common/autofill_messages.h" 22 #include "components/autofill/content/common/autofill_messages.h"
22 #include "components/autofill/core/browser/password_generator.h" 23 #include "components/autofill/core/browser/password_generator.h"
23 #include "components/autofill/core/common/password_form.h" 24 #include "components/autofill/core/common/password_form.h"
24 #include "components/password_manager/core/browser/password_form_manager.h" 25 #include "components/password_manager/core/browser/password_form_manager.h"
25 #include "components/password_manager/core/browser/password_manager.h" 26 #include "components/password_manager/core/browser/password_manager.h"
26 #include "components/password_manager/core/browser/password_manager_logger.h" 27 #include "components/password_manager/core/browser/password_manager_logger.h"
27 #include "components/password_manager/core/browser/password_manager_metrics_util .h" 28 #include "components/password_manager/core/browser/password_manager_metrics_util .h"
29 #include "components/password_manager/core/common/password_manager_switches.h"
28 #include "content/public/browser/render_view_host.h" 30 #include "content/public/browser/render_view_host.h"
29 #include "content/public/browser/web_contents.h" 31 #include "content/public/browser/web_contents.h"
30 #include "content/public/browser/web_contents_view.h" 32 #include "content/public/browser/web_contents_view.h"
31 #include "ipc/ipc_message_macros.h" 33 #include "ipc/ipc_message_macros.h"
32 34
33 #if defined(OS_ANDROID) 35 #if defined(OS_ANDROID)
34 #include "chrome/browser/android/password_authentication_manager.h" 36 #include "chrome/browser/android/password_authentication_manager.h"
35 #endif // OS_ANDROID 37 #endif // OS_ANDROID
36 38
37 namespace { 39 namespace {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 content::WebContents* web_contents, 72 content::WebContents* web_contents,
71 autofill::AutofillManagerDelegate* autofill_manager_delegate) 73 autofill::AutofillManagerDelegate* autofill_manager_delegate)
72 : content::WebContentsObserver(web_contents), 74 : content::WebContentsObserver(web_contents),
73 driver_(web_contents, this, autofill_manager_delegate), 75 driver_(web_contents, this, autofill_manager_delegate),
74 observer_(NULL), 76 observer_(NULL),
75 weak_factory_(this), 77 weak_factory_(this),
76 logger_(NULL) {} 78 logger_(NULL) {}
77 79
78 ChromePasswordManagerClient::~ChromePasswordManagerClient() {} 80 ChromePasswordManagerClient::~ChromePasswordManagerClient() {}
79 81
82 bool ChromePasswordManagerClient::IsAutomaticPasswordSavingEnabled() const {
83 return CommandLine::ForCurrentProcess()->HasSwitch(
84 password_manager::switches::kEnableAutomaticPasswordSaving) &&
85 chrome::VersionInfo::GetChannel() ==
86 chrome::VersionInfo::CHANNEL_UNKNOWN;
vabr (Chromium) 2014/04/30 07:46:31 nit: This indenting looks wrong. It should be +2 m
rchtara 2014/04/30 09:06:40 Done.
87 }
88
80 void ChromePasswordManagerClient::PromptUserToSavePassword( 89 void ChromePasswordManagerClient::PromptUserToSavePassword(
81 password_manager::PasswordFormManager* form_to_save) { 90 password_manager::PasswordFormManager* form_to_save) {
82 if (IsTheHotNewBubbleUIEnabled()) { 91 if (IsTheHotNewBubbleUIEnabled()) {
83 ManagePasswordsBubbleUIController* manage_passwords_bubble_ui_controller = 92 ManagePasswordsBubbleUIController* manage_passwords_bubble_ui_controller =
84 ManagePasswordsBubbleUIController::FromWebContents(web_contents()); 93 ManagePasswordsBubbleUIController::FromWebContents(web_contents());
85 if (manage_passwords_bubble_ui_controller) { 94 if (manage_passwords_bubble_ui_controller) {
86 manage_passwords_bubble_ui_controller->OnPasswordSubmitted(form_to_save); 95 manage_passwords_bubble_ui_controller->OnPasswordSubmitted(form_to_save);
87 } else { 96 } else {
88 delete form_to_save; 97 delete form_to_save;
89 } 98 }
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 web_contents(), 311 web_contents(),
303 web_contents()->GetView()->GetNativeView()); 312 web_contents()->GetView()->GetNativeView());
304 popup_controller_->Show(false /* display_password */); 313 popup_controller_->Show(false /* display_password */);
305 #endif // #if defined(USE_AURA) 314 #endif // #if defined(USE_AURA)
306 } 315 }
307 316
308 void ChromePasswordManagerClient::CommitFillPasswordForm( 317 void ChromePasswordManagerClient::CommitFillPasswordForm(
309 autofill::PasswordFormFillData* data) { 318 autofill::PasswordFormFillData* data) {
310 driver_.FillPasswordForm(*data); 319 driver_.FillPasswordForm(*data);
311 } 320 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698