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