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

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

Issue 1668523002: [Password Manager] Switch password manager code to use the Feature framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses Vaclav's inputs. Created 4 years, 9 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 <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 28 matching lines...) Expand all
39 #include "components/password_manager/core/browser/log_receiver.h" 39 #include "components/password_manager/core/browser/log_receiver.h"
40 #include "components/password_manager/core/browser/password_bubble_experiment.h" 40 #include "components/password_manager/core/browser/password_bubble_experiment.h"
41 #include "components/password_manager/core/browser/password_form_manager.h" 41 #include "components/password_manager/core/browser/password_form_manager.h"
42 #include "components/password_manager/core/browser/password_manager_internals_se rvice.h" 42 #include "components/password_manager/core/browser/password_manager_internals_se rvice.h"
43 #include "components/password_manager/core/browser/password_manager_metrics_util .h" 43 #include "components/password_manager/core/browser/password_manager_metrics_util .h"
44 #include "components/password_manager/core/browser/password_manager_settings_mig ration_experiment.h" 44 #include "components/password_manager/core/browser/password_manager_settings_mig ration_experiment.h"
45 #include "components/password_manager/core/browser/password_manager_util.h" 45 #include "components/password_manager/core/browser/password_manager_util.h"
46 #include "components/password_manager/core/common/credential_manager_types.h" 46 #include "components/password_manager/core/common/credential_manager_types.h"
47 #include "components/password_manager/core/common/password_manager_features.h" 47 #include "components/password_manager/core/common/password_manager_features.h"
48 #include "components/password_manager/core/common/password_manager_pref_names.h" 48 #include "components/password_manager/core/common/password_manager_pref_names.h"
49 #include "components/password_manager/core/common/password_manager_switches.h"
50 #include "components/password_manager/sync/browser/password_sync_util.h" 49 #include "components/password_manager/sync/browser/password_sync_util.h"
51 #include "components/prefs/pref_service.h" 50 #include "components/prefs/pref_service.h"
52 #include "components/signin/core/browser/signin_manager.h" 51 #include "components/signin/core/browser/signin_manager.h"
53 #include "components/version_info/version_info.h" 52 #include "components/version_info/version_info.h"
54 #include "content/public/browser/navigation_entry.h" 53 #include "content/public/browser/navigation_entry.h"
55 #include "content/public/browser/render_view_host.h" 54 #include "content/public/browser/render_view_host.h"
56 #include "content/public/browser/web_contents.h" 55 #include "content/public/browser/web_contents.h"
57 #include "google_apis/gaia/gaia_urls.h" 56 #include "google_apis/gaia/gaia_urls.h"
58 #include "net/base/url_util.h" 57 #include "net/base/url_util.h"
59 #include "third_party/re2/src/re2/re2.h" 58 #include "third_party/re2/src/re2/re2.h"
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 return true; 582 return true;
584 583
585 // The bubble should be the default case that runs on the bots. 584 // The bubble should be the default case that runs on the bots.
586 return group_name != "Infobar"; 585 return group_name != "Infobar";
587 #else 586 #else
588 // All other platforms use Aura, and therefore always show the bubble. 587 // All other platforms use Aura, and therefore always show the bubble.
589 return true; 588 return true;
590 #endif 589 #endif
591 } 590 }
592 591
592 bool ChromePasswordManagerClient::EnabledForSyncSignin() {
593 return base::FeatureList::IsEnabled(
594 password_manager::features::kManagerForSyncSignin);
595 }
596
593 bool ChromePasswordManagerClient::IsUpdatePasswordUIEnabled() const { 597 bool ChromePasswordManagerClient::IsUpdatePasswordUIEnabled() const {
594 #if BUILDFLAG(ANDROID_JAVA_UI) 598 #if BUILDFLAG(ANDROID_JAVA_UI)
595 return base::FeatureList::IsEnabled( 599 return base::FeatureList::IsEnabled(
596 password_manager::features::kEnablePasswordChangeSupport); 600 password_manager::features::kEnablePasswordChangeSupport);
597 #else 601 #else
598 return IsTheHotNewBubbleUIEnabled(); 602 return IsTheHotNewBubbleUIEnabled();
599 #endif 603 #endif
600 } 604 }
601 605
602 bool ChromePasswordManagerClient::EnabledForSyncSignin() {
603 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
604 if (command_line->HasSwitch(
605 password_manager::switches::kDisableManagerForSyncSignin))
606 return false;
607
608 if (command_line->HasSwitch(
609 password_manager::switches::kEnableManagerForSyncSignin))
610 return true;
611
612 // Default is enabled.
613 std::string group_name =
614 base::FieldTrialList::FindFullName("PasswordManagerStateForSyncSignin");
615 return group_name != "Disabled";
616 }
617
618 const GURL& ChromePasswordManagerClient::GetMainFrameURL() const { 606 const GURL& ChromePasswordManagerClient::GetMainFrameURL() const {
619 return web_contents()->GetVisibleURL(); 607 return web_contents()->GetVisibleURL();
620 } 608 }
621 609
622 const GURL& ChromePasswordManagerClient::GetLastCommittedEntryURL() const { 610 const GURL& ChromePasswordManagerClient::GetLastCommittedEntryURL() const {
623 DCHECK(web_contents()); 611 DCHECK(web_contents());
624 content::NavigationEntry* entry = 612 content::NavigationEntry* entry =
625 web_contents()->GetController().GetLastCommittedEntry(); 613 web_contents()->GetController().GetLastCommittedEntry();
626 if (!entry) 614 if (!entry)
627 return GURL::EmptyGURL(); 615 return GURL::EmptyGURL();
628 616
629 return entry->GetURL(); 617 return entry->GetURL();
630 } 618 }
631 619
632 const password_manager::CredentialsFilter* 620 const password_manager::CredentialsFilter*
633 ChromePasswordManagerClient::GetStoreResultFilter() const { 621 ChromePasswordManagerClient::GetStoreResultFilter() const {
634 return &credentials_filter_; 622 return &credentials_filter_;
635 } 623 }
636 624
637 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() 625 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager()
638 const { 626 const {
639 return log_manager_.get(); 627 return log_manager_.get();
640 } 628 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698