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" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 const base::DictionaryValue* overrides = NULL; | 96 const base::DictionaryValue* overrides = NULL; |
97 if (!extension->manifest()->GetDictionary(keys::kChromeURLOverrides, | 97 if (!extension->manifest()->GetDictionary(keys::kChromeURLOverrides, |
98 &overrides)) { | 98 &overrides)) { |
99 *error = base::ASCIIToUTF16(errors::kInvalidChromeURLOverrides); | 99 *error = base::ASCIIToUTF16(errors::kInvalidChromeURLOverrides); |
100 return false; | 100 return false; |
101 } | 101 } |
102 std::unique_ptr<URLOverrides> url_overrides(new URLOverrides); | 102 std::unique_ptr<URLOverrides> url_overrides(new URLOverrides); |
103 // Validate that the overrides are all strings | 103 // Validate that the overrides are all strings |
104 for (base::DictionaryValue::Iterator iter(*overrides); !iter.IsAtEnd(); | 104 for (base::DictionaryValue::Iterator iter(*overrides); !iter.IsAtEnd(); |
105 iter.Advance()) { | 105 iter.Advance()) { |
106 std::string page = iter.key(); | 106 const std::string& page = iter.key(); |
107 std::string val; | 107 std::string val; |
108 // Restrict override pages to a list of supported URLs. | 108 // Restrict override pages to a list of supported URLs. |
109 bool is_allowed_host = page == chrome::kChromeUINewTabHost || | 109 bool is_allowed_host = page == chrome::kChromeUINewTabHost || |
110 page == chrome::kChromeUIBookmarksHost || | 110 page == chrome::kChromeUIBookmarksHost || |
111 page == chrome::kChromeUIHistoryHost; | 111 page == chrome::kChromeUIHistoryHost; |
112 #if defined(OS_CHROMEOS) | 112 #if defined(OS_CHROMEOS) |
113 is_allowed_host = is_allowed_host || | 113 is_allowed_host = is_allowed_host || |
114 page == chrome::kChromeUIActivationMessageHost || | 114 page == chrome::kChromeUIActivationMessageHost || |
115 page == keyboard::kKeyboardHost; | 115 page == keyboard::kKeyboardHost; |
116 #endif | 116 #endif |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } | 168 } |
169 } | 169 } |
170 return true; | 170 return true; |
171 } | 171 } |
172 | 172 |
173 const std::vector<std::string> URLOverridesHandler::Keys() const { | 173 const std::vector<std::string> URLOverridesHandler::Keys() const { |
174 return SingleKey(keys::kChromeURLOverrides); | 174 return SingleKey(keys::kChromeURLOverrides); |
175 } | 175 } |
176 | 176 |
177 } // namespace extensions | 177 } // namespace extensions |
OLD | NEW |