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

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

Issue 604563003: [Password Manager] Disable autofilling for testing password websites (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/password_manager/chrome_password_manager_client_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 21 matching lines...) Expand all
32 #include "components/password_manager/core/browser/password_form_manager.h" 32 #include "components/password_manager/core/browser/password_form_manager.h"
33 #include "components/password_manager/core/browser/password_manager.h" 33 #include "components/password_manager/core/browser/password_manager.h"
34 #include "components/password_manager/core/browser/password_manager_internals_se rvice.h" 34 #include "components/password_manager/core/browser/password_manager_internals_se rvice.h"
35 #include "components/password_manager/core/browser/password_manager_metrics_util .h" 35 #include "components/password_manager/core/browser/password_manager_metrics_util .h"
36 #include "components/password_manager/core/common/password_manager_switches.h" 36 #include "components/password_manager/core/common/password_manager_switches.h"
37 #include "content/public/browser/navigation_entry.h" 37 #include "content/public/browser/navigation_entry.h"
38 #include "content/public/browser/render_view_host.h" 38 #include "content/public/browser/render_view_host.h"
39 #include "content/public/browser/web_contents.h" 39 #include "content/public/browser/web_contents.h"
40 #include "google_apis/gaia/gaia_urls.h" 40 #include "google_apis/gaia/gaia_urls.h"
41 #include "net/base/url_util.h" 41 #include "net/base/url_util.h"
42 #include "third_party/re2/re2/re2.h"
42 43
43 #if defined(OS_ANDROID) 44 #if defined(OS_ANDROID)
44 #include "chrome/browser/android/password_authentication_manager.h" 45 #include "chrome/browser/android/password_authentication_manager.h"
45 #endif // OS_ANDROID 46 #endif // OS_ANDROID
46 47
47 using password_manager::PasswordManagerInternalsService; 48 using password_manager::PasswordManagerInternalsService;
48 using password_manager::PasswordManagerInternalsServiceFactory; 49 using password_manager::PasswordManagerInternalsServiceFactory;
49 50
50 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient); 51 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient);
51 52
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 std::string param_value; 474 std::string param_value;
474 if (!net::GetValueForKeyInQuery(url, "rart", &param_value)) 475 if (!net::GetValueForKeyInQuery(url, "rart", &param_value))
475 return false; 476 return false;
476 477
477 // Check the "continue" param to see if this reauth page is for the passwords 478 // Check the "continue" param to see if this reauth page is for the passwords
478 // website. 479 // website.
479 param_value.clear(); 480 param_value.clear();
480 if (!net::GetValueForKeyInQuery(url, "continue", &param_value)) 481 if (!net::GetValueForKeyInQuery(url, "continue", &param_value))
481 return false; 482 return false;
482 483
483 return GURL(param_value).host() == 484 // All password sites, including test sites, have autofilling disabled.
484 GURL(chrome::kPasswordManagerAccountDashboardURL).host(); 485 CR_DEFINE_STATIC_LOCAL(RE2, account_dashboard_pattern,
486 ("passwords(-([a-z]+\\.corp))?\\.google\\.com"));
Mike West 2014/09/25 08:26:19 Only google.com? Or do we need to account for othe
Garrett Casto 2014/09/25 22:17:03 Only google.com. This will not be on other TLDs.
487
488 return RE2::FullMatch(GURL(param_value).host(), account_dashboard_pattern);
485 } 489 }
486 490
487 bool ChromePasswordManagerClient::IsTheHotNewBubbleUIEnabled() { 491 bool ChromePasswordManagerClient::IsTheHotNewBubbleUIEnabled() {
488 #if !defined(USE_AURA) && !defined(OS_MACOSX) 492 #if !defined(USE_AURA) && !defined(OS_MACOSX)
489 return false; 493 return false;
490 #endif 494 #endif
491 CommandLine* command_line = CommandLine::ForCurrentProcess(); 495 CommandLine* command_line = CommandLine::ForCurrentProcess();
492 if (command_line->HasSwitch(switches::kDisableSavePasswordBubble)) 496 if (command_line->HasSwitch(switches::kDisableSavePasswordBubble))
493 return false; 497 return false;
494 498
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 546
543 if (group_name == "DisallowSyncCredentialsForReauth") { 547 if (group_name == "DisallowSyncCredentialsForReauth") {
544 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH; 548 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH;
545 } else if (group_name == "DisallowSyncCredentials") { 549 } else if (group_name == "DisallowSyncCredentials") {
546 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; 550 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS;
547 } else { 551 } else {
548 // Allow by default. 552 // Allow by default.
549 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; 553 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS;
550 } 554 }
551 } 555 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/password_manager/chrome_password_manager_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698