OLD | NEW |
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/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/page_action_controller.h" | 8 #include "chrome/browser/extensions/page_action_controller.h" |
9 #include "chrome/browser/extensions/script_badge_controller.h" | 9 #include "chrome/browser/extensions/script_badge_controller.h" |
10 #include "chrome/browser/extensions/script_executor_impl.h" | 10 #include "chrome/browser/extensions/script_executor_impl.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 ExtensionService* extension_service = profile->GetExtensionService(); | 225 ExtensionService* extension_service = profile->GetExtensionService(); |
226 extensions::ProcessMap* process_map = extension_service->process_map(); | 226 extensions::ProcessMap* process_map = extension_service->process_map(); |
227 content::RenderProcessHost* process = | 227 content::RenderProcessHost* process = |
228 tab_contents()->web_contents()->GetRenderProcessHost(); | 228 tab_contents()->web_contents()->GetRenderProcessHost(); |
229 const Extension* extension = | 229 const Extension* extension = |
230 extension_service->GetInstalledApp(requestor_url); | 230 extension_service->GetInstalledApp(requestor_url); |
231 | 231 |
232 std::string error; | 232 std::string error; |
233 if (!extension || | 233 if (!extension || |
234 !extension->HasAPIPermission( | 234 !extension->HasAPIPermission( |
235 ExtensionAPIPermission::kAppNotifications) || | 235 extensions::APIPermission::kAppNotifications) || |
236 !process_map->Contains(extension->id(), process->GetID())) | 236 !process_map->Contains(extension->id(), process->GetID())) |
237 error = kPermissionError; | 237 error = kPermissionError; |
238 | 238 |
239 // Make sure the extension can cross to the main profile, if called from an | 239 // Make sure the extension can cross to the main profile, if called from an |
240 // an incognito window. | 240 // an incognito window. |
241 if (profile->IsOffTheRecord() && | 241 if (profile->IsOffTheRecord() && |
242 !extension_service->CanCrossIncognito(extension)) | 242 !extension_service->CanCrossIncognito(extension)) |
243 error = extension_misc::kAppNotificationsIncognitoError; | 243 error = extension_misc::kAppNotificationsIncognitoError; |
244 | 244 |
245 if (!error.empty()) { | 245 if (!error.empty()) { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 void ExtensionTabHelper::OnInlineInstallFailure(int install_id, | 381 void ExtensionTabHelper::OnInlineInstallFailure(int install_id, |
382 int return_route_id, | 382 int return_route_id, |
383 const std::string& error) { | 383 const std::string& error) { |
384 Send(new ExtensionMsg_InlineWebstoreInstallResponse( | 384 Send(new ExtensionMsg_InlineWebstoreInstallResponse( |
385 return_route_id, install_id, false, error)); | 385 return_route_id, install_id, false, error)); |
386 } | 386 } |
387 | 387 |
388 WebContents* ExtensionTabHelper::GetAssociatedWebContents() const { | 388 WebContents* ExtensionTabHelper::GetAssociatedWebContents() const { |
389 return web_contents(); | 389 return web_contents(); |
390 } | 390 } |
OLD | NEW |