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/chrome_manifest_url_handlers.h" | 5 #include "chrome/common/extensions/chrome_manifest_url_handlers.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "chrome/common/chrome_constants.h" | 16 #include "chrome/common/chrome_constants.h" |
17 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
| 18 #include "content/public/common/url_constants.h" |
18 #include "extensions/common/error_utils.h" | 19 #include "extensions/common/error_utils.h" |
19 #include "extensions/common/file_util.h" | 20 #include "extensions/common/file_util.h" |
20 #include "extensions/common/manifest.h" | 21 #include "extensions/common/manifest.h" |
21 #include "extensions/common/manifest_constants.h" | 22 #include "extensions/common/manifest_constants.h" |
22 #include "extensions/common/manifest_handlers/permissions_parser.h" | 23 #include "extensions/common/manifest_handlers/permissions_parser.h" |
23 #include "extensions/common/manifest_handlers/shared_module_info.h" | 24 #include "extensions/common/manifest_handlers/shared_module_info.h" |
24 #include "extensions/common/manifest_url_handlers.h" | 25 #include "extensions/common/manifest_url_handlers.h" |
25 #include "extensions/common/permissions/api_permission.h" | 26 #include "extensions/common/permissions/api_permission.h" |
26 | 27 |
27 #if defined(USE_AURA) | 28 #if defined(USE_AURA) |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 } | 102 } |
102 std::unique_ptr<URLOverrides> url_overrides(new URLOverrides); | 103 std::unique_ptr<URLOverrides> url_overrides(new URLOverrides); |
103 // Validate that the overrides are all strings | 104 // Validate that the overrides are all strings |
104 for (base::DictionaryValue::Iterator iter(*overrides); !iter.IsAtEnd(); | 105 for (base::DictionaryValue::Iterator iter(*overrides); !iter.IsAtEnd(); |
105 iter.Advance()) { | 106 iter.Advance()) { |
106 const std::string& page = iter.key(); | 107 const std::string& page = iter.key(); |
107 std::string val; | 108 std::string val; |
108 // Restrict override pages to a list of supported URLs. | 109 // Restrict override pages to a list of supported URLs. |
109 bool is_allowed_host = page == chrome::kChromeUINewTabHost || | 110 bool is_allowed_host = page == chrome::kChromeUINewTabHost || |
110 page == chrome::kChromeUIBookmarksHost || | 111 page == chrome::kChromeUIBookmarksHost || |
111 page == chrome::kChromeUIHistoryHost; | 112 page == content::kChromeUIHistoryHost; |
112 #if defined(OS_CHROMEOS) | 113 #if defined(OS_CHROMEOS) |
113 is_allowed_host = is_allowed_host || | 114 is_allowed_host = is_allowed_host || |
114 page == chrome::kChromeUIActivationMessageHost || | 115 page == chrome::kChromeUIActivationMessageHost || |
115 page == keyboard::kKeyboardHost; | 116 page == keyboard::kKeyboardHost; |
116 #endif | 117 #endif |
117 | 118 |
118 if (!is_allowed_host || !iter.value().GetAsString(&val)) { | 119 if (!is_allowed_host || !iter.value().GetAsString(&val)) { |
119 *error = base::ASCIIToUTF16(errors::kInvalidChromeURLOverrides); | 120 *error = base::ASCIIToUTF16(errors::kInvalidChromeURLOverrides); |
120 return false; | 121 return false; |
121 } | 122 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } | 169 } |
169 } | 170 } |
170 return true; | 171 return true; |
171 } | 172 } |
172 | 173 |
173 const std::vector<std::string> URLOverridesHandler::Keys() const { | 174 const std::vector<std::string> URLOverridesHandler::Keys() const { |
174 return SingleKey(keys::kChromeURLOverrides); | 175 return SingleKey(keys::kChromeURLOverrides); |
175 } | 176 } |
176 | 177 |
177 } // namespace extensions | 178 } // namespace extensions |
OLD | NEW |