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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 void BlacklistStateFetcher::OnURLFetchComplete(const net::URLFetcher* source) { | 108 void BlacklistStateFetcher::OnURLFetchComplete(const net::URLFetcher* source) { |
109 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 109 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
110 | 110 |
111 std::map<const net::URLFetcher*, std::string>::iterator it = | 111 std::map<const net::URLFetcher*, std::string>::iterator it = |
112 requests_.find(source); | 112 requests_.find(source); |
113 if (it == requests_.end()) { | 113 if (it == requests_.end()) { |
114 NOTREACHED(); | 114 NOTREACHED(); |
115 return; | 115 return; |
116 } | 116 } |
117 | 117 |
118 scoped_ptr<const net::URLFetcher> fetcher; | 118 std::unique_ptr<const net::URLFetcher> fetcher; |
119 | 119 |
120 fetcher.reset(it->first); | 120 fetcher.reset(it->first); |
121 std::string id = it->second; | 121 std::string id = it->second; |
122 requests_.erase(it); | 122 requests_.erase(it); |
123 | 123 |
124 BlacklistState state; | 124 BlacklistState state; |
125 | 125 |
126 if (source->GetStatus().is_success() && source->GetResponseCode() == 200) { | 126 if (source->GetStatus().is_success() && source->GetResponseCode() == 200) { |
127 std::string data; | 127 std::string data; |
128 source->GetResponseAsString(&data); | 128 source->GetResponseAsString(&data); |
(...skipping 20 matching lines...) Expand all Loading... |
149 for (CallbackMultiMap::const_iterator callback_it = range.first; | 149 for (CallbackMultiMap::const_iterator callback_it = range.first; |
150 callback_it != range.second; | 150 callback_it != range.second; |
151 ++callback_it) { | 151 ++callback_it) { |
152 callback_it->second.Run(state); | 152 callback_it->second.Run(state); |
153 } | 153 } |
154 | 154 |
155 callbacks_.erase(range.first, range.second); | 155 callbacks_.erase(range.first, range.second); |
156 } | 156 } |
157 | 157 |
158 } // namespace extensions | 158 } // namespace extensions |
OLD | NEW |