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/common/extensions/api/extension_action/script_badge_handler.h" | 5 #include "chrome/common/extensions/api/extension_action/script_badge_handler.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/common/extensions/api/icons/icons_handler.h" | 10 #include "chrome/common/extensions/api/icons/icons_handler.h" |
11 #include "chrome/common/extensions/extension.h" | 11 #include "chrome/common/extensions/extension.h" |
12 #include "chrome/common/extensions/extension_constants.h" | 12 #include "chrome/common/extensions/extension_constants.h" |
13 #include "chrome/common/extensions/extension_manifest_constants.h" | 13 #include "chrome/common/extensions/extension_manifest_constants.h" |
14 #include "chrome/common/extensions/feature_switch.h" | 14 #include "chrome/common/extensions/feature_switch.h" |
15 #include "chrome/common/extensions/manifest.h" | 15 #include "chrome/common/extensions/manifest.h" |
16 #include "chrome/common/extensions/manifest_handler_helpers.h" | |
17 #include "extensions/common/install_warning.h" | 16 #include "extensions/common/install_warning.h" |
18 | 17 |
19 namespace errors = extension_manifest_errors; | 18 namespace errors = extension_manifest_errors; |
20 namespace keys = extension_manifest_keys; | 19 namespace keys = extension_manifest_keys; |
21 | 20 |
22 namespace extensions { | 21 namespace extensions { |
23 | 22 |
24 ScriptBadgeHandler::ScriptBadgeHandler() { | 23 ScriptBadgeHandler::ScriptBadgeHandler() { |
25 } | 24 } |
26 | 25 |
(...skipping 22 matching lines...) Expand all Loading... |
49 InstallWarning(InstallWarning::FORMAT_TEXT, | 48 InstallWarning(InstallWarning::FORMAT_TEXT, |
50 errors::kScriptBadgeRequiresFlag)); | 49 errors::kScriptBadgeRequiresFlag)); |
51 } | 50 } |
52 | 51 |
53 const DictionaryValue* dict = NULL; | 52 const DictionaryValue* dict = NULL; |
54 if (!extension->manifest()->GetDictionary(keys::kScriptBadge, &dict)) { | 53 if (!extension->manifest()->GetDictionary(keys::kScriptBadge, &dict)) { |
55 *error = ASCIIToUTF16(errors::kInvalidScriptBadge); | 54 *error = ASCIIToUTF16(errors::kInvalidScriptBadge); |
56 return false; | 55 return false; |
57 } | 56 } |
58 | 57 |
59 action_info = | 58 action_info = ActionInfo::Load(extension, dict, error); |
60 manifest_handler_helpers::LoadActionInfo(extension, dict, error); | |
61 | 59 |
62 if (!action_info.get()) | 60 if (!action_info.get()) |
63 return false; // Failed to parse script badge definition. | 61 return false; // Failed to parse script badge definition. |
64 | 62 |
65 // Script badges always use their extension's title and icon so users can rely | 63 // Script badges always use their extension's title and icon so users can rely |
66 // on the visual appearance to know which extension is running. This isn't | 64 // on the visual appearance to know which extension is running. This isn't |
67 // bulletproof since an malicious extension could use a different 16x16 icon | 65 // bulletproof since an malicious extension could use a different 16x16 icon |
68 // that matches the icon of a trusted extension, and users wouldn't be warned | 66 // that matches the icon of a trusted extension, and users wouldn't be warned |
69 // during installation. | 67 // during installation. |
70 | 68 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 extension_misc::kScriptBadgeIconSizes[i], path); | 100 extension_misc::kScriptBadgeIconSizes[i], path); |
103 } | 101 } |
104 } | 102 } |
105 } | 103 } |
106 | 104 |
107 const std::vector<std::string> ScriptBadgeHandler::Keys() const { | 105 const std::vector<std::string> ScriptBadgeHandler::Keys() const { |
108 return SingleKey(keys::kScriptBadge); | 106 return SingleKey(keys::kScriptBadge); |
109 } | 107 } |
110 | 108 |
111 } // namespace extensions | 109 } // namespace extensions |
OLD | NEW |