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 "extensions/browser/api/web_request/web_request_api.h" | 5 #include "extensions/browser/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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 web_request::OnBeforeRequest::kEventName}, | 407 web_request::OnBeforeRequest::kEventName}, |
408 {events::WEB_REQUEST_ON_BEFORE_SEND_HEADERS, | 408 {events::WEB_REQUEST_ON_BEFORE_SEND_HEADERS, |
409 keys::kOnBeforeSendHeadersEvent}, | 409 keys::kOnBeforeSendHeadersEvent}, |
410 {events::WEB_REQUEST_ON_COMPLETED, keys::kOnCompletedEvent}, | 410 {events::WEB_REQUEST_ON_COMPLETED, keys::kOnCompletedEvent}, |
411 {events::WEB_REQUEST_ON_ERROR_OCCURRED, | 411 {events::WEB_REQUEST_ON_ERROR_OCCURRED, |
412 web_request::OnErrorOccurred::kEventName}, | 412 web_request::OnErrorOccurred::kEventName}, |
413 {events::WEB_REQUEST_ON_SEND_HEADERS, keys::kOnSendHeadersEvent}, | 413 {events::WEB_REQUEST_ON_SEND_HEADERS, keys::kOnSendHeadersEvent}, |
414 {events::WEB_REQUEST_ON_AUTH_REQUIRED, keys::kOnAuthRequiredEvent}, | 414 {events::WEB_REQUEST_ON_AUTH_REQUIRED, keys::kOnAuthRequiredEvent}, |
415 {events::WEB_REQUEST_ON_RESPONSE_STARTED, keys::kOnResponseStartedEvent}, | 415 {events::WEB_REQUEST_ON_RESPONSE_STARTED, keys::kOnResponseStartedEvent}, |
416 {events::WEB_REQUEST_ON_HEADERS_RECEIVED, keys::kOnHeadersReceivedEvent}}; | 416 {events::WEB_REQUEST_ON_HEADERS_RECEIVED, keys::kOnHeadersReceivedEvent}}; |
417 COMPILE_ASSERT(arraysize(kWebRequestEvents) == arraysize(values_and_names), | 417 static_assert(arraysize(kWebRequestEvents) == arraysize(values_and_names), |
418 "kWebRequestEvents and values_and_names must be the same"); | 418 "kWebRequestEvents and values_and_names must be the same"); |
419 for (const ValueAndName& value_and_name : values_and_names) { | 419 for (const ValueAndName& value_and_name : values_and_names) { |
420 if (value_and_name.event_name == event_name) | 420 if (value_and_name.event_name == event_name) |
421 return value_and_name.histogram_value; | 421 return value_and_name.histogram_value; |
422 } | 422 } |
423 | 423 |
424 // If there is no webRequest event, it might be a guest view webRequest event. | 424 // If there is no webRequest event, it might be a guest view webRequest event. |
425 events::HistogramValue guest_view_histogram_value = | 425 events::HistogramValue guest_view_histogram_value = |
426 guest_view_events::GetEventHistogramValue(event_name); | 426 guest_view_events::GetEventHistogramValue(event_name); |
427 if (guest_view_histogram_value != events::UNKNOWN) | 427 if (guest_view_histogram_value != events::UNKNOWN) |
428 return guest_view_histogram_value; | 428 return guest_view_histogram_value; |
(...skipping 2068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2497 // Continue gracefully. | 2497 // Continue gracefully. |
2498 RunSync(); | 2498 RunSync(); |
2499 } | 2499 } |
2500 | 2500 |
2501 bool WebRequestHandlerBehaviorChangedFunction::RunSync() { | 2501 bool WebRequestHandlerBehaviorChangedFunction::RunSync() { |
2502 helpers::ClearCacheOnNavigation(); | 2502 helpers::ClearCacheOnNavigation(); |
2503 return true; | 2503 return true; |
2504 } | 2504 } |
2505 | 2505 |
2506 } // namespace extensions | 2506 } // namespace extensions |
OLD | NEW |