| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_RENDERER_SCRIPT_CONTEXT_H_ | 5 #ifndef EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ |
| 6 #define EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ | 6 #define EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 // Returns whether the API |api| or any part of the API could be | 99 // Returns whether the API |api| or any part of the API could be |
| 100 // available in this context without taking into account the context's | 100 // available in this context without taking into account the context's |
| 101 // extension. | 101 // extension. |
| 102 bool IsAnyFeatureAvailableToContext(const extensions::Feature& api); | 102 bool IsAnyFeatureAvailableToContext(const extensions::Feature& api); |
| 103 | 103 |
| 104 // Utility to get the URL we will match against for a frame. If the frame has | 104 // Utility to get the URL we will match against for a frame. If the frame has |
| 105 // committed, this is the commited URL. Otherwise it is the provisional URL. | 105 // committed, this is the commited URL. Otherwise it is the provisional URL. |
| 106 static GURL GetDataSourceURLForFrame(const blink::WebFrame* frame); | 106 static GURL GetDataSourceURLForFrame(const blink::WebFrame* frame); |
| 107 | 107 |
| 108 // Returns the first non-about:-URL in the document hierarchy above and |
| 109 // including |frame|. The document hierarchy is only traversed if |
| 110 // |document_url| is an about:-URL and if |match_about_blank| is true. |
| 111 static GURL GetEffectiveDocumentURL(const blink::WebFrame* frame, |
| 112 const GURL& document_url, |
| 113 bool match_about_blank); |
| 114 |
| 108 // RequestSender::Source implementation. | 115 // RequestSender::Source implementation. |
| 109 virtual ScriptContext* GetContext() OVERRIDE; | 116 virtual ScriptContext* GetContext() OVERRIDE; |
| 110 virtual void OnResponseReceived(const std::string& name, | 117 virtual void OnResponseReceived(const std::string& name, |
| 111 int request_id, | 118 int request_id, |
| 112 bool success, | 119 bool success, |
| 113 const base::ListValue& response, | 120 const base::ListValue& response, |
| 114 const std::string& error) OVERRIDE; | 121 const std::string& error) OVERRIDE; |
| 115 | 122 |
| 116 protected: | 123 protected: |
| 117 // The v8 context the bindings are accessible to. | 124 // The v8 context the bindings are accessible to. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 136 SafeBuiltins safe_builtins_; | 143 SafeBuiltins safe_builtins_; |
| 137 | 144 |
| 138 v8::Isolate* isolate_; | 145 v8::Isolate* isolate_; |
| 139 | 146 |
| 140 DISALLOW_COPY_AND_ASSIGN(ScriptContext); | 147 DISALLOW_COPY_AND_ASSIGN(ScriptContext); |
| 141 }; | 148 }; |
| 142 | 149 |
| 143 } // namespace extensions | 150 } // namespace extensions |
| 144 | 151 |
| 145 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ | 152 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ |
| OLD | NEW |