OLD | NEW |
---|---|
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 service->UnregisterClient(this); | 102 service->UnregisterClient(this); |
103 } | 103 } |
104 | 104 |
105 bool ChromePasswordManagerClient::IsAutomaticPasswordSavingEnabled() const { | 105 bool ChromePasswordManagerClient::IsAutomaticPasswordSavingEnabled() const { |
106 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 106 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
107 password_manager::switches::kEnableAutomaticPasswordSaving) && | 107 password_manager::switches::kEnableAutomaticPasswordSaving) && |
108 chrome::VersionInfo::GetChannel() == | 108 chrome::VersionInfo::GetChannel() == |
109 chrome::VersionInfo::CHANNEL_UNKNOWN; | 109 chrome::VersionInfo::CHANNEL_UNKNOWN; |
110 } | 110 } |
111 | 111 |
112 bool ChromePasswordManagerClient::IsEnabledForCurrentPage() const { | |
vabr (Chromium)
2015/03/26 14:51:58
Thinking about the two very similarly named method
melandory
2015/03/30 09:50:17
I was also puzzled with this naming collision, but
| |
113 bool ssl_errors = DidLastPageLoadEncounterSSLErrors(); | |
114 bool client_check = IsPasswordManagerEnabledForCurrentPage(); | |
115 | |
116 scoped_ptr<password_manager::BrowserSavePasswordProgressLogger> logger; | |
vabr (Chromium)
2015/03/26 14:51:59
Because the logger is only used inside the block o
melandory
2015/03/30 09:50:17
Done.
| |
117 if (IsLoggingActive()) { | |
118 logger.reset(new password_manager::BrowserSavePasswordProgressLogger(this)); | |
119 logger->LogMessage(Logger::STRING_ENABLED_FOR_CURRENT_PAGE_METHOD); | |
120 logger->LogBoolean(Logger::STRING_SSL_ERRORS_PRESENT, ssl_errors); | |
121 logger->LogBoolean(Logger::STRING_CLIENT_CHECK_PRESENT, client_check); | |
122 } | |
123 | |
124 return !ssl_errors && client_check; | |
125 } | |
126 | |
112 bool ChromePasswordManagerClient::IsPasswordManagerEnabledForCurrentPage() | 127 bool ChromePasswordManagerClient::IsPasswordManagerEnabledForCurrentPage() |
113 const { | 128 const { |
114 DCHECK(web_contents()); | 129 DCHECK(web_contents()); |
115 content::NavigationEntry* entry = | 130 content::NavigationEntry* entry = |
116 web_contents()->GetController().GetLastCommittedEntry(); | 131 web_contents()->GetController().GetLastCommittedEntry(); |
117 if (!entry) { | 132 if (!entry) { |
118 // TODO(gcasto): Determine if fix for crbug.com/388246 is relevant here. | 133 // TODO(gcasto): Determine if fix for crbug.com/388246 is relevant here. |
119 return true; | 134 return true; |
120 } | 135 } |
121 | 136 |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
553 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; | 568 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; |
554 } else { | 569 } else { |
555 // Allow by default. | 570 // Allow by default. |
556 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; | 571 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; |
557 } | 572 } |
558 } | 573 } |
559 | 574 |
560 const GURL& ChromePasswordManagerClient::GetMainFrameURL() const { | 575 const GURL& ChromePasswordManagerClient::GetMainFrameURL() const { |
561 return web_contents()->GetVisibleURL(); | 576 return web_contents()->GetVisibleURL(); |
562 } | 577 } |
OLD | NEW |