| 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 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 keys::kOnHeadersReceivedEvent, request, | 882 keys::kOnHeadersReceivedEvent, request, |
| 883 &extra_info_spec); | 883 &extra_info_spec); |
| 884 | 884 |
| 885 if (!listeners.empty() && | 885 if (!listeners.empty() && |
| 886 !GetAndSetSignaled(request->identifier(), kOnHeadersReceived)) { | 886 !GetAndSetSignaled(request->identifier(), kOnHeadersReceived)) { |
| 887 base::ListValue args; | 887 base::ListValue args; |
| 888 base::DictionaryValue* dict = new base::DictionaryValue(); | 888 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 889 ExtractRequestInfo(request, dict); | 889 ExtractRequestInfo(request, dict); |
| 890 dict->SetString(keys::kStatusLineKey, | 890 dict->SetString(keys::kStatusLineKey, |
| 891 original_response_headers->GetStatusLine()); | 891 original_response_headers->GetStatusLine()); |
| 892 dict->SetInteger(keys::kStatusCodeKey, |
| 893 original_response_headers->response_code()); |
| 892 if (extra_info_spec & ExtraInfoSpec::RESPONSE_HEADERS) { | 894 if (extra_info_spec & ExtraInfoSpec::RESPONSE_HEADERS) { |
| 893 dict->Set(keys::kResponseHeadersKey, | 895 dict->Set(keys::kResponseHeadersKey, |
| 894 GetResponseHeadersList(original_response_headers)); | 896 GetResponseHeadersList(original_response_headers)); |
| 895 } | 897 } |
| 896 args.Append(dict); | 898 args.Append(dict); |
| 897 | 899 |
| 898 initialize_blocked_requests |= | 900 initialize_blocked_requests |= |
| 899 DispatchEvent(browser_context, request, listeners, args); | 901 DispatchEvent(browser_context, request, listeners, args); |
| 900 } | 902 } |
| 901 | 903 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 953 dict->SetBoolean(keys::kIsProxyKey, auth_info.is_proxy); | 955 dict->SetBoolean(keys::kIsProxyKey, auth_info.is_proxy); |
| 954 if (!auth_info.scheme.empty()) | 956 if (!auth_info.scheme.empty()) |
| 955 dict->SetString(keys::kSchemeKey, auth_info.scheme); | 957 dict->SetString(keys::kSchemeKey, auth_info.scheme); |
| 956 if (!auth_info.realm.empty()) | 958 if (!auth_info.realm.empty()) |
| 957 dict->SetString(keys::kRealmKey, auth_info.realm); | 959 dict->SetString(keys::kRealmKey, auth_info.realm); |
| 958 base::DictionaryValue* challenger = new base::DictionaryValue(); | 960 base::DictionaryValue* challenger = new base::DictionaryValue(); |
| 959 challenger->SetString(keys::kHostKey, auth_info.challenger.host()); | 961 challenger->SetString(keys::kHostKey, auth_info.challenger.host()); |
| 960 challenger->SetInteger(keys::kPortKey, auth_info.challenger.port()); | 962 challenger->SetInteger(keys::kPortKey, auth_info.challenger.port()); |
| 961 dict->Set(keys::kChallengerKey, challenger); | 963 dict->Set(keys::kChallengerKey, challenger); |
| 962 dict->Set(keys::kStatusLineKey, GetStatusLine(request->response_headers())); | 964 dict->Set(keys::kStatusLineKey, GetStatusLine(request->response_headers())); |
| 965 dict->SetInteger(keys::kStatusCodeKey, |
| 966 request->response_headers()->response_code()); |
| 963 if (extra_info_spec & ExtraInfoSpec::RESPONSE_HEADERS) { | 967 if (extra_info_spec & ExtraInfoSpec::RESPONSE_HEADERS) { |
| 964 dict->Set(keys::kResponseHeadersKey, | 968 dict->Set(keys::kResponseHeadersKey, |
| 965 GetResponseHeadersList(request->response_headers())); | 969 GetResponseHeadersList(request->response_headers())); |
| 966 } | 970 } |
| 967 args.Append(dict); | 971 args.Append(dict); |
| 968 | 972 |
| 969 if (DispatchEvent(browser_context, request, listeners, args)) { | 973 if (DispatchEvent(browser_context, request, listeners, args)) { |
| 970 blocked_requests_[request->identifier()].event = kOnAuthRequired; | 974 blocked_requests_[request->identifier()].event = kOnAuthRequired; |
| 971 blocked_requests_[request->identifier()].is_incognito |= | 975 blocked_requests_[request->identifier()].is_incognito |= |
| 972 IsIncognitoBrowserContext(browser_context); | 976 IsIncognitoBrowserContext(browser_context); |
| (...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2455 base::Bind(&WarningService::NotifyWarningsOnUI, profile_id(), warnings)); | 2459 base::Bind(&WarningService::NotifyWarningsOnUI, profile_id(), warnings)); |
| 2456 | 2460 |
| 2457 // Continue gracefully. | 2461 // Continue gracefully. |
| 2458 RunSync(); | 2462 RunSync(); |
| 2459 } | 2463 } |
| 2460 | 2464 |
| 2461 bool WebRequestHandlerBehaviorChangedFunction::RunSync() { | 2465 bool WebRequestHandlerBehaviorChangedFunction::RunSync() { |
| 2462 helpers::ClearCacheOnNavigation(); | 2466 helpers::ClearCacheOnNavigation(); |
| 2463 return true; | 2467 return true; |
| 2464 } | 2468 } |
| OLD | NEW |