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

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

Issue 816403003: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years, 12 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"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 97 }
98 98
99 ChromePasswordManagerClient::~ChromePasswordManagerClient() { 99 ChromePasswordManagerClient::~ChromePasswordManagerClient() {
100 PasswordManagerInternalsService* service = 100 PasswordManagerInternalsService* service =
101 PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile_); 101 PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile_);
102 if (service) 102 if (service)
103 service->UnregisterClient(this); 103 service->UnregisterClient(this);
104 } 104 }
105 105
106 bool ChromePasswordManagerClient::IsAutomaticPasswordSavingEnabled() const { 106 bool ChromePasswordManagerClient::IsAutomaticPasswordSavingEnabled() const {
107 return CommandLine::ForCurrentProcess()->HasSwitch( 107 return base::CommandLine::ForCurrentProcess()->HasSwitch(
108 password_manager::switches::kEnableAutomaticPasswordSaving) && 108 password_manager::switches::kEnableAutomaticPasswordSaving) &&
109 chrome::VersionInfo::GetChannel() == 109 chrome::VersionInfo::GetChannel() ==
110 chrome::VersionInfo::CHANNEL_UNKNOWN; 110 chrome::VersionInfo::CHANNEL_UNKNOWN;
111 } 111 }
112 112
113 bool ChromePasswordManagerClient::IsPasswordManagerEnabledForCurrentPage() 113 bool ChromePasswordManagerClient::IsPasswordManagerEnabledForCurrentPage()
114 const { 114 const {
115 DCHECK(web_contents()); 115 DCHECK(web_contents());
116 content::NavigationEntry* entry = 116 content::NavigationEntry* entry =
117 web_contents()->GetController().GetLastCommittedEntry(); 117 web_contents()->GetController().GetLastCommittedEntry();
118 if (!entry) { 118 if (!entry) {
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 CR_DEFINE_STATIC_LOCAL(RE2, account_dashboard_pattern, 498 CR_DEFINE_STATIC_LOCAL(RE2, account_dashboard_pattern,
499 ("passwords(-([a-z-]+\\.corp))?\\.google\\.com")); 499 ("passwords(-([a-z-]+\\.corp))?\\.google\\.com"));
500 500
501 return RE2::FullMatch(GURL(param_value).host(), account_dashboard_pattern); 501 return RE2::FullMatch(GURL(param_value).host(), account_dashboard_pattern);
502 } 502 }
503 503
504 bool ChromePasswordManagerClient::IsTheHotNewBubbleUIEnabled() { 504 bool ChromePasswordManagerClient::IsTheHotNewBubbleUIEnabled() {
505 #if !defined(USE_AURA) && !defined(OS_MACOSX) 505 #if !defined(USE_AURA) && !defined(OS_MACOSX)
506 return false; 506 return false;
507 #endif 507 #endif
508 CommandLine* command_line = CommandLine::ForCurrentProcess(); 508 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
509 if (command_line->HasSwitch(switches::kDisableSavePasswordBubble)) 509 if (command_line->HasSwitch(switches::kDisableSavePasswordBubble))
510 return false; 510 return false;
511 511
512 if (command_line->HasSwitch(switches::kEnableSavePasswordBubble)) 512 if (command_line->HasSwitch(switches::kEnableSavePasswordBubble))
513 return true; 513 return true;
514 514
515 std::string group_name = 515 std::string group_name =
516 base::FieldTrialList::FindFullName("PasswordManagerUI"); 516 base::FieldTrialList::FindFullName("PasswordManagerUI");
517 517
518 // The bubble should be the default case that runs on the bots. 518 // The bubble should be the default case that runs on the bots.
519 return group_name != "Infobar"; 519 return group_name != "Infobar";
520 } 520 }
521 521
522 bool ChromePasswordManagerClient::EnabledForSyncSignin() { 522 bool ChromePasswordManagerClient::EnabledForSyncSignin() {
523 CommandLine* command_line = CommandLine::ForCurrentProcess(); 523 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
524 if (command_line->HasSwitch( 524 if (command_line->HasSwitch(
525 password_manager::switches::kDisableManagerForSyncSignin)) 525 password_manager::switches::kDisableManagerForSyncSignin))
526 return false; 526 return false;
527 527
528 if (command_line->HasSwitch( 528 if (command_line->HasSwitch(
529 password_manager::switches::kEnableManagerForSyncSignin)) 529 password_manager::switches::kEnableManagerForSyncSignin))
530 return true; 530 return true;
531 531
532 // Default is enabled. 532 // Default is enabled.
533 std::string group_name = 533 std::string group_name =
534 base::FieldTrialList::FindFullName("PasswordManagerStateForSyncSignin"); 534 base::FieldTrialList::FindFullName("PasswordManagerStateForSyncSignin");
535 return group_name != "Disabled"; 535 return group_name != "Disabled";
536 } 536 }
537 537
538 void ChromePasswordManagerClient::SetUpAutofillSyncState() { 538 void ChromePasswordManagerClient::SetUpAutofillSyncState() {
539 std::string group_name = 539 std::string group_name =
540 base::FieldTrialList::FindFullName("AutofillSyncCredential"); 540 base::FieldTrialList::FindFullName("AutofillSyncCredential");
541 541
542 CommandLine* command_line = CommandLine::ForCurrentProcess(); 542 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
543 if (command_line->HasSwitch( 543 if (command_line->HasSwitch(
544 password_manager::switches::kAllowAutofillSyncCredential)) { 544 password_manager::switches::kAllowAutofillSyncCredential)) {
545 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; 545 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS;
546 return; 546 return;
547 } 547 }
548 if (command_line->HasSwitch( 548 if (command_line->HasSwitch(
549 password_manager::switches:: 549 password_manager::switches::
550 kDisallowAutofillSyncCredentialForReauth)) { 550 kDisallowAutofillSyncCredentialForReauth)) {
551 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH; 551 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH;
552 return; 552 return;
(...skipping 10 matching lines...) Expand all
563 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; 563 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS;
564 } else { 564 } else {
565 // Allow by default. 565 // Allow by default.
566 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; 566 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS;
567 } 567 }
568 } 568 }
569 569
570 const GURL& ChromePasswordManagerClient::GetMainFrameURL() { 570 const GURL& ChromePasswordManagerClient::GetMainFrameURL() {
571 return web_contents()->GetVisibleURL(); 571 return web_contents()->GetVisibleURL();
572 } 572 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698