Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: extensions/browser/api/web_request/web_request_api.h

Issue 2700553002: Introduce WebRequestResourceType. (Closed)
Patch Set: Address comments from Devlin. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_H_ 5 #ifndef EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_H_
6 #define EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_H_ 6 #define EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <list> 10 #include <list>
11 #include <map> 11 #include <map>
12 #include <set> 12 #include <set>
13 #include <string> 13 #include <string>
14 #include <utility> 14 #include <utility>
15 #include <vector> 15 #include <vector>
16 16
17 #include "base/gtest_prod_util.h" 17 #include "base/gtest_prod_util.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/memory/singleton.h" 19 #include "base/memory/singleton.h"
20 #include "base/memory/weak_ptr.h" 20 #include "base/memory/weak_ptr.h"
21 #include "base/strings/string_util.h" 21 #include "base/strings/string_util.h"
22 #include "base/time/time.h" 22 #include "base/time/time.h"
23 #include "content/public/common/resource_type.h"
24 #include "extensions/browser/api/declarative/rules_registry.h" 23 #include "extensions/browser/api/declarative/rules_registry.h"
25 #include "extensions/browser/api/declarative_webrequest/request_stage.h" 24 #include "extensions/browser/api/declarative_webrequest/request_stage.h"
26 #include "extensions/browser/api/web_request/web_request_api_helpers.h" 25 #include "extensions/browser/api/web_request/web_request_api_helpers.h"
27 #include "extensions/browser/api/web_request/web_request_permissions.h" 26 #include "extensions/browser/api/web_request/web_request_permissions.h"
27 #include "extensions/browser/api/web_request/web_request_resource_type.h"
28 #include "extensions/browser/browser_context_keyed_api_factory.h" 28 #include "extensions/browser/browser_context_keyed_api_factory.h"
29 #include "extensions/browser/event_router.h" 29 #include "extensions/browser/event_router.h"
30 #include "extensions/browser/extension_function.h" 30 #include "extensions/browser/extension_function.h"
31 #include "extensions/common/url_pattern_set.h" 31 #include "extensions/common/url_pattern_set.h"
32 #include "ipc/ipc_sender.h" 32 #include "ipc/ipc_sender.h"
33 #include "net/base/completion_callback.h" 33 #include "net/base/completion_callback.h"
34 #include "net/base/network_delegate.h" 34 #include "net/base/network_delegate.h"
35 #include "net/http/http_request_headers.h" 35 #include "net/http/http_request_headers.h"
36 36
37 class ExtensionWebRequestTimeTracker; 37 class ExtensionWebRequestTimeTracker;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 RequestFilter(); 116 RequestFilter();
117 RequestFilter(const RequestFilter& other); 117 RequestFilter(const RequestFilter& other);
118 ~RequestFilter(); 118 ~RequestFilter();
119 119
120 // Returns false if there was an error initializing. If it is a user error, 120 // Returns false if there was an error initializing. If it is a user error,
121 // an error message is provided, otherwise the error is internal (and 121 // an error message is provided, otherwise the error is internal (and
122 // unexpected). 122 // unexpected).
123 bool InitFromValue(const base::DictionaryValue& value, std::string* error); 123 bool InitFromValue(const base::DictionaryValue& value, std::string* error);
124 124
125 extensions::URLPatternSet urls; 125 extensions::URLPatternSet urls;
126 std::vector<content::ResourceType> types; 126 std::vector<WebRequestResourceType> types;
127 int tab_id; 127 int tab_id;
128 int window_id; 128 int window_id;
129 }; 129 };
130 130
131 // Contains an extension's response to a blocking event. 131 // Contains an extension's response to a blocking event.
132 struct EventResponse { 132 struct EventResponse {
133 EventResponse(const std::string& extension_id, 133 EventResponse(const std::string& extension_id,
134 const base::Time& extension_install_time); 134 const base::Time& extension_install_time);
135 ~EventResponse(); 135 ~EventResponse();
136 136
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 // normal browser_context, or vice versa). 432 // normal browser_context, or vice versa).
433 void GetMatchingListenersImpl(void* browser_context, 433 void GetMatchingListenersImpl(void* browser_context,
434 const net::URLRequest* request, 434 const net::URLRequest* request,
435 const extensions::InfoMap* extension_info_map, 435 const extensions::InfoMap* extension_info_map,
436 ExtensionNavigationUIData* navigation_ui_data, 436 ExtensionNavigationUIData* navigation_ui_data,
437 bool crosses_incognito, 437 bool crosses_incognito,
438 const std::string& event_name, 438 const std::string& event_name,
439 const GURL& url, 439 const GURL& url,
440 int render_process_host_id, 440 int render_process_host_id,
441 int routing_id, 441 int routing_id,
442 content::ResourceType resource_type, 442 WebRequestResourceType resource_type,
443 bool is_async_request, 443 bool is_async_request,
444 bool is_request_from_extension, 444 bool is_request_from_extension,
445 int* extra_info_spec, 445 int* extra_info_spec,
446 RawListeners* matching_listeners); 446 RawListeners* matching_listeners);
447 447
448 // Decrements the count of event handlers blocking the given request. When the 448 // Decrements the count of event handlers blocking the given request. When the
449 // count reaches 0, we stop blocking the request and proceed it using the 449 // count reaches 0, we stop blocking the request and proceed it using the
450 // method requested by the extension with the highest precedence. Precedence 450 // method requested by the extension with the highest precedence. Precedence
451 // is decided by extension install time. If |response| is non-NULL, this 451 // is decided by extension install time. If |response| is non-NULL, this
452 // method assumes ownership. 452 // method assumes ownership.
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 extensions::QuotaLimitHeuristics* heuristics) const override; 625 extensions::QuotaLimitHeuristics* heuristics) const override;
626 // Handle quota exceeded gracefully: Only warn the user but still execute the 626 // Handle quota exceeded gracefully: Only warn the user but still execute the
627 // function. 627 // function.
628 void OnQuotaExceeded(const std::string& error) override; 628 void OnQuotaExceeded(const std::string& error) override;
629 ResponseAction Run() override; 629 ResponseAction Run() override;
630 }; 630 };
631 631
632 } // namespace extensions 632 } // namespace extensions
633 633
634 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_H_ 634 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698