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

Side by Side Diff: components/password_manager/content/browser/credential_manager_impl.cc

Issue 2947413002: Restrict CM API interface request and message dispatch. (Closed)
Patch Set: With fix. Created 3 years, 6 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 "components/password_manager/content/browser/credential_manager_impl.h" 5 #include "components/password_manager/content/browser/credential_manager_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 22 matching lines...) Expand all
33 const CredentialInfo& info) { 33 const CredentialInfo& info) {
34 std::move(callback).Run(mojom::CredentialManagerError::SUCCESS, info); 34 std::move(callback).Run(mojom::CredentialManagerError::SUCCESS, info);
35 } 35 }
36 36
37 } // namespace 37 } // namespace
38 38
39 // CredentialManagerImpl ------------------------------------------------- 39 // CredentialManagerImpl -------------------------------------------------
40 40
41 CredentialManagerImpl::CredentialManagerImpl(content::WebContents* web_contents, 41 CredentialManagerImpl::CredentialManagerImpl(content::WebContents* web_contents,
42 PasswordManagerClient* client) 42 PasswordManagerClient* client)
43 : WebContentsObserver(web_contents), client_(client), weak_factory_(this) { 43 : WebContentsObserver(web_contents),
44 client_(client),
45 binding_(this),
46 weak_factory_(this) {
44 DCHECK(web_contents); 47 DCHECK(web_contents);
45 auto_signin_enabled_.Init(prefs::kCredentialsEnableAutosignin, 48 auto_signin_enabled_.Init(prefs::kCredentialsEnableAutosignin,
46 client_->GetPrefs()); 49 client_->GetPrefs());
47 } 50 }
48 51
49 CredentialManagerImpl::~CredentialManagerImpl() {} 52 CredentialManagerImpl::~CredentialManagerImpl() {}
50 53
51 void CredentialManagerImpl::BindRequest( 54 void CredentialManagerImpl::BindRequest(
52 mojom::CredentialManagerRequest request) { 55 mojom::CredentialManagerRequest request) {
53 bindings_.AddBinding(this, std::move(request)); 56 DCHECK(!binding_.is_bound());
57 binding_.Bind(std::move(request));
58 }
59
60 void CredentialManagerImpl::DisconnectBinding() {
61 binding_.Close();
54 } 62 }
55 63
56 void CredentialManagerImpl::Store(const CredentialInfo& credential, 64 void CredentialManagerImpl::Store(const CredentialInfo& credential,
57 StoreCallback callback) { 65 StoreCallback callback) {
58 DCHECK_NE(CredentialType::CREDENTIAL_TYPE_EMPTY, credential.type); 66 DCHECK_NE(CredentialType::CREDENTIAL_TYPE_EMPTY, credential.type);
59 67
60 if (password_manager_util::IsLoggingActive(client_)) { 68 if (password_manager_util::IsLoggingActive(client_)) {
61 CredentialManagerLogger(client_->GetLogManager()) 69 CredentialManagerLogger(client_->GetLogManager())
62 .LogStoreCredential(web_contents()->GetLastCommittedURL(), 70 .LogStoreCredential(web_contents()->GetLastCommittedURL(),
63 credential.type); 71 credential.type);
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 PasswordStore::FormDigest CredentialManagerImpl::GetSynthesizedFormForOrigin() 287 PasswordStore::FormDigest CredentialManagerImpl::GetSynthesizedFormForOrigin()
280 const { 288 const {
281 PasswordStore::FormDigest digest = { 289 PasswordStore::FormDigest digest = {
282 autofill::PasswordForm::SCHEME_HTML, std::string(), 290 autofill::PasswordForm::SCHEME_HTML, std::string(),
283 web_contents()->GetLastCommittedURL().GetOrigin()}; 291 web_contents()->GetLastCommittedURL().GetOrigin()};
284 digest.signon_realm = digest.origin.spec(); 292 digest.signon_realm = digest.origin.spec();
285 return digest; 293 return digest;
286 } 294 }
287 295
288 } // namespace password_manager 296 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698