Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: chrome/common/extensions/chrome_manifest_url_handlers.cc

Issue 2759333002: Move chrome-specific SerializedNavigation code to chrome/. (Closed)
Patch Set: Rebase, fix Android? Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
19 #include "extensions/common/error_utils.h" 18 #include "extensions/common/error_utils.h"
20 #include "extensions/common/file_util.h" 19 #include "extensions/common/file_util.h"
21 #include "extensions/common/manifest.h" 20 #include "extensions/common/manifest.h"
22 #include "extensions/common/manifest_constants.h" 21 #include "extensions/common/manifest_constants.h"
23 #include "extensions/common/manifest_handlers/permissions_parser.h" 22 #include "extensions/common/manifest_handlers/permissions_parser.h"
24 #include "extensions/common/manifest_handlers/shared_module_info.h" 23 #include "extensions/common/manifest_handlers/shared_module_info.h"
25 #include "extensions/common/manifest_url_handlers.h" 24 #include "extensions/common/manifest_url_handlers.h"
26 #include "extensions/common/permissions/api_permission.h" 25 #include "extensions/common/permissions/api_permission.h"
27 26
28 #if defined(USE_AURA) 27 #if defined(USE_AURA)
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 101 }
103 std::unique_ptr<URLOverrides> url_overrides(new URLOverrides); 102 std::unique_ptr<URLOverrides> url_overrides(new URLOverrides);
104 // Validate that the overrides are all strings 103 // Validate that the overrides are all strings
105 for (base::DictionaryValue::Iterator iter(*overrides); !iter.IsAtEnd(); 104 for (base::DictionaryValue::Iterator iter(*overrides); !iter.IsAtEnd();
106 iter.Advance()) { 105 iter.Advance()) {
107 const std::string& page = iter.key(); 106 const std::string& page = iter.key();
108 std::string val; 107 std::string val;
109 // Restrict override pages to a list of supported URLs. 108 // Restrict override pages to a list of supported URLs.
110 bool is_allowed_host = page == chrome::kChromeUINewTabHost || 109 bool is_allowed_host = page == chrome::kChromeUINewTabHost ||
111 page == chrome::kChromeUIBookmarksHost || 110 page == chrome::kChromeUIBookmarksHost ||
112 page == content::kChromeUIHistoryHost; 111 page == chrome::kChromeUIHistoryHost;
113 #if defined(OS_CHROMEOS) 112 #if defined(OS_CHROMEOS)
114 is_allowed_host = is_allowed_host || 113 is_allowed_host = is_allowed_host ||
115 page == chrome::kChromeUIActivationMessageHost || 114 page == chrome::kChromeUIActivationMessageHost ||
116 page == keyboard::kKeyboardHost; 115 page == keyboard::kKeyboardHost;
117 #endif 116 #endif
118 117
119 if (!is_allowed_host || !iter.value().GetAsString(&val)) { 118 if (!is_allowed_host || !iter.value().GetAsString(&val)) {
120 *error = base::ASCIIToUTF16(errors::kInvalidChromeURLOverrides); 119 *error = base::ASCIIToUTF16(errors::kInvalidChromeURLOverrides);
121 return false; 120 return false;
122 } 121 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 } 168 }
170 } 169 }
171 return true; 170 return true;
172 } 171 }
173 172
174 const std::vector<std::string> URLOverridesHandler::Keys() const { 173 const std::vector<std::string> URLOverridesHandler::Keys() const {
175 return SingleKey(keys::kChromeURLOverrides); 174 return SingleKey(keys::kChromeURLOverrides);
176 } 175 }
177 176
178 } // namespace extensions 177 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698