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

Side by Side Diff: chrome/browser/permissions/permission_blacklist_client.cc

Issue 2684523002: Check result of ApiBlacklist query in client. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/permissions/permission_blacklist_client.h" 5 #include "chrome/browser/permissions/permission_blacklist_client.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 54 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
55 55
56 // Start the timer to interrupt into the client callback method with an 56 // Start the timer to interrupt into the client callback method with an
57 // empty response if Safe Browsing times out. 57 // empty response if Safe Browsing times out.
58 safe_browsing::ThreatMetadata empty_metadata; 58 safe_browsing::ThreatMetadata empty_metadata;
59 timer_ = base::MakeUnique<base::OneShotTimer>(); 59 timer_ = base::MakeUnique<base::OneShotTimer>();
60 timer_->Start( 60 timer_->Start(
61 FROM_HERE, base::TimeDelta::FromMilliseconds(timeout_), 61 FROM_HERE, base::TimeDelta::FromMilliseconds(timeout_),
62 base::Bind(&PermissionBlacklistClient::OnCheckApiBlacklistUrlResult, this, 62 base::Bind(&PermissionBlacklistClient::OnCheckApiBlacklistUrlResult, this,
63 request_origin, empty_metadata)); 63 request_origin, empty_metadata));
64 db_manager_->CheckApiBlacklistUrl(request_origin, this); 64
65 // If CheckApiBlacklistUrl returns true, no asynchronous call to |this| will
66 // be made, so just directly call through to OnCheckApiBlacklistUrlResult.
67 if (db_manager_->CheckApiBlacklistUrl(request_origin, this))
68 this->OnCheckApiBlacklistUrlResult(request_origin, empty_metadata);
dominickn 2017/02/07 08:27:06 Nit: no need for this->
meredithl 2017/02/08 00:58:03 Done.
65 } 69 }
66 70
67 void PermissionBlacklistClient::OnCheckApiBlacklistUrlResult( 71 void PermissionBlacklistClient::OnCheckApiBlacklistUrlResult(
68 const GURL& url, 72 const GURL& url,
69 const safe_browsing::ThreatMetadata& metadata) { 73 const safe_browsing::ThreatMetadata& metadata) {
70 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 74 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
71 75
72 if (timer_->IsRunning()) 76 if (timer_->IsRunning())
73 timer_->Stop(); 77 timer_->Stop();
74 else 78 else
(...skipping 17 matching lines...) Expand all
92 96
93 if (is_active_) 97 if (is_active_)
94 callback_.Run(permission_blocked); 98 callback_.Run(permission_blocked);
95 Release(); 99 Release();
96 } 100 }
97 101
98 void PermissionBlacklistClient::WebContentsDestroyed() { 102 void PermissionBlacklistClient::WebContentsDestroyed() {
99 is_active_ = false; 103 is_active_ = false;
100 Observe(nullptr); 104 Observe(nullptr);
101 } 105 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698