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

Unified Diff: chrome/renderer/render_view.cc

Issue 6242010: Refactor away most of ExtensionRendererInfo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/render_thread.cc ('k') | chrome/renderer/user_script_slave.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/render_view.cc
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 3e32e3b3152837ff4797901f9ba4442f50663175..2b34e5c9ff35c5c85180b5faa76d37a5fa04307f 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -387,15 +387,17 @@ static bool IsWhitelistedForContentSettings(WebFrame* frame) {
// we would enter an extension app's extent from a non-app. We avoid swapping
// processes to exit an app for now, since we do not yet restore context (such
// as window.opener) if the window navigates back.
-static bool CrossesIntoExtensionExtent(WebFrame* frame, const GURL& new_url) {
+static bool CrossesIntoExtensionExtent(const ExtensionRendererInfo* extensions,
+ WebFrame* frame,
+ const GURL& new_url) {
// If the URL is still empty, this is a window.open navigation. Check the
// opener's URL.
GURL old_url(frame->url());
if (old_url.is_empty() && frame->opener())
old_url = frame->opener()->url();
- return !ExtensionRendererInfo::InSameExtent(old_url, new_url) &&
- !ExtensionRendererInfo::GetByURL(old_url);
+ return !extensions->InSameExtent(old_url, new_url) &&
+ !extensions->GetByURL(old_url);
}
// Returns the ISO 639_1 language code of the specified |text|, or 'unknown'
@@ -1887,14 +1889,14 @@ void RenderView::LoadNavigationErrorPage(WebFrame* frame,
bool replace) {
GURL failed_url = error.unreachableURL;
std::string alt_html;
- ExtensionRendererInfo* extension = NULL;
+ const Extension* extension = NULL;
if (html.empty()) {
// Use a local error page.
int resource_id;
DictionaryValue error_strings;
if (failed_url.is_valid() && !failed_url.SchemeIs(chrome::kExtensionScheme))
- extension = ExtensionRendererInfo::GetByURL(failed_url);
+ extension = render_thread_->GetExtensions()->GetByURL(failed_url);
if (extension) {
LocalizedError::GetAppErrorStrings(error, failed_url, extension,
&error_strings);
@@ -2625,7 +2627,7 @@ void RenderView::show(WebNavigationPolicy policy) {
// Extensions and apps always allowed to create unrequested popups. The second
// check is necessary to include content scripts.
- if (ExtensionRendererInfo::GetByURL(creator_url_) ||
+ if (render_thread_->GetExtensions()->GetByURL(creator_url_) ||
bindings_utils::GetInfoForCurrentContext()) {
opened_by_user_gesture_ = true;
}
@@ -2963,7 +2965,11 @@ WebNavigationPolicy RenderView::decidePolicyForNavigation(
// TODO(creis): For now, we only swap processes to enter an app and not
// exit it, since we currently lose context (e.g., window.opener) if the
// window navigates back. See crbug.com/65953.
- if (!should_fork && CrossesIntoExtensionExtent(frame, url)) {
+ if (!should_fork &&
+ CrossesIntoExtensionExtent(
+ render_thread_->GetExtensions(),
+ frame,
+ url)) {
// Include the referrer in this case since we're going from a hosted web
// page. (the packaged case is handled previously by the extension
// navigation test)
@@ -3926,8 +3932,8 @@ webkit::npapi::WebPluginDelegate* RenderView::CreatePluginDelegate(
// appropriate permission, or when explicitly enabled on the command line.
GURL main_frame_url(webview()->mainFrame()->url());
- ExtensionRendererInfo* extension =
- ExtensionRendererInfo::GetByURL(main_frame_url);
+ const Extension* extension =
+ render_thread_->GetExtensions()->GetByURL(main_frame_url);
bool in_ext = extension != NULL;
bool explicit_enable =
CommandLine::ForCurrentProcess()->HasSwitch(switches::kInternalNaCl);
@@ -5395,24 +5401,16 @@ void RenderView::ExecuteCodeImpl(WebFrame* frame,
frame_it != frame_vector.end(); ++frame_it) {
WebFrame* frame = *frame_it;
if (params.is_javascript) {
- ExtensionRendererInfo* extension =
- ExtensionRendererInfo::GetByID(params.extension_id);
+ const Extension* extension =
+ render_thread_->GetExtensions()->GetByID(params.extension_id);
// Since extension info is sent separately from user script info, they can
// be out of sync. We just ignore this situation.
if (!extension)
continue;
- const std::vector<URLPattern> host_permissions =
- extension->host_permissions();
- if (!Extension::CanExecuteScriptOnPage(
- frame->url(),
- extension->allowed_to_execute_script_everywhere(),
- &host_permissions,
- NULL,
- NULL)) {
+ if (!extension->CanExecuteScriptOnPage(frame->url(), NULL, NULL))
continue;
- }
std::vector<WebScriptSource> sources;
sources.push_back(
« no previous file with comments | « chrome/renderer/render_thread.cc ('k') | chrome/renderer/user_script_slave.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698