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

Side by Side Diff: chrome/browser/extensions/blacklist_state_fetcher.cc

Issue 1112573002: [chrome/browser/extensions] Replace MessageLoopProxy usage with ThreadTaskRunnerHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolving ng browser unittest issues Created 5 years, 7 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 | « chrome/browser/extensions/blacklist.cc ('k') | chrome/browser/extensions/blacklist_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/extensions/blacklist_state_fetcher.h" 5 #include "chrome/browser/extensions/blacklist_state_fetcher.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/thread_task_runner_handle.h"
9 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/safe_browsing/protocol_manager_helper.h" 11 #include "chrome/browser/safe_browsing/protocol_manager_helper.h"
11 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 12 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
12 #include "chrome/common/safe_browsing/crx_info.pb.h" 13 #include "chrome/common/safe_browsing/crx_info.pb.h"
13 #include "google_apis/google_api_keys.h" 14 #include "google_apis/google_api_keys.h"
14 #include "net/base/escape.h" 15 #include "net/base/escape.h"
15 #include "net/url_request/url_request_context.h" 16 #include "net/url_request/url_request_context.h"
16 #include "net/url_request/url_request_context_getter.h" 17 #include "net/url_request/url_request_context_getter.h"
17 #include "net/url_request/url_request_status.h" 18 #include "net/url_request/url_request_status.h"
18 #include "url/gurl.h" 19 #include "url/gurl.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 82 }
82 83
83 void BlacklistStateFetcher::Request(const std::string& id, 84 void BlacklistStateFetcher::Request(const std::string& id,
84 const RequestCallback& callback) { 85 const RequestCallback& callback) {
85 DCHECK_CURRENTLY_ON(BrowserThread::UI); 86 DCHECK_CURRENTLY_ON(BrowserThread::UI);
86 if (!safe_browsing_config_) { 87 if (!safe_browsing_config_) {
87 if (g_browser_process && g_browser_process->safe_browsing_service()) { 88 if (g_browser_process && g_browser_process->safe_browsing_service()) {
88 SetSafeBrowsingConfig( 89 SetSafeBrowsingConfig(
89 g_browser_process->safe_browsing_service()->GetProtocolConfig()); 90 g_browser_process->safe_browsing_service()->GetProtocolConfig());
90 } else { 91 } else {
91 base::MessageLoopProxy::current()->PostTask( 92 base::ThreadTaskRunnerHandle::Get()->PostTask(
92 FROM_HERE, base::Bind(callback, BLACKLISTED_UNKNOWN)); 93 FROM_HERE, base::Bind(callback, BLACKLISTED_UNKNOWN));
93 return; 94 return;
94 } 95 }
95 } 96 }
96 97
97 bool request_already_sent = ContainsKey(callbacks_, id); 98 bool request_already_sent = ContainsKey(callbacks_, id);
98 callbacks_.insert(std::make_pair(id, callback)); 99 callbacks_.insert(std::make_pair(id, callback));
99 if (request_already_sent) 100 if (request_already_sent)
100 return; 101 return;
101 102
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 callback_it != range.second; 221 callback_it != range.second;
221 ++callback_it) { 222 ++callback_it) {
222 callback_it->second.Run(state); 223 callback_it->second.Run(state);
223 } 224 }
224 225
225 callbacks_.erase(range.first, range.second); 226 callbacks_.erase(range.first, range.second);
226 } 227 }
227 228
228 } // namespace extensions 229 } // namespace extensions
229 230
OLDNEW
« no previous file with comments | « chrome/browser/extensions/blacklist.cc ('k') | chrome/browser/extensions/blacklist_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698