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/extensions/extension_process_manager.h" | 7 #include "chrome/browser/extensions/extension_process_manager.h" |
8 #include "chrome/browser/extensions/extension_system.h" | 8 #include "chrome/browser/extensions/extension_system.h" |
9 #include "chrome/common/extensions/extension.h" | 9 #include "chrome/common/extensions/extension.h" |
10 #include "chrome/common/extensions/extension_messages.h" | 10 #include "chrome/common/extensions/extension_messages.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 namespace extensions { | 23 namespace extensions { |
24 | 24 |
25 void SuggestAPIPermissionInDevToolsConsole(APIPermission::ID permission, | 25 void SuggestAPIPermissionInDevToolsConsole(APIPermission::ID permission, |
26 const Extension* extension, | 26 const Extension* extension, |
27 content::RenderViewHost* host) { | 27 content::RenderViewHost* host) { |
28 if (!extension || !host) | 28 if (!extension || !host) |
29 return; | 29 return; |
30 | 30 |
31 const APIPermissionInfo* permission_info = | 31 const APIPermissionInfo* permission_info = |
32 PermissionsInfo::GetInstance()->GetByID(permission); | 32 PermissionsInfo::GetInstance()->GetByID(permission); |
| 33 CHECK(permission_info); |
33 | 34 |
34 // Note, intentionally not internationalizing this string, as it is output | 35 // Note, intentionally not internationalizing this string, as it is output |
35 // as a log message to developers in the developer tools console. | 36 // as a log message to developers in the developer tools console. |
36 std::string message = base::StringPrintf( | 37 std::string message = base::StringPrintf( |
37 "Is the '%s' permission appropriate? See %s.", | 38 "Is the '%s' permission appropriate? See %s.", |
38 permission_info->name(), | 39 permission_info->name(), |
39 extension->is_platform_app() ? | 40 extension->is_platform_app() ? |
40 kPermissionsHelpURLForApps : kPermissionsHelpURLForExtensions); | 41 kPermissionsHelpURLForApps : kPermissionsHelpURLForExtensions); |
41 | 42 |
42 host->Send(new ExtensionMsg_AddMessageToConsole( | 43 host->Send(new ExtensionMsg_AddMessageToConsole( |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 if (extension && extension->HasAPIPermission(permission)) | 80 if (extension && extension->HasAPIPermission(permission)) |
80 return true; | 81 return true; |
81 | 82 |
82 if (extension) | 83 if (extension) |
83 SuggestAPIPermissionInDevToolsConsole(permission, extension, profile); | 84 SuggestAPIPermissionInDevToolsConsole(permission, extension, profile); |
84 | 85 |
85 return false; | 86 return false; |
86 } | 87 } |
87 | 88 |
88 } // namespace extensions | 89 } // namespace extensions |
OLD | NEW |