OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/api/web_request/web_request_api.h" | 5 #include "chrome/browser/extensions/api/web_request/web_request_api.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 1907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1918 // It's possible that this request was deleted, or cancelled by a previous | 1918 // It's possible that this request was deleted, or cancelled by a previous |
1919 // event handler. If so, ignore this response. | 1919 // event handler. If so, ignore this response. |
1920 if (blocked_requests_.find(request_id) == blocked_requests_.end()) | 1920 if (blocked_requests_.find(request_id) == blocked_requests_.end()) |
1921 return; | 1921 return; |
1922 | 1922 |
1923 BlockedRequest& blocked_request = blocked_requests_[request_id]; | 1923 BlockedRequest& blocked_request = blocked_requests_[request_id]; |
1924 base::TimeDelta block_time = | 1924 base::TimeDelta block_time = |
1925 base::Time::Now() - blocked_request.blocking_time; | 1925 base::Time::Now() - blocked_request.blocking_time; |
1926 UMA_HISTOGRAM_TIMES("Extensions.NetworkDelayRegistryLoad", block_time); | 1926 UMA_HISTOGRAM_TIMES("Extensions.NetworkDelayRegistryLoad", block_time); |
1927 | 1927 |
1928 ProcessDeclarativeRules(profile, blocked_request.extension_info_map, | 1928 ProcessDeclarativeRules(profile, |
1929 event_name, blocked_request.request, request_stage, | 1929 blocked_request.extension_info_map, |
1930 blocked_request.original_response_headers); | 1930 event_name, |
| 1931 blocked_request.request, |
| 1932 request_stage, |
| 1933 blocked_request.original_response_headers.get()); |
1931 // Reset to NULL so that nobody relies on this being set. | 1934 // Reset to NULL so that nobody relies on this being set. |
1932 blocked_request.extension_info_map = NULL; | 1935 blocked_request.extension_info_map = NULL; |
1933 DecrementBlockCount(profile, std::string(), event_name, request_id, NULL); | 1936 DecrementBlockCount(profile, std::string(), event_name, request_id, NULL); |
1934 } | 1937 } |
1935 | 1938 |
1936 bool ExtensionWebRequestEventRouter::GetAndSetSignaled(uint64 request_id, | 1939 bool ExtensionWebRequestEventRouter::GetAndSetSignaled(uint64 request_id, |
1937 EventTypes event_type) { | 1940 EventTypes event_type) { |
1938 SignaledRequestMap::iterator iter = signaled_requests_.find(request_id); | 1941 SignaledRequestMap::iterator iter = signaled_requests_.find(request_id); |
1939 if (iter == signaled_requests_.end()) { | 1942 if (iter == signaled_requests_.end()) { |
1940 signaled_requests_[request_id] = event_type; | 1943 signaled_requests_[request_id] = event_type; |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2264 } else if ((*it)->name().find("AdBlock") != std::string::npos) { | 2267 } else if ((*it)->name().find("AdBlock") != std::string::npos) { |
2265 adblock = true; | 2268 adblock = true; |
2266 } else { | 2269 } else { |
2267 other = true; | 2270 other = true; |
2268 } | 2271 } |
2269 } | 2272 } |
2270 } | 2273 } |
2271 | 2274 |
2272 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); | 2275 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); |
2273 } | 2276 } |
OLD | NEW |