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/webrequest/webrequest_api.h" | 5 #include "chrome/browser/extensions/api/webrequest/webrequest_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/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 it != listeners.end(); ++it) { | 963 it != listeners.end(); ++it) { |
964 // Filter out the optional keys that this listener didn't request. | 964 // Filter out the optional keys that this listener didn't request. |
965 scoped_ptr<ListValue> args_filtered(args.DeepCopy()); | 965 scoped_ptr<ListValue> args_filtered(args.DeepCopy()); |
966 DictionaryValue* dict = NULL; | 966 DictionaryValue* dict = NULL; |
967 CHECK(args_filtered->GetDictionary(0, &dict) && dict); | 967 CHECK(args_filtered->GetDictionary(0, &dict) && dict); |
968 if (!((*it)->extra_info_spec & ExtraInfoSpec::REQUEST_HEADERS)) | 968 if (!((*it)->extra_info_spec & ExtraInfoSpec::REQUEST_HEADERS)) |
969 dict->Remove(keys::kRequestHeadersKey, NULL); | 969 dict->Remove(keys::kRequestHeadersKey, NULL); |
970 if (!((*it)->extra_info_spec & ExtraInfoSpec::RESPONSE_HEADERS)) | 970 if (!((*it)->extra_info_spec & ExtraInfoSpec::RESPONSE_HEADERS)) |
971 dict->Remove(keys::kResponseHeadersKey, NULL); | 971 dict->Remove(keys::kResponseHeadersKey, NULL); |
972 | 972 |
973 base::JSONWriter::Write(args_filtered.get(), false, &json_args); | 973 base::JSONWriter::Write(args_filtered.get(), &json_args); |
974 | 974 |
975 ExtensionEventRouter::DispatchEvent( | 975 ExtensionEventRouter::DispatchEvent( |
976 (*it)->ipc_sender.get(), (*it)->extension_id, (*it)->sub_event_name, | 976 (*it)->ipc_sender.get(), (*it)->extension_id, (*it)->sub_event_name, |
977 json_args, GURL(), ExtensionEventRouter::USER_GESTURE_UNKNOWN); | 977 json_args, GURL(), ExtensionEventRouter::USER_GESTURE_UNKNOWN); |
978 if ((*it)->extra_info_spec & | 978 if ((*it)->extra_info_spec & |
979 (ExtraInfoSpec::BLOCKING | ExtraInfoSpec::ASYNC_BLOCKING)) { | 979 (ExtraInfoSpec::BLOCKING | ExtraInfoSpec::ASYNC_BLOCKING)) { |
980 (*it)->blocked_requests.insert(request->identifier()); | 980 (*it)->blocked_requests.insert(request->identifier()); |
981 ++num_handlers_blocking; | 981 ++num_handlers_blocking; |
982 | 982 |
983 request->SetLoadStateParam( | 983 request->SetLoadStateParam( |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1737 } else if ((*it)->name().find("AdBlock") != std::string::npos) { | 1737 } else if ((*it)->name().find("AdBlock") != std::string::npos) { |
1738 adblock = true; | 1738 adblock = true; |
1739 } else { | 1739 } else { |
1740 other = true; | 1740 other = true; |
1741 } | 1741 } |
1742 } | 1742 } |
1743 } | 1743 } |
1744 | 1744 |
1745 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); | 1745 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); |
1746 } | 1746 } |
OLD | NEW |