| 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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 web_request::OnBeforeRequest::kEventName}, | 406 web_request::OnBeforeRequest::kEventName}, |
| 407 {events::WEB_REQUEST_ON_BEFORE_SEND_HEADERS, | 407 {events::WEB_REQUEST_ON_BEFORE_SEND_HEADERS, |
| 408 keys::kOnBeforeSendHeadersEvent}, | 408 keys::kOnBeforeSendHeadersEvent}, |
| 409 {events::WEB_REQUEST_ON_COMPLETED, keys::kOnCompletedEvent}, | 409 {events::WEB_REQUEST_ON_COMPLETED, keys::kOnCompletedEvent}, |
| 410 {events::WEB_REQUEST_ON_ERROR_OCCURRED, | 410 {events::WEB_REQUEST_ON_ERROR_OCCURRED, |
| 411 web_request::OnErrorOccurred::kEventName}, | 411 web_request::OnErrorOccurred::kEventName}, |
| 412 {events::WEB_REQUEST_ON_SEND_HEADERS, keys::kOnSendHeadersEvent}, | 412 {events::WEB_REQUEST_ON_SEND_HEADERS, keys::kOnSendHeadersEvent}, |
| 413 {events::WEB_REQUEST_ON_AUTH_REQUIRED, keys::kOnAuthRequiredEvent}, | 413 {events::WEB_REQUEST_ON_AUTH_REQUIRED, keys::kOnAuthRequiredEvent}, |
| 414 {events::WEB_REQUEST_ON_RESPONSE_STARTED, keys::kOnResponseStartedEvent}, | 414 {events::WEB_REQUEST_ON_RESPONSE_STARTED, keys::kOnResponseStartedEvent}, |
| 415 {events::WEB_REQUEST_ON_HEADERS_RECEIVED, keys::kOnHeadersReceivedEvent}}; | 415 {events::WEB_REQUEST_ON_HEADERS_RECEIVED, keys::kOnHeadersReceivedEvent}}; |
| 416 COMPILE_ASSERT(arraysize(kWebRequestEvents) == arraysize(values_and_names), | 416 static_assert(arraysize(kWebRequestEvents) == arraysize(values_and_names), |
| 417 "kWebRequestEvents and values_and_names must be the same"); | 417 "kWebRequestEvents and values_and_names must be the same"); |
| 418 for (const ValueAndName& value_and_name : values_and_names) { | 418 for (const ValueAndName& value_and_name : values_and_names) { |
| 419 if (value_and_name.event_name == event_name) | 419 if (value_and_name.event_name == event_name) |
| 420 return value_and_name.histogram_value; | 420 return value_and_name.histogram_value; |
| 421 } | 421 } |
| 422 | 422 |
| 423 // If there is no webRequest event, it might be a guest view webRequest event. | 423 // If there is no webRequest event, it might be a guest view webRequest event. |
| 424 events::HistogramValue guest_view_histogram_value = | 424 events::HistogramValue guest_view_histogram_value = |
| 425 guest_view_events::GetEventHistogramValue(event_name); | 425 guest_view_events::GetEventHistogramValue(event_name); |
| 426 if (guest_view_histogram_value != events::UNKNOWN) | 426 if (guest_view_histogram_value != events::UNKNOWN) |
| 427 return guest_view_histogram_value; | 427 return guest_view_histogram_value; |
| (...skipping 2054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2482 // Continue gracefully. | 2482 // Continue gracefully. |
| 2483 RunSync(); | 2483 RunSync(); |
| 2484 } | 2484 } |
| 2485 | 2485 |
| 2486 bool WebRequestHandlerBehaviorChangedFunction::RunSync() { | 2486 bool WebRequestHandlerBehaviorChangedFunction::RunSync() { |
| 2487 helpers::ClearCacheOnNavigation(); | 2487 helpers::ClearCacheOnNavigation(); |
| 2488 return true; | 2488 return true; |
| 2489 } | 2489 } |
| 2490 | 2490 |
| 2491 } // namespace extensions | 2491 } // namespace extensions |
| OLD | NEW |