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

Side by Side Diff: ios/chrome/browser/passwords/credential_manager.mm

Issue 2132593002: Remove remaining calls to deprecated MessageLoop methods on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: h264_vt_encoder_unittest.cc Created 4 years, 5 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #import "ios/chrome/browser/passwords/credential_manager.h" 5 #import "ios/chrome/browser/passwords/credential_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/ios/ios_util.h" 9 #include "base/ios/ios_util.h"
10 #import "base/ios/weak_nsobject.h" 10 #import "base/ios/weak_nsobject.h"
11 #include "base/mac/bind_objc_block.h" 11 #include "base/mac/bind_objc_block.h"
12 #include "base/memory/scoped_vector.h" 12 #include "base/memory/scoped_vector.h"
13 #include "base/message_loop/message_loop.h"
14 #include "base/strings/sys_string_conversions.h" 13 #include "base/strings/sys_string_conversions.h"
14 #include "base/threading/thread_task_runner_handle.h"
15 #include "components/password_manager/core/browser/password_store_consumer.h" 15 #include "components/password_manager/core/browser/password_store_consumer.h"
16 #include "components/password_manager/core/common/credential_manager_types.h" 16 #include "components/password_manager/core/common/credential_manager_types.h"
17 #include "components/password_manager/core/common/password_manager_pref_names.h" 17 #include "components/password_manager/core/common/password_manager_pref_names.h"
18 #import "ios/chrome/browser/passwords/js_credential_manager.h" 18 #import "ios/chrome/browser/passwords/js_credential_manager.h"
19 #import "ios/web/public/url_scheme_util.h" 19 #import "ios/web/public/url_scheme_util.h"
20 #include "ios/web/public/web_state/credential.h" 20 #include "ios/web/public/web_state/credential.h"
21 #include "ios/web/public/web_state/url_verification_constants.h" 21 #include "ios/web/public/web_state/url_verification_constants.h"
22 #include "ios/web/public/web_state/web_state.h" 22 #include "ios/web/public/web_state/web_state.h"
23 #include "url/origin.h" 23 #include "url/origin.h"
24 24
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // function will attempt to retrieve a Credential from the PasswordStore that 118 // function will attempt to retrieve a Credential from the PasswordStore that
119 // meets the specified parameters and, if successful, send it back to the page 119 // meets the specified parameters and, if successful, send it back to the page
120 // via SendCredentialByID. 120 // via SendCredentialByID.
121 DCHECK_GE(request_id, 0); 121 DCHECK_GE(request_id, 0);
122 password_manager::PasswordStore* store = GetPasswordStore(); 122 password_manager::PasswordStore* store = GetPasswordStore();
123 123
124 // If there's an outstanding request, or the PasswordStore isn't loaded yet, 124 // If there's an outstanding request, or the PasswordStore isn't loaded yet,
125 // the request should fail outright and the JS Promise should be rejected 125 // the request should fail outright and the JS Promise should be rejected
126 // with an appropriate error. 126 // with an appropriate error.
127 if (pending_request_ || !store) { 127 if (pending_request_ || !store) {
128 base::MessageLoop::current()->PostTask( 128 base::ThreadTaskRunnerHandle::Get()->PostTask(
129 FROM_HERE, 129 FROM_HERE,
130 base::Bind(&CredentialManager::RejectPromise, 130 base::Bind(&CredentialManager::RejectPromise,
131 weak_factory_.GetWeakPtr(), request_id, 131 weak_factory_.GetWeakPtr(), request_id,
132 pending_request_ ? ERROR_TYPE_PENDING_REQUEST 132 pending_request_ ? ERROR_TYPE_PENDING_REQUEST
133 : ERROR_TYPE_PASSWORD_STORE_UNAVAILABLE)); 133 : ERROR_TYPE_PASSWORD_STORE_UNAVAILABLE));
134 return; 134 return;
135 } 135 }
136 136
137 // If the page requested a zero-click credential -- one that can be returned 137 // If the page requested a zero-click credential -- one that can be returned
138 // without first asking the user -- and if zero-click isn't currently 138 // without first asking the user -- and if zero-click isn't currently
139 // available, send back an empty credential. 139 // available, send back an empty credential.
140 if (zero_click_only && !IsZeroClickAllowed()) { 140 if (zero_click_only && !IsZeroClickAllowed()) {
141 base::MessageLoop::current()->PostTask( 141 base::ThreadTaskRunnerHandle::Get()->PostTask(
142 FROM_HERE, base::Bind(&CredentialManager::SendCredentialByID, 142 FROM_HERE, base::Bind(&CredentialManager::SendCredentialByID,
143 weak_factory_.GetWeakPtr(), request_id, 143 weak_factory_.GetWeakPtr(), request_id,
144 password_manager::CredentialInfo())); 144 password_manager::CredentialInfo()));
145 return; 145 return;
146 } 146 }
147 147
148 // If the page origin is untrusted, the request should be rejected. 148 // If the page origin is untrusted, the request should be rejected.
149 GURL page_url; 149 GURL page_url;
150 if (!GetUrlWithAbsoluteTrust(&page_url)) { 150 if (!GetUrlWithAbsoluteTrust(&page_url)) {
151 RejectPromise(request_id, ERROR_TYPE_SECURITY_ERROR_UNTRUSTED_ORIGIN); 151 RejectPromise(request_id, ERROR_TYPE_SECURITY_ERROR_UNTRUSTED_ORIGIN);
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 bool CredentialManager::GetUrlWithAbsoluteTrust(GURL* page_url) { 377 bool CredentialManager::GetUrlWithAbsoluteTrust(GURL* page_url) {
378 web::URLVerificationTrustLevel trust_level = 378 web::URLVerificationTrustLevel trust_level =
379 web::URLVerificationTrustLevel::kNone; 379 web::URLVerificationTrustLevel::kNone;
380 const GURL possibly_untrusted_url(web_state()->GetCurrentURL(&trust_level)); 380 const GURL possibly_untrusted_url(web_state()->GetCurrentURL(&trust_level));
381 if (trust_level == web::URLVerificationTrustLevel::kAbsolute) { 381 if (trust_level == web::URLVerificationTrustLevel::kAbsolute) {
382 *page_url = possibly_untrusted_url; 382 *page_url = possibly_untrusted_url;
383 return true; 383 return true;
384 } 384 }
385 return false; 385 return false;
386 } 386 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/infobars/infobar_container_ios.mm ('k') | ios/chrome/browser/signin/browser_state_data_remover.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698