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

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

Issue 8598022: Restrict access to permissions based on extension types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years 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/common/extensions/extension.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/dom_operation_notification_details.h" 8 #include "chrome/browser/dom_operation_notification_details.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/net/predictor.h" 10 #include "chrome/browser/net/predictor.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 profile_->GetExtensionService()->SetInstalledAppForRenderer( 104 profile_->GetExtensionService()->SetInstalledAppForRenderer(
105 process->GetID(), extension); 105 process->GetID(), extension);
106 } 106 }
107 107
108 // Some extensions use chrome:// URLs. 108 // Some extensions use chrome:// URLs.
109 Extension::Type type = extension->GetType(); 109 Extension::Type type = extension->GetType();
110 if (type == Extension::TYPE_EXTENSION || 110 if (type == Extension::TYPE_EXTENSION ||
111 type == Extension::TYPE_PACKAGED_APP) { 111 type == Extension::TYPE_PACKAGED_APP) {
112 ChildProcessSecurityPolicy::GetInstance()->GrantScheme( 112 ChildProcessSecurityPolicy::GetInstance()->GrantScheme(
113 process->GetID(), chrome::kChromeUIScheme); 113 process->GetID(), chrome::kChromeUIScheme);
114 }
114 115
116 if (type == Extension::TYPE_EXTENSION ||
Aaron Boodman 2011/11/30 21:32:16 Why did you add this check?
117 type == Extension::TYPE_PACKAGED_APP ||
118 type == Extension::TYPE_PLATFORM_APP) {
115 if (profile_->GetExtensionService()->extension_prefs()->AllowFileAccess( 119 if (profile_->GetExtensionService()->extension_prefs()->AllowFileAccess(
116 extension->id())) { 120 extension->id())) {
117 ChildProcessSecurityPolicy::GetInstance()->GrantScheme( 121 ChildProcessSecurityPolicy::GetInstance()->GrantScheme(
118 process->GetID(), chrome::kFileScheme); 122 process->GetID(), chrome::kFileScheme);
119 } 123 }
120 } 124 }
121 125
122 if (type == Extension::TYPE_EXTENSION || 126 if (type == Extension::TYPE_EXTENSION ||
123 type == Extension::TYPE_USER_SCRIPT || 127 type == Extension::TYPE_USER_SCRIPT ||
124 type == Extension::TYPE_PACKAGED_APP || 128 type == Extension::TYPE_PACKAGED_APP ||
129 type == Extension::TYPE_PLATFORM_APP ||
125 (type == Extension::TYPE_HOSTED_APP && 130 (type == Extension::TYPE_HOSTED_APP &&
126 extension->location() == Extension::COMPONENT)) { 131 extension->location() == Extension::COMPONENT)) {
127 Send(new ExtensionMsg_ActivateExtension(extension->id())); 132 Send(new ExtensionMsg_ActivateExtension(extension->id()));
128 } 133 }
129 } 134 }
130 135
131 const Extension* ChromeRenderViewHostObserver::GetExtension() { 136 const Extension* ChromeRenderViewHostObserver::GetExtension() {
132 // Note that due to ChromeContentBrowserClient::GetEffectiveURL(), hosted apps 137 // Note that due to ChromeContentBrowserClient::GetEffectiveURL(), hosted apps
133 // (excluding bookmark apps) will have a chrome-extension:// URL for their 138 // (excluding bookmark apps) will have a chrome-extension:// URL for their
134 // site, so we can ignore that wrinkle here. 139 // site, so we can ignore that wrinkle here.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 content::Source<RenderViewHost>(render_view_host()), 175 content::Source<RenderViewHost>(render_view_host()),
171 content::Details<DomOperationNotificationDetails>(&details)); 176 content::Details<DomOperationNotificationDetails>(&details));
172 } 177 }
173 178
174 void ChromeRenderViewHostObserver::OnFocusedEditableNodeTouched() { 179 void ChromeRenderViewHostObserver::OnFocusedEditableNodeTouched() {
175 content::NotificationService::current()->Notify( 180 content::NotificationService::current()->Notify(
176 chrome::NOTIFICATION_FOCUSED_EDITABLE_NODE_TOUCHED, 181 chrome::NOTIFICATION_FOCUSED_EDITABLE_NODE_TOUCHED,
177 content::Source<RenderViewHost>(render_view_host()), 182 content::Source<RenderViewHost>(render_view_host()),
178 content::NotificationService::NoDetails()); 183 content::NotificationService::NoDetails());
179 } 184 }
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/extension.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698