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

Side by Side Diff: chrome/browser/renderer_host/chrome_render_view_host_observer.cc

Issue 9460002: Convert app_bindings.js to the schema_generated_bindings.js infrastructure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix koz bool thing Created 8 years, 9 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 | Annotate | Revision Log
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 #include "chrome/browser/renderer_host/chrome_render_view_host_observer.h" 5 #include "chrome/browser/renderer_host/chrome_render_view_host_observer.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/net/predictor.h" 9 #include "chrome/browser/net/predictor.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 88 }
89 89
90 void ChromeRenderViewHostObserver::InitRenderViewForExtensions() { 90 void ChromeRenderViewHostObserver::InitRenderViewForExtensions() {
91 const Extension* extension = GetExtension(); 91 const Extension* extension = GetExtension();
92 if (!extension) 92 if (!extension)
93 return; 93 return;
94 94
95 content::RenderProcessHost* process = render_view_host()->process(); 95 content::RenderProcessHost* process = render_view_host()->process();
96 96
97 if (extension->is_app()) { 97 if (extension->is_app()) {
98 Send(new ExtensionMsg_ActivateApplication(extension->id()));
99 // Though we already record the associated process ID for the renderer in 98 // Though we already record the associated process ID for the renderer in
100 // InitRenderViewHostForExtensions, the process might have crashed and been 99 // InitRenderViewHostForExtensions, the process might have crashed and been
101 // restarted (hence the re-initialization), so we need to update that 100 // restarted (hence the re-initialization), so we need to update that
102 // mapping. 101 // mapping.
103 profile_->GetExtensionService()->SetInstalledAppForRenderer( 102 profile_->GetExtensionService()->SetInstalledAppForRenderer(
104 process->GetID(), extension); 103 process->GetID(), extension);
105 } 104 }
106 105
107 // Some extensions use chrome:// URLs. 106 // Some extensions use chrome:// URLs.
108 Extension::Type type = extension->GetType(); 107 Extension::Type type = extension->GetType();
109 if (type == Extension::TYPE_EXTENSION || 108 if (type == Extension::TYPE_EXTENSION ||
110 type == Extension::TYPE_PACKAGED_APP) { 109 type == Extension::TYPE_PACKAGED_APP) {
111 ChildProcessSecurityPolicy::GetInstance()->GrantScheme( 110 ChildProcessSecurityPolicy::GetInstance()->GrantScheme(
112 process->GetID(), chrome::kChromeUIScheme); 111 process->GetID(), chrome::kChromeUIScheme);
113 112
114 if (profile_->GetExtensionService()->extension_prefs()->AllowFileAccess( 113 if (profile_->GetExtensionService()->extension_prefs()->AllowFileAccess(
115 extension->id())) { 114 extension->id())) {
116 ChildProcessSecurityPolicy::GetInstance()->GrantScheme( 115 ChildProcessSecurityPolicy::GetInstance()->GrantScheme(
117 process->GetID(), chrome::kFileScheme); 116 process->GetID(), chrome::kFileScheme);
118 } 117 }
119 } 118 }
120 119
121 if (type == Extension::TYPE_EXTENSION || 120 if (type != Extension::TYPE_THEME)
Aaron Boodman 2012/03/06 01:17:21 I prefer a whitelist here to the blacklist. I gue
not at google - send to devlin 2012/03/06 03:53:00 Done. (added NOTREACHED() to a version of the pat
122 type == Extension::TYPE_USER_SCRIPT ||
123 type == Extension::TYPE_PACKAGED_APP ||
124 type == Extension::TYPE_PLATFORM_APP ||
125 (type == Extension::TYPE_HOSTED_APP &&
126 extension->location() == Extension::COMPONENT)) {
127 Send(new ExtensionMsg_ActivateExtension(extension->id())); 121 Send(new ExtensionMsg_ActivateExtension(extension->id()));
128 }
129 } 122 }
130 123
131 const Extension* ChromeRenderViewHostObserver::GetExtension() { 124 const Extension* ChromeRenderViewHostObserver::GetExtension() {
132 // Note that due to ChromeContentBrowserClient::GetEffectiveURL(), hosted apps 125 // Note that due to ChromeContentBrowserClient::GetEffectiveURL(), hosted apps
133 // (excluding bookmark apps) will have a chrome-extension:// URL for their 126 // (excluding bookmark apps) will have a chrome-extension:// URL for their
134 // site, so we can ignore that wrinkle here. 127 // site, so we can ignore that wrinkle here.
135 SiteInstance* site_instance = render_view_host()->site_instance(); 128 SiteInstance* site_instance = render_view_host()->site_instance();
136 const GURL& site = site_instance->GetSite(); 129 const GURL& site = site_instance->GetSite();
137 130
138 if (!site.SchemeIs(chrome::kExtensionScheme)) 131 if (!site.SchemeIs(chrome::kExtensionScheme))
(...skipping 22 matching lines...) Expand all
161 if (process_manager) 154 if (process_manager)
162 process_manager->UnregisterRenderViewHost(rvh); 155 process_manager->UnregisterRenderViewHost(rvh);
163 } 156 }
164 157
165 void ChromeRenderViewHostObserver::OnFocusedEditableNodeTouched() { 158 void ChromeRenderViewHostObserver::OnFocusedEditableNodeTouched() {
166 content::NotificationService::current()->Notify( 159 content::NotificationService::current()->Notify(
167 chrome::NOTIFICATION_FOCUSED_EDITABLE_NODE_TOUCHED, 160 chrome::NOTIFICATION_FOCUSED_EDITABLE_NODE_TOUCHED,
168 content::Source<RenderViewHost>(render_view_host()), 161 content::Source<RenderViewHost>(render_view_host()),
169 content::NotificationService::NoDetails()); 162 content::NotificationService::NoDetails());
170 } 163 }
OLDNEW
« no previous file with comments | « no previous file | chrome/chrome_renderer.gypi » ('j') | chrome/common/extensions/api/extension_api.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698