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

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: make test extension ID tests pass 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
« no previous file with comments | « no previous file | chrome/chrome_renderer.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 97 }
98 98
99 void ChromeRenderViewHostObserver::InitRenderViewForExtensions() { 99 void ChromeRenderViewHostObserver::InitRenderViewForExtensions() {
100 const Extension* extension = GetExtension(); 100 const Extension* extension = GetExtension();
101 if (!extension) 101 if (!extension)
102 return; 102 return;
103 103
104 content::RenderProcessHost* process = render_view_host()->GetProcess(); 104 content::RenderProcessHost* process = render_view_host()->GetProcess();
105 105
106 if (extension->is_app()) { 106 if (extension->is_app()) {
107 Send(new ExtensionMsg_ActivateApplication(extension->id()));
108 // Though we already record the associated process ID for the renderer in 107 // Though we already record the associated process ID for the renderer in
109 // InitRenderViewHostForExtensions, the process might have crashed and been 108 // InitRenderViewHostForExtensions, the process might have crashed and been
110 // restarted (hence the re-initialization), so we need to update that 109 // restarted (hence the re-initialization), so we need to update that
111 // mapping. 110 // mapping.
112 profile_->GetExtensionService()->SetInstalledAppForRenderer( 111 profile_->GetExtensionService()->SetInstalledAppForRenderer(
113 process->GetID(), extension); 112 process->GetID(), extension);
114 } 113 }
115 114
116 // Some extensions use chrome:// URLs. 115 // Some extensions use chrome:// URLs.
117 Extension::Type type = extension->GetType(); 116 Extension::Type type = extension->GetType();
118 if (type == Extension::TYPE_EXTENSION || 117 if (type == Extension::TYPE_EXTENSION ||
119 type == Extension::TYPE_PACKAGED_APP) { 118 type == Extension::TYPE_PACKAGED_APP) {
120 ChildProcessSecurityPolicy::GetInstance()->GrantScheme( 119 ChildProcessSecurityPolicy::GetInstance()->GrantScheme(
121 process->GetID(), chrome::kChromeUIScheme); 120 process->GetID(), chrome::kChromeUIScheme);
122 121
123 if (profile_->GetExtensionService()->extension_prefs()->AllowFileAccess( 122 if (profile_->GetExtensionService()->extension_prefs()->AllowFileAccess(
124 extension->id())) { 123 extension->id())) {
125 ChildProcessSecurityPolicy::GetInstance()->GrantScheme( 124 ChildProcessSecurityPolicy::GetInstance()->GrantScheme(
126 process->GetID(), chrome::kFileScheme); 125 process->GetID(), chrome::kFileScheme);
127 } 126 }
128 } 127 }
129 128
130 if (type == Extension::TYPE_EXTENSION || 129 switch (type) {
131 type == Extension::TYPE_USER_SCRIPT || 130 case Extension::TYPE_EXTENSION:
132 type == Extension::TYPE_PACKAGED_APP || 131 case Extension::TYPE_USER_SCRIPT:
133 type == Extension::TYPE_PLATFORM_APP || 132 case Extension::TYPE_HOSTED_APP:
134 (type == Extension::TYPE_HOSTED_APP && 133 case Extension::TYPE_PACKAGED_APP:
135 extension->location() == Extension::COMPONENT)) { 134 case Extension::TYPE_PLATFORM_APP:
136 Send(new ExtensionMsg_ActivateExtension(extension->id())); 135 Send(new ExtensionMsg_ActivateExtension(extension->id()));
136 break;
137
138 case Extension::TYPE_UNKNOWN:
139 case Extension::TYPE_THEME:
140 break;
141
142 default:
143 NOTREACHED();
137 } 144 }
138 } 145 }
139 146
140 const Extension* ChromeRenderViewHostObserver::GetExtension() { 147 const Extension* ChromeRenderViewHostObserver::GetExtension() {
141 // Note that due to ChromeContentBrowserClient::GetEffectiveURL(), hosted apps 148 // Note that due to ChromeContentBrowserClient::GetEffectiveURL(), hosted apps
142 // (excluding bookmark apps) will have a chrome-extension:// URL for their 149 // (excluding bookmark apps) will have a chrome-extension:// URL for their
143 // site, so we can ignore that wrinkle here. 150 // site, so we can ignore that wrinkle here.
144 SiteInstance* site_instance = render_view_host()->GetSiteInstance(); 151 SiteInstance* site_instance = render_view_host()->GetSiteInstance();
145 const GURL& site = site_instance->GetSite(); 152 const GURL& site = site_instance->GetSite();
146 153
(...skipping 23 matching lines...) Expand all
170 if (process_manager) 177 if (process_manager)
171 process_manager->UnregisterRenderViewHost(rvh); 178 process_manager->UnregisterRenderViewHost(rvh);
172 } 179 }
173 180
174 void ChromeRenderViewHostObserver::OnFocusedEditableNodeTouched() { 181 void ChromeRenderViewHostObserver::OnFocusedEditableNodeTouched() {
175 content::NotificationService::current()->Notify( 182 content::NotificationService::current()->Notify(
176 chrome::NOTIFICATION_FOCUSED_EDITABLE_NODE_TOUCHED, 183 chrome::NOTIFICATION_FOCUSED_EDITABLE_NODE_TOUCHED,
177 content::Source<RenderViewHost>(render_view_host()), 184 content::Source<RenderViewHost>(render_view_host()),
178 content::NotificationService::NoDetails()); 185 content::NotificationService::NoDetails());
179 } 186 }
OLDNEW
« no previous file with comments | « no previous file | chrome/chrome_renderer.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698