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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 GURL(), extensions::EventRouter::USER_GESTURE_UNKNOWN, | 362 GURL(), extensions::EventRouter::USER_GESTURE_UNKNOWN, |
363 extensions::EventFilteringInfo())); | 363 extensions::EventFilteringInfo())); |
364 event_router->DispatchEventToExtension(extension_id, event.Pass()); | 364 event_router->DispatchEventToExtension(extension_id, event.Pass()); |
365 } | 365 } |
366 | 366 |
367 } // namespace | 367 } // namespace |
368 | 368 |
369 // Represents a single unique listener to an event, along with whatever filter | 369 // Represents a single unique listener to an event, along with whatever filter |
370 // parameters and extra_info_spec were specified at the time the listener was | 370 // parameters and extra_info_spec were specified at the time the listener was |
371 // added. | 371 // added. |
| 372 // NOTE(benjhayden) New APIs should not use this sub_event_name trick! It does |
| 373 // not play well with event pages. See downloads.onDeterminingFilename and |
| 374 // ExtensionDownloadsEventRouter for an alternative approach. |
372 struct ExtensionWebRequestEventRouter::EventListener { | 375 struct ExtensionWebRequestEventRouter::EventListener { |
373 std::string extension_id; | 376 std::string extension_id; |
374 std::string extension_name; | 377 std::string extension_name; |
375 std::string sub_event_name; | 378 std::string sub_event_name; |
376 RequestFilter filter; | 379 RequestFilter filter; |
377 int extra_info_spec; | 380 int extra_info_spec; |
378 int target_process_id; | 381 int target_process_id; |
379 int target_route_id; | 382 int target_route_id; |
380 base::WeakPtr<IPC::Sender> ipc_sender; | 383 base::WeakPtr<IPC::Sender> ipc_sender; |
381 mutable std::set<uint64> blocked_requests; | 384 mutable std::set<uint64> blocked_requests; |
(...skipping 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2031 } else if ((*it)->name().find("AdBlock") != std::string::npos) { | 2034 } else if ((*it)->name().find("AdBlock") != std::string::npos) { |
2032 adblock = true; | 2035 adblock = true; |
2033 } else { | 2036 } else { |
2034 other = true; | 2037 other = true; |
2035 } | 2038 } |
2036 } | 2039 } |
2037 } | 2040 } |
2038 | 2041 |
2039 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); | 2042 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); |
2040 } | 2043 } |
OLD | NEW |