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

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

Issue 344033008: [Password Manager] Disable saving and filling on sync signup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests Created 6 years, 5 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 | Annotate | Revision Log
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_ui_controller.h" 18 #include "chrome/browser/ui/passwords/manage_passwords_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 "chrome/common/url_constants.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/content/browser/password_manager_internals _service_factory.h" 25 #include "components/password_manager/content/browser/password_manager_internals _service_factory.h"
25 #include "components/password_manager/core/browser/log_receiver.h" 26 #include "components/password_manager/core/browser/log_receiver.h"
26 #include "components/password_manager/core/browser/password_form_manager.h" 27 #include "components/password_manager/core/browser/password_form_manager.h"
27 #include "components/password_manager/core/browser/password_manager.h" 28 #include "components/password_manager/core/browser/password_manager.h"
28 #include "components/password_manager/core/browser/password_manager_internals_se rvice.h" 29 #include "components/password_manager/core/browser/password_manager_internals_se rvice.h"
29 #include "components/password_manager/core/browser/password_manager_metrics_util .h" 30 #include "components/password_manager/core/browser/password_manager_metrics_util .h"
30 #include "components/password_manager/core/common/password_manager_switches.h" 31 #include "components/password_manager/core/common/password_manager_switches.h"
32 #include "content/public/browser/navigation_entry.h"
31 #include "content/public/browser/render_view_host.h" 33 #include "content/public/browser/render_view_host.h"
32 #include "content/public/browser/web_contents.h" 34 #include "content/public/browser/web_contents.h"
33 35
34 #if defined(OS_ANDROID) 36 #if defined(OS_ANDROID)
35 #include "chrome/browser/android/password_authentication_manager.h" 37 #include "chrome/browser/android/password_authentication_manager.h"
36 #endif // OS_ANDROID 38 #endif // OS_ANDROID
37 39
38 using password_manager::PasswordManagerInternalsService; 40 using password_manager::PasswordManagerInternalsService;
39 using password_manager::PasswordManagerInternalsServiceFactory; 41 using password_manager::PasswordManagerInternalsServiceFactory;
40 42
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 service->UnregisterClient(this); 96 service->UnregisterClient(this);
95 } 97 }
96 98
97 bool ChromePasswordManagerClient::IsAutomaticPasswordSavingEnabled() const { 99 bool ChromePasswordManagerClient::IsAutomaticPasswordSavingEnabled() const {
98 return CommandLine::ForCurrentProcess()->HasSwitch( 100 return CommandLine::ForCurrentProcess()->HasSwitch(
99 password_manager::switches::kEnableAutomaticPasswordSaving) && 101 password_manager::switches::kEnableAutomaticPasswordSaving) &&
100 chrome::VersionInfo::GetChannel() == 102 chrome::VersionInfo::GetChannel() ==
101 chrome::VersionInfo::CHANNEL_UNKNOWN; 103 chrome::VersionInfo::CHANNEL_UNKNOWN;
102 } 104 }
103 105
106 bool ChromePasswordManagerClient::IsPasswordManagerEnabledForCurrentPage()
107 const {
108 DCHECK(web_contents());
109 content::NavigationEntry* entry =
110 web_contents()->GetController().GetLastCommittedEntry();
111 if (!entry) {
112 NOTREACHED();
vabr (Chromium) 2014/06/24 08:49:49 Could we leave out the NOTREACHED? I'm currently w
vabr (Chromium) 2014/06/24 14:28:24 I looked into the NOTREACHED a bit more: http://cr
Garrett Casto 2014/07/07 21:09:02 Added.
113 return true;
114 }
115 // We neither fill nor save password when a user is signing in for sync. This
116 // is because users need to remember their password if they are syncing as
117 // this is effectively their master password.
118 return entry->GetURL().host() != chrome::kChromeUIChromeSigninHost;
Roger Tawa OOO till Jul 10th 2014/06/26 14:15:05 The chrome://chrome-signin/ page hosts a regular g
Garrett Casto 2014/07/07 21:09:02 Yeah, as long as we can uniquely identify the page
119 }
120
104 void ChromePasswordManagerClient::PromptUserToSavePassword( 121 void ChromePasswordManagerClient::PromptUserToSavePassword(
105 password_manager::PasswordFormManager* form_to_save) { 122 password_manager::PasswordFormManager* form_to_save) {
106 if (IsTheHotNewBubbleUIEnabled()) { 123 if (IsTheHotNewBubbleUIEnabled()) {
107 ManagePasswordsUIController* manage_passwords_ui_controller = 124 ManagePasswordsUIController* manage_passwords_ui_controller =
108 ManagePasswordsUIController::FromWebContents(web_contents()); 125 ManagePasswordsUIController::FromWebContents(web_contents());
109 if (manage_passwords_ui_controller) { 126 if (manage_passwords_ui_controller) {
110 manage_passwords_ui_controller->OnPasswordSubmitted(form_to_save); 127 manage_passwords_ui_controller->OnPasswordSubmitted(form_to_save);
111 } else { 128 } else {
112 delete form_to_save; 129 delete form_to_save;
113 } 130 }
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 web_contents(), 344 web_contents(),
328 web_contents()->GetNativeView()); 345 web_contents()->GetNativeView());
329 popup_controller_->Show(false /* display_password */); 346 popup_controller_->Show(false /* display_password */);
330 #endif // defined(USE_AURA) || defined(OS_MACOSX) 347 #endif // defined(USE_AURA) || defined(OS_MACOSX)
331 } 348 }
332 349
333 void ChromePasswordManagerClient::CommitFillPasswordForm( 350 void ChromePasswordManagerClient::CommitFillPasswordForm(
334 autofill::PasswordFormFillData* data) { 351 autofill::PasswordFormFillData* data) {
335 driver_.FillPasswordForm(*data); 352 driver_.FillPasswordForm(*data);
336 } 353 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698