| 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 // Always use EXPLICIT_ACCESS as the password manager checks IsOffTheRecord | 300 // Always use EXPLICIT_ACCESS as the password manager checks IsOffTheRecord |
| 301 // itself when it shouldn't access the PasswordStore. | 301 // itself when it shouldn't access the PasswordStore. |
| 302 // TODO(gcasto): Is is safe to change this to | 302 // TODO(gcasto): Is is safe to change this to |
| 303 // ServiceAccessType::IMPLICIT_ACCESS? | 303 // ServiceAccessType::IMPLICIT_ACCESS? |
| 304 return PasswordStoreFactory::GetForProfile( | 304 return PasswordStoreFactory::GetForProfile( |
| 305 profile_, ServiceAccessType::EXPLICIT_ACCESS).get(); | 305 profile_, ServiceAccessType::EXPLICIT_ACCESS).get(); |
| 306 } | 306 } |
| 307 | 307 |
| 308 password_manager::PasswordSyncState | 308 password_manager::PasswordSyncState |
| 309 ChromePasswordManagerClient::GetPasswordSyncState() const { | 309 ChromePasswordManagerClient::GetPasswordSyncState() const { |
| 310 ProfileSyncService* sync_service = | 310 const ProfileSyncService* sync_service = |
| 311 ProfileSyncServiceFactory::GetForProfile(profile_); | 311 ProfileSyncServiceFactory::GetForProfile(profile_); |
| 312 if (sync_service && sync_service->HasSyncSetupCompleted() && | 312 return password_manager_util::GetPasswordSyncState(sync_service); |
| 313 sync_service->SyncActive() && | |
| 314 sync_service->GetActiveDataTypes().Has(syncer::PASSWORDS)) { | |
| 315 return sync_service->IsUsingSecondaryPassphrase() | |
| 316 ? password_manager::SYNCING_WITH_CUSTOM_PASSPHRASE | |
| 317 : password_manager::SYNCING_NORMAL_ENCRYPTION; | |
| 318 } | |
| 319 return password_manager::NOT_SYNCING_PASSWORDS; | |
| 320 } | 313 } |
| 321 | 314 |
| 322 void ChromePasswordManagerClient::OnLogRouterAvailabilityChanged( | 315 void ChromePasswordManagerClient::OnLogRouterAvailabilityChanged( |
| 323 bool router_can_be_used) { | 316 bool router_can_be_used) { |
| 324 if (can_use_log_router_ == router_can_be_used) | 317 if (can_use_log_router_ == router_can_be_used) |
| 325 return; | 318 return; |
| 326 can_use_log_router_ = router_can_be_used; | 319 can_use_log_router_ = router_can_be_used; |
| 327 | 320 |
| 328 NotifyRendererOfLoggingAvailability(); | 321 NotifyRendererOfLoggingAvailability(); |
| 329 } | 322 } |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; | 577 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; |
| 585 } else { | 578 } else { |
| 586 // Allow by default. | 579 // Allow by default. |
| 587 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; | 580 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; |
| 588 } | 581 } |
| 589 } | 582 } |
| 590 | 583 |
| 591 const GURL& ChromePasswordManagerClient::GetMainFrameURL() const { | 584 const GURL& ChromePasswordManagerClient::GetMainFrameURL() const { |
| 592 return web_contents()->GetVisibleURL(); | 585 return web_contents()->GetVisibleURL(); |
| 593 } | 586 } |
| OLD | NEW |