OLD | NEW |
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/extensions/extension_tab_helper.h" | 5 #include "chrome/browser/extensions/extension_tab_helper.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
8 #include "chrome/browser/extensions/webstore_inline_installer.h" | 8 #include "chrome/browser/extensions/webstore_inline_installer.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/sessions/restore_tab_helper.h" | 10 #include "chrome/browser/sessions/restore_tab_helper.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 const GURL& requestor_url, | 162 const GURL& requestor_url, |
163 const std::string& client_id, | 163 const std::string& client_id, |
164 int return_route_id, | 164 int return_route_id, |
165 int callback_id) { | 165 int callback_id) { |
166 | 166 |
167 // Check for permission first. | 167 // Check for permission first. |
168 Profile* profile = | 168 Profile* profile = |
169 Profile::FromBrowserContext(tab_contents()->browser_context()); | 169 Profile::FromBrowserContext(tab_contents()->browser_context()); |
170 ExtensionService* extension_service = profile->GetExtensionService(); | 170 ExtensionService* extension_service = profile->GetExtensionService(); |
171 extensions::ProcessMap* process_map = extension_service->process_map(); | 171 extensions::ProcessMap* process_map = extension_service->process_map(); |
172 RenderProcessHost* process = | 172 content::RenderProcessHost* process = |
173 tab_contents_wrapper()->render_view_host()->process(); | 173 tab_contents_wrapper()->render_view_host()->process(); |
174 const Extension* extension = | 174 const Extension* extension = |
175 extension_service->GetInstalledApp(requestor_url); | 175 extension_service->GetInstalledApp(requestor_url); |
176 bool allowed = | 176 bool allowed = |
177 extension && | 177 extension && |
178 extension->HasAPIPermission( | 178 extension->HasAPIPermission( |
179 ExtensionAPIPermission::kExperimental) && | 179 ExtensionAPIPermission::kExperimental) && |
180 process_map->Contains(extension->id(), process->id()); | 180 process_map->Contains(extension->id(), process->GetID()); |
181 if (!allowed) { | 181 if (!allowed) { |
182 AppNotifyChannelSetupComplete("", "permission_error", return_route_id, | 182 AppNotifyChannelSetupComplete("", "permission_error", return_route_id, |
183 callback_id); | 183 callback_id); |
184 return; | 184 return; |
185 } | 185 } |
186 | 186 |
187 AppNotifyChannelUI* ui = new AppNotifyChannelUIImpl( | 187 AppNotifyChannelUI* ui = new AppNotifyChannelUIImpl( |
188 GetBrowser(), tab_contents_wrapper(), extension->name()); | 188 GetBrowser(), tab_contents_wrapper(), extension->name()); |
189 | 189 |
190 scoped_refptr<AppNotifyChannelSetup> channel_setup( | 190 scoped_refptr<AppNotifyChannelSetup> channel_setup( |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 } | 267 } |
268 | 268 |
269 TabContents* ExtensionTabHelper::GetAssociatedTabContents() const { | 269 TabContents* ExtensionTabHelper::GetAssociatedTabContents() const { |
270 return tab_contents(); | 270 return tab_contents(); |
271 } | 271 } |
272 | 272 |
273 gfx::NativeView ExtensionTabHelper::GetNativeViewOfHost() { | 273 gfx::NativeView ExtensionTabHelper::GetNativeViewOfHost() { |
274 RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView(); | 274 RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView(); |
275 return rwhv ? rwhv->GetNativeView() : NULL; | 275 return rwhv ? rwhv->GetNativeView() : NULL; |
276 } | 276 } |
OLD | NEW |