| 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/manifest.h" | 5 #include "chrome/common/extensions/manifest.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 keys::kBackgroundPageLegacy, | 42 keys::kBackgroundPageLegacy, |
| 43 keys::kOfflineEnabled, | 43 keys::kOfflineEnabled, |
| 44 keys::kMinimumChromeVersion, | 44 keys::kMinimumChromeVersion, |
| 45 keys::kRequirements, | 45 keys::kRequirements, |
| 46 keys::kConvertedFromUserScript, | 46 keys::kConvertedFromUserScript, |
| 47 keys::kNaClModules, | 47 keys::kNaClModules, |
| 48 keys::kPlugins, | 48 keys::kPlugins, |
| 49 keys::kContentScripts, | 49 keys::kContentScripts, |
| 50 keys::kOmnibox, | 50 keys::kOmnibox, |
| 51 keys::kDevToolsPage, | 51 keys::kDevToolsPage, |
| 52 keys::kSidebar, | |
| 53 keys::kHomepageURL, | 52 keys::kHomepageURL, |
| 54 keys::kContentSecurityPolicy, | 53 keys::kContentSecurityPolicy, |
| 55 keys::kFileBrowserHandlers, | 54 keys::kFileBrowserHandlers, |
| 56 keys::kIncognito, | 55 keys::kIncognito, |
| 57 keys::kInputComponents, | 56 keys::kInputComponents, |
| 58 keys::kTtsEngine, | 57 keys::kTtsEngine, |
| 59 keys::kIntents, | 58 keys::kIntents, |
| 60 keys::kWebAccessibleResources | 59 keys::kWebAccessibleResources |
| 61 }; | 60 }; |
| 62 | 61 |
| 63 // Keys that are not accessible by hosted apps. | 62 // Keys that are not accessible by hosted apps. |
| 64 const char* kNotHostedAppKeys[] = { | 63 const char* kNotHostedAppKeys[] = { |
| 65 keys::kBrowserAction, | 64 keys::kBrowserAction, |
| 66 keys::kPageAction, | 65 keys::kPageAction, |
| 67 keys::kPageActions, | 66 keys::kPageActions, |
| 68 keys::kChromeURLOverrides, | 67 keys::kChromeURLOverrides, |
| 69 keys::kContentScripts, | 68 keys::kContentScripts, |
| 70 keys::kOmnibox, | 69 keys::kOmnibox, |
| 71 keys::kDevToolsPage, | 70 keys::kDevToolsPage, |
| 72 keys::kSidebar, | |
| 73 keys::kHomepageURL, | 71 keys::kHomepageURL, |
| 74 keys::kContentSecurityPolicy, | 72 keys::kContentSecurityPolicy, |
| 75 keys::kFileBrowserHandlers, | 73 keys::kFileBrowserHandlers, |
| 76 keys::kIncognito, | 74 keys::kIncognito, |
| 77 keys::kInputComponents, | 75 keys::kInputComponents, |
| 78 keys::kTtsEngine, | 76 keys::kTtsEngine, |
| 79 keys::kIntents | 77 keys::kIntents |
| 80 }; | 78 }; |
| 81 | 79 |
| 82 // Keys not accessible by packaged aps. | 80 // Keys not accessible by packaged aps. |
| 83 const char* kNotPackagedAppKeys[] = { | 81 const char* kNotPackagedAppKeys[] = { |
| 84 keys::kBrowserAction, | 82 keys::kBrowserAction, |
| 85 keys::kPageAction, | 83 keys::kPageAction, |
| 86 keys::kPageActions | 84 keys::kPageActions |
| 87 }; | 85 }; |
| 88 | 86 |
| 89 // Keys not accessible by platform apps. | 87 // Keys not accessible by platform apps. |
| 90 const char* kNotPlatformAppKeys[] = { | 88 const char* kNotPlatformAppKeys[] = { |
| 91 keys::kBrowserAction, | 89 keys::kBrowserAction, |
| 92 keys::kPageAction, | 90 keys::kPageAction, |
| 93 keys::kPageActions, | 91 keys::kPageActions, |
| 94 keys::kChromeURLOverrides, | 92 keys::kChromeURLOverrides, |
| 95 keys::kContentScripts, | 93 keys::kContentScripts, |
| 96 keys::kOmnibox, | 94 keys::kOmnibox, |
| 97 keys::kDevToolsPage, | 95 keys::kDevToolsPage, |
| 98 keys::kSidebar, | |
| 99 keys::kHomepageURL, | 96 keys::kHomepageURL, |
| 100 keys::kPlugins, | 97 keys::kPlugins, |
| 101 keys::kInputComponents, | 98 keys::kInputComponents, |
| 102 keys::kTtsEngine, | 99 keys::kTtsEngine, |
| 103 keys::kFileBrowserHandlers | 100 keys::kFileBrowserHandlers |
| 104 }; | 101 }; |
| 105 | 102 |
| 106 // Returns all the manifest keys not including those in |filtered| or kTypeKeys. | 103 // Returns all the manifest keys not including those in |filtered| or kTypeKeys. |
| 107 std::set<std::string> GetAccessibleKeys(const char* filtered[], size_t length) { | 104 std::set<std::string> GetAccessibleKeys(const char* filtered[], size_t length) { |
| 108 std::set<std::string> all_keys = Manifest::GetAllKnownKeys(); | 105 std::set<std::string> all_keys = Manifest::GetAllKnownKeys(); |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 ListValue* expected_list = new ListValue(); | 386 ListValue* expected_list = new ListValue(); |
| 390 ListValue* actual_list = NULL; | 387 ListValue* actual_list = NULL; |
| 391 expected_list->Append(Value::CreateStringValue("blah")); | 388 expected_list->Append(Value::CreateStringValue("blah")); |
| 392 value->Set(unknown_key, expected_list); | 389 value->Set(unknown_key, expected_list); |
| 393 EXPECT_FALSE(manifest->GetList(unknown_key, &actual_list)); | 390 EXPECT_FALSE(manifest->GetList(unknown_key, &actual_list)); |
| 394 EXPECT_EQ(NULL, actual_list); | 391 EXPECT_EQ(NULL, actual_list); |
| 395 EXPECT_TRUE(value->Remove(unknown_key, NULL)); | 392 EXPECT_TRUE(value->Remove(unknown_key, NULL)); |
| 396 } | 393 } |
| 397 | 394 |
| 398 } // namespace extensions | 395 } // namespace extensions |
| OLD | NEW |