OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/component_extensions_whitelist/whitelist.h" | 5 #include "chrome/browser/extensions/component_extensions_whitelist/whitelist.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "chrome/common/extensions/extension_constants.h" | 12 #include "chrome/common/extensions/extension_constants.h" |
13 #include "chrome/common/features.h" | 13 #include "chrome/common/features.h" |
14 #include "chrome/grit/browser_resources.h" | 14 #include "chrome/grit/browser_resources.h" |
15 #include "extensions/common/constants.h" | 15 #include "extensions/common/constants.h" |
16 | 16 |
17 #if defined(ENABLE_APP_LIST) && defined(OS_CHROMEOS) | 17 #if BUILDFLAG(ENABLE_APP_LIST) && defined(OS_CHROMEOS) |
18 #include "chrome/browser/ui/app_list/google_now_extension.h" | 18 #include "chrome/browser/ui/app_list/google_now_extension.h" |
19 #endif | 19 #endif |
20 | 20 |
21 #if defined(OS_CHROMEOS) | 21 #if defined(OS_CHROMEOS) |
22 #include "chrome/browser/chromeos/input_method/component_extension_ime_manager_i
mpl.h" | 22 #include "chrome/browser/chromeos/input_method/component_extension_ime_manager_i
mpl.h" |
23 #include "components/chrome_apps/grit/chrome_apps_resources.h" | 23 #include "components/chrome_apps/grit/chrome_apps_resources.h" |
24 #include "ui/file_manager/grit/file_manager_resources.h" | 24 #include "ui/file_manager/grit/file_manager_resources.h" |
25 #include "ui/keyboard/grit/keyboard_resources.h" | 25 #include "ui/keyboard/grit/keyboard_resources.h" |
26 #endif | 26 #endif |
27 | 27 |
(...skipping 13 matching lines...) Expand all Loading... |
41 extension_misc::kSpeechSynthesisExtensionId, | 41 extension_misc::kSpeechSynthesisExtensionId, |
42 extension_misc::kZIPUnpackerExtensionId, | 42 extension_misc::kZIPUnpackerExtensionId, |
43 #endif | 43 #endif |
44 }; | 44 }; |
45 | 45 |
46 for (size_t i = 0; i < arraysize(kAllowed); ++i) { | 46 for (size_t i = 0; i < arraysize(kAllowed); ++i) { |
47 if (extension_id == kAllowed[i]) | 47 if (extension_id == kAllowed[i]) |
48 return true; | 48 return true; |
49 } | 49 } |
50 | 50 |
51 #if defined(ENABLE_APP_LIST) && defined(OS_CHROMEOS) | 51 #if BUILDFLAG(ENABLE_APP_LIST) && defined(OS_CHROMEOS) |
52 std::string google_now_extension_id; | 52 std::string google_now_extension_id; |
53 if (GetGoogleNowExtensionId(&google_now_extension_id) && | 53 if (GetGoogleNowExtensionId(&google_now_extension_id) && |
54 google_now_extension_id == extension_id) { | 54 google_now_extension_id == extension_id) { |
55 return true; | 55 return true; |
56 } | 56 } |
57 #endif | 57 #endif |
58 | 58 |
59 #if defined(OS_CHROMEOS) | 59 #if defined(OS_CHROMEOS) |
60 if (chromeos::ComponentExtensionIMEManagerImpl::IsIMEExtensionID( | 60 if (chromeos::ComponentExtensionIMEManagerImpl::IsIMEExtensionID( |
61 extension_id)) { | 61 extension_id)) { |
62 return true; | 62 return true; |
63 } | 63 } |
64 #endif | 64 #endif |
65 LOG(ERROR) << "Component extension with id " << extension_id << " not in " | 65 LOG(ERROR) << "Component extension with id " << extension_id << " not in " |
66 << "whitelist and is not being loaded as a result."; | 66 << "whitelist and is not being loaded as a result."; |
67 NOTREACHED(); | 67 NOTREACHED(); |
68 return false; | 68 return false; |
69 } | 69 } |
70 | 70 |
71 bool IsComponentExtensionWhitelisted(int manifest_resource_id) { | 71 bool IsComponentExtensionWhitelisted(int manifest_resource_id) { |
72 switch (manifest_resource_id) { | 72 switch (manifest_resource_id) { |
73 // Please keep the list in alphabetical order. | 73 // Please keep the list in alphabetical order. |
74 case IDR_BOOKMARKS_MANIFEST: | 74 case IDR_BOOKMARKS_MANIFEST: |
75 #if defined(ENABLE_APP_LIST) | 75 #if BUILDFLAG(ENABLE_APP_LIST) |
76 case IDR_CHROME_APP_MANIFEST: | 76 case IDR_CHROME_APP_MANIFEST: |
77 #endif | 77 #endif |
78 #if defined(ENABLE_PRINTING) | 78 #if defined(ENABLE_PRINTING) |
79 case IDR_CLOUDPRINT_MANIFEST: | 79 case IDR_CLOUDPRINT_MANIFEST: |
80 #endif | 80 #endif |
81 case IDR_CRYPTOTOKEN_MANIFEST: | 81 case IDR_CRYPTOTOKEN_MANIFEST: |
82 case IDR_FEEDBACK_MANIFEST: | 82 case IDR_FEEDBACK_MANIFEST: |
83 case IDR_GAIA_AUTH_MANIFEST: | 83 case IDR_GAIA_AUTH_MANIFEST: |
84 #if defined(ENABLE_GOOGLE_NOW) | 84 #if defined(ENABLE_GOOGLE_NOW) |
85 case IDR_GOOGLE_NOW_MANIFEST: | 85 case IDR_GOOGLE_NOW_MANIFEST: |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 } | 127 } |
128 | 128 |
129 LOG(ERROR) << "Component extension with manifest resource id " | 129 LOG(ERROR) << "Component extension with manifest resource id " |
130 << manifest_resource_id << " not in whitelist and is not being " | 130 << manifest_resource_id << " not in whitelist and is not being " |
131 << "loaded as a result."; | 131 << "loaded as a result."; |
132 NOTREACHED(); | 132 NOTREACHED(); |
133 return false; | 133 return false; |
134 } | 134 } |
135 | 135 |
136 } // namespace extensions | 136 } // namespace extensions |
OLD | NEW |