| OLD | NEW |
| 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 "base/thread_task_runner_handle.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 net::URLFetcher::Create(url_fetcher_id_++, request_url, | 73 net::URLFetcher::Create(url_fetcher_id_++, request_url, |
| 74 net::URLFetcher::POST, this).release(); | 74 net::URLFetcher::POST, this).release(); |
| 75 requests_[fetcher] = id; | 75 requests_[fetcher] = id; |
| 76 fetcher->SetAutomaticallyRetryOn5xx(false); // Don't retry on error. | 76 fetcher->SetAutomaticallyRetryOn5xx(false); // Don't retry on error. |
| 77 fetcher->SetRequestContext(url_request_context_getter_.get()); | 77 fetcher->SetRequestContext(url_request_context_getter_.get()); |
| 78 fetcher->SetUploadData("application/octet-stream", request_str); | 78 fetcher->SetUploadData("application/octet-stream", request_str); |
| 79 fetcher->Start(); | 79 fetcher->Start(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void BlacklistStateFetcher::SetSafeBrowsingConfig( | 82 void BlacklistStateFetcher::SetSafeBrowsingConfig( |
| 83 const SafeBrowsingProtocolConfig& config) { | 83 const safe_browsing::SafeBrowsingProtocolConfig& config) { |
| 84 safe_browsing_config_.reset(new SafeBrowsingProtocolConfig(config)); | 84 safe_browsing_config_.reset( |
| 85 new safe_browsing::SafeBrowsingProtocolConfig(config)); |
| 85 } | 86 } |
| 86 | 87 |
| 87 void BlacklistStateFetcher::SetURLRequestContextForTest( | 88 void BlacklistStateFetcher::SetURLRequestContextForTest( |
| 88 net::URLRequestContextGetter* request_context) { | 89 net::URLRequestContextGetter* request_context) { |
| 89 url_request_context_getter_ = request_context; | 90 url_request_context_getter_ = request_context; |
| 90 } | 91 } |
| 91 | 92 |
| 92 GURL BlacklistStateFetcher::RequestUrl() const { | 93 GURL BlacklistStateFetcher::RequestUrl() const { |
| 93 std::string url = base::StringPrintf( | 94 std::string url = base::StringPrintf( |
| 94 "%s/%s?client=%s&appver=%s&pver=2.2", | 95 "%s/%s?client=%s&appver=%s&pver=2.2", |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 for (CallbackMultiMap::const_iterator callback_it = range.first; | 149 for (CallbackMultiMap::const_iterator callback_it = range.first; |
| 149 callback_it != range.second; | 150 callback_it != range.second; |
| 150 ++callback_it) { | 151 ++callback_it) { |
| 151 callback_it->second.Run(state); | 152 callback_it->second.Run(state); |
| 152 } | 153 } |
| 153 | 154 |
| 154 callbacks_.erase(range.first, range.second); | 155 callbacks_.erase(range.first, range.second); |
| 155 } | 156 } |
| 156 | 157 |
| 157 } // namespace extensions | 158 } // namespace extensions |
| 158 | |
| OLD | NEW |