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

Side by Side Diff: chrome/renderer/extensions/resource_request_policy.h

Issue 2459143002: Avoid GURL allocations/copies/frees in RenderFrameImpl::willSendRequest (Closed)
Patch Set: s/host/host_piece Created 4 years, 1 month 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 CHROME_RENDERER_EXTENSIONS_RESOURCE_REQUEST_POLICY_H_ 5 #ifndef CHROME_RENDERER_EXTENSIONS_RESOURCE_REQUEST_POLICY_H_
6 #define CHROME_RENDERER_EXTENSIONS_RESOURCE_REQUEST_POLICY_H_ 6 #define CHROME_RENDERER_EXTENSIONS_RESOURCE_REQUEST_POLICY_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "ui/base/page_transition_types.h" 9 #include "ui/base/page_transition_types.h"
10 10
11 class GURL; 11 class GURL;
12 12
13 namespace blink { 13 namespace blink {
14 class WebFrame; 14 class WebFrame;
15 class WebURL;
15 } 16 }
16 17
17 namespace extensions { 18 namespace extensions {
18 19
19 class Dispatcher; 20 class Dispatcher;
20 21
21 // Encapsulates the policy for when chrome-extension:// and 22 // Encapsulates the policy for when chrome-extension:// and
22 // chrome-extension-resource:// URLs can be requested. 23 // chrome-extension-resource:// URLs can be requested.
23 class ResourceRequestPolicy { 24 class ResourceRequestPolicy {
24 public: 25 public:
25 explicit ResourceRequestPolicy(Dispatcher* dispatcher); 26 explicit ResourceRequestPolicy(Dispatcher* dispatcher);
26 27
27 // Returns true if the chrome-extension:// |resource_url| can be requested 28 // Returns true if the chrome-extension:// |resource_url| can be requested
28 // from |frame_url|. In some cases this decision is made based upon how 29 // from |frame_url|. In some cases this decision is made based upon how
29 // this request was generated. Web triggered transitions are more restrictive 30 // this request was generated. Web triggered transitions are more restrictive
30 // than those triggered through UI. 31 // than those triggered through UI.
31 bool CanRequestResource(const GURL& resource_url, 32 bool CanRequestResource(const GURL& resource_url,
32 blink::WebFrame* frame, 33 blink::WebFrame* frame,
33 ui::PageTransition transition_type); 34 ui::PageTransition transition_type);
34 35
35 // Returns true if the chrome-extension-resource:// |resource_url| can be 36 // Returns true if the chrome-extension-resource:// |resource_url| can be
36 // requested from |frame_url|. 37 // requested from |frame_url|.
37 bool CanRequestExtensionResourceScheme(const GURL& resource_url, 38 bool CanRequestExtensionResourceScheme(const blink::WebURL& resource_url,
38 blink::WebFrame* frame); 39 blink::WebFrame* frame);
39 40
40 private: 41 private:
41 Dispatcher* dispatcher_; 42 Dispatcher* dispatcher_;
42 43
43 DISALLOW_COPY_AND_ASSIGN(ResourceRequestPolicy); 44 DISALLOW_COPY_AND_ASSIGN(ResourceRequestPolicy);
44 }; 45 };
45 46
46 } // namespace extensions 47 } // namespace extensions
47 48
48 #endif // CHROME_RENDERER_EXTENSIONS_RESOURCE_REQUEST_POLICY_H_ 49 #endif // CHROME_RENDERER_EXTENSIONS_RESOURCE_REQUEST_POLICY_H_
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/chrome_extensions_renderer_client.cc ('k') | chrome/renderer/extensions/resource_request_policy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698