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

Side by Side Diff: extensions/renderer/script_context.h

Issue 2257273002: Fix extension bindings injection for iframes (reland) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 4 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 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 <memory>
8 #include <string> 9 #include <string>
9 #include <utility> 10 #include <utility>
10 #include <vector> 11 #include <vector>
11 12
12 #include "base/callback.h" 13 #include "base/callback.h"
13 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #include "base/threading/thread_checker.h" 16 #include "base/threading/thread_checker.h"
16 #include "extensions/common/features/feature.h" 17 #include "extensions/common/features/feature.h"
17 #include "extensions/common/permissions/api_permission_set.h" 18 #include "extensions/common/permissions/api_permission_set.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // Returns whether the API |api| or any part of the API could be 151 // Returns whether the API |api| or any part of the API could be
151 // available in this context without taking into account the context's 152 // available in this context without taking into account the context's
152 // extension. 153 // extension.
153 bool IsAnyFeatureAvailableToContext(const extensions::Feature& api); 154 bool IsAnyFeatureAvailableToContext(const extensions::Feature& api);
154 155
155 // Utility to get the URL we will match against for a frame. If the frame has 156 // Utility to get the URL we will match against for a frame. If the frame has
156 // committed, this is the commited URL. Otherwise it is the provisional URL. 157 // committed, this is the commited URL. Otherwise it is the provisional URL.
157 // The returned URL may be invalid. 158 // The returned URL may be invalid.
158 static GURL GetDataSourceURLForFrame(const blink::WebFrame* frame); 159 static GURL GetDataSourceURLForFrame(const blink::WebFrame* frame);
159 160
161 // Similar to GetDataSourceURLForFrame, but only returns the data source URL
162 // if the frame's document url is empty and the frame has a security origin
163 // that allows access to the data source url.
164 // TODO(asargent/devlin) - there may be places that should switch to using
165 // this instead of GetDataSourceURLForFrame.
166 static GURL GetAccessCheckedFrameURL(const blink::WebFrame* frame);
167
160 // Returns the first non-about:-URL in the document hierarchy above and 168 // Returns the first non-about:-URL in the document hierarchy above and
161 // including |frame|. The document hierarchy is only traversed if 169 // including |frame|. The document hierarchy is only traversed if
162 // |document_url| is an about:-URL and if |match_about_blank| is true. 170 // |document_url| is an about:-URL and if |match_about_blank| is true.
163 static GURL GetEffectiveDocumentURL(const blink::WebFrame* frame, 171 static GURL GetEffectiveDocumentURL(const blink::WebFrame* frame,
164 const GURL& document_url, 172 const GURL& document_url,
165 bool match_about_blank); 173 bool match_about_blank);
166 174
167 // RequestSender::Source implementation. 175 // RequestSender::Source implementation.
168 ScriptContext* GetContext() override; 176 ScriptContext* GetContext() override;
169 void OnResponseReceived(const std::string& name, 177 void OnResponseReceived(const std::string& name,
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 std::unique_ptr<Runner> runner_; 258 std::unique_ptr<Runner> runner_;
251 259
252 base::ThreadChecker thread_checker_; 260 base::ThreadChecker thread_checker_;
253 261
254 DISALLOW_COPY_AND_ASSIGN(ScriptContext); 262 DISALLOW_COPY_AND_ASSIGN(ScriptContext);
255 }; 263 };
256 264
257 } // namespace extensions 265 } // namespace extensions
258 266
259 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ 267 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698