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

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: 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 #include "chrome/browser/password_manager/password_manager_util.h" 11 #include "chrome/browser/password_manager/password_manager_util.h"
12 #include "chrome/browser/password_manager/password_store_factory.h" 12 #include "chrome/browser/password_manager/password_store_factory.h"
13 #include "chrome/browser/password_manager/save_password_infobar_delegate.h" 13 #include "chrome/browser/password_manager/save_password_infobar_delegate.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/sync/profile_sync_service.h" 15 #include "chrome/browser/sync/profile_sync_service.h"
16 #include "chrome/browser/sync/profile_sync_service_factory.h" 16 #include "chrome/browser/sync/profile_sync_service_factory.h"
17 #include "chrome/browser/ui/autofill/password_generation_popup_controller_impl.h " 17 #include "chrome/browser/ui/autofill/password_generation_popup_controller_impl.h "
18 #include "chrome/browser/ui/passwords/manage_passwords_bubble_ui_controller.h" 18 #include "chrome/browser/ui/passwords/manage_passwords_bubble_ui_controller.h"
19 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
20 #include "chrome/common/chrome_version_info.h" 20 #include "chrome/common/chrome_version_info.h"
21 #include "components/autofill/content/common/autofill_messages.h" 21 #include "components/autofill/content/common/autofill_messages.h"
22 #include "components/autofill/core/browser/password_generator.h" 22 #include "components/autofill/core/browser/password_generator.h"
23 #include "components/autofill/core/common/password_form.h" 23 #include "components/autofill/core/common/password_form.h"
24 #include "components/password_manager/core/browser/password_form_manager.h" 24 #include "components/password_manager/core/browser/password_form_manager.h"
25 #include "components/password_manager/core/browser/password_manager.h" 25 #include "components/password_manager/core/browser/password_manager.h"
26 #include "components/password_manager/core/browser/password_manager_logger.h" 26 #include "components/password_manager/core/browser/password_manager_logger.h"
27 #include "components/password_manager/core/browser/password_manager_metrics_util .h" 27 #include "components/password_manager/core/browser/password_manager_metrics_util .h"
28 #include "components/password_manager/core/common/password_manager_switches.h"
28 #include "content/public/browser/render_view_host.h" 29 #include "content/public/browser/render_view_host.h"
29 #include "content/public/browser/web_contents.h" 30 #include "content/public/browser/web_contents.h"
30 #include "content/public/browser/web_contents_view.h" 31 #include "content/public/browser/web_contents_view.h"
31 #include "ipc/ipc_message_macros.h" 32 #include "ipc/ipc_message_macros.h"
32 33
33 #if defined(OS_ANDROID) 34 #if defined(OS_ANDROID)
34 #include "chrome/browser/android/password_authentication_manager.h" 35 #include "chrome/browser/android/password_authentication_manager.h"
35 #endif // OS_ANDROID 36 #endif // OS_ANDROID
36 37
37 namespace { 38 namespace {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 content::WebContents* web_contents, 71 content::WebContents* web_contents,
71 autofill::AutofillManagerDelegate* autofill_manager_delegate) 72 autofill::AutofillManagerDelegate* autofill_manager_delegate)
72 : content::WebContentsObserver(web_contents), 73 : content::WebContentsObserver(web_contents),
73 driver_(web_contents, this, autofill_manager_delegate), 74 driver_(web_contents, this, autofill_manager_delegate),
74 observer_(NULL), 75 observer_(NULL),
75 weak_factory_(this), 76 weak_factory_(this),
76 logger_(NULL) {} 77 logger_(NULL) {}
77 78
78 ChromePasswordManagerClient::~ChromePasswordManagerClient() {} 79 ChromePasswordManagerClient::~ChromePasswordManagerClient() {}
79 80
81 bool ChromePasswordManagerClient::IsAutomaticPasswordSavingEnabled() const {
82 return CommandLine::ForCurrentProcess()->HasSwitch(
83 password_manager::switches::kEnableAutomaticPasswordSaving) &&
84 chrome::VersionInfo::GetChannel() ==
85 chrome::VersionInfo::CHANNEL_UNKNOWN;
86 }
87
80 void ChromePasswordManagerClient::PromptUserToSavePassword( 88 void ChromePasswordManagerClient::PromptUserToSavePassword(
81 password_manager::PasswordFormManager* form_to_save) { 89 password_manager::PasswordFormManager* form_to_save) {
82 if (IsTheHotNewBubbleUIEnabled()) { 90 if (IsTheHotNewBubbleUIEnabled()) {
83 ManagePasswordsBubbleUIController* manage_passwords_bubble_ui_controller = 91 ManagePasswordsBubbleUIController* manage_passwords_bubble_ui_controller =
84 ManagePasswordsBubbleUIController::FromWebContents(web_contents()); 92 ManagePasswordsBubbleUIController::FromWebContents(web_contents());
85 if (manage_passwords_bubble_ui_controller) { 93 if (manage_passwords_bubble_ui_controller) {
86 manage_passwords_bubble_ui_controller->OnPasswordSubmitted(form_to_save); 94 manage_passwords_bubble_ui_controller->OnPasswordSubmitted(form_to_save);
87 } else { 95 } else {
88 delete form_to_save; 96 delete form_to_save;
89 } 97 }
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 web_contents(), 310 web_contents(),
303 web_contents()->GetView()->GetNativeView()); 311 web_contents()->GetView()->GetNativeView());
304 popup_controller_->Show(false /* display_password */); 312 popup_controller_->Show(false /* display_password */);
305 #endif // #if defined(USE_AURA) 313 #endif // #if defined(USE_AURA)
306 } 314 }
307 315
308 void ChromePasswordManagerClient::CommitFillPasswordForm( 316 void ChromePasswordManagerClient::CommitFillPasswordForm(
309 autofill::PasswordFormFillData* data) { 317 autofill::PasswordFormFillData* data) {
310 driver_.FillPasswordForm(*data); 318 driver_.FillPasswordForm(*data);
311 } 319 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698