| 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/suggest_permission_util.h" | 5 #include "chrome/browser/extensions/suggest_permission_util.h" |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "content/public/browser/render_view_host.h" | 8 #include "content/public/browser/render_view_host.h" |
| 9 #include "content/public/common/console_message_level.h" | 9 #include "content/public/common/console_message_level.h" |
| 10 #include "extensions/browser/extension_system.h" | 10 #include "extensions/browser/extension_system.h" |
| 11 #include "extensions/browser/process_manager.h" | 11 #include "extensions/browser/process_manager.h" |
| 12 #include "extensions/common/extension.h" | 12 #include "extensions/common/extension.h" |
| 13 #include "extensions/common/extension_messages.h" | 13 #include "extensions/common/extension_messages.h" |
| 14 #include "extensions/common/permissions/permissions_data.h" |
| 14 #include "extensions/common/permissions/permissions_info.h" | 15 #include "extensions/common/permissions/permissions_info.h" |
| 15 | 16 |
| 16 using content::CONSOLE_MESSAGE_LEVEL_WARNING; | 17 using content::CONSOLE_MESSAGE_LEVEL_WARNING; |
| 17 using content::RenderViewHost; | 18 using content::RenderViewHost; |
| 18 | 19 |
| 19 const char kPermissionsHelpURLForExtensions[] = | 20 const char kPermissionsHelpURLForExtensions[] = |
| 20 "http://developer.chrome.com/extensions/manifest.html#permissions"; | 21 "http://developer.chrome.com/extensions/manifest.html#permissions"; |
| 21 const char kPermissionsHelpURLForApps[] = | 22 const char kPermissionsHelpURLForApps[] = |
| 22 "http://developer.chrome.com/apps/declare_permissions.html"; | 23 "http://developer.chrome.com/apps/declare_permissions.html"; |
| 23 | 24 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 42 kPermissionsHelpURLForApps : kPermissionsHelpURLForExtensions); | 43 kPermissionsHelpURLForApps : kPermissionsHelpURLForExtensions); |
| 43 | 44 |
| 44 host->Send(new ExtensionMsg_AddMessageToConsole( | 45 host->Send(new ExtensionMsg_AddMessageToConsole( |
| 45 host->GetRoutingID(), CONSOLE_MESSAGE_LEVEL_WARNING, message)); | 46 host->GetRoutingID(), CONSOLE_MESSAGE_LEVEL_WARNING, message)); |
| 46 } | 47 } |
| 47 | 48 |
| 48 bool IsExtensionWithPermissionOrSuggestInConsole( | 49 bool IsExtensionWithPermissionOrSuggestInConsole( |
| 49 APIPermission::ID permission, | 50 APIPermission::ID permission, |
| 50 const Extension* extension, | 51 const Extension* extension, |
| 51 content::RenderViewHost* host) { | 52 content::RenderViewHost* host) { |
| 52 if (extension && extension->HasAPIPermission(permission)) | 53 if (extension && extension->permissions_data()->HasAPIPermission(permission)) |
| 53 return true; | 54 return true; |
| 54 | 55 |
| 55 if (extension) | 56 if (extension) |
| 56 SuggestAPIPermissionInDevToolsConsole(permission, extension, host); | 57 SuggestAPIPermissionInDevToolsConsole(permission, extension, host); |
| 57 | 58 |
| 58 return false; | 59 return false; |
| 59 } | 60 } |
| 60 | 61 |
| 61 } // namespace extensions | 62 } // namespace extensions |
| OLD | NEW |