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_handler_helpers.h" | 5 #include "chrome/common/extensions/manifest_handler_helpers.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/common/extensions/extension.h" | 11 #include "chrome/common/extensions/extension.h" |
12 #include "chrome/common/extensions/extension_icon_set.h" | 12 #include "chrome/common/extensions/extension_icon_set.h" |
13 #include "chrome/common/extensions/extension_manifest_constants.h" | |
14 #include "extensions/common/error_utils.h" | 13 #include "extensions/common/error_utils.h" |
| 14 #include "extensions/common/manifest_constants.h" |
15 | 15 |
16 namespace errors = extension_manifest_errors; | |
17 | 16 |
18 namespace extensions { | 17 namespace extensions { |
| 18 |
| 19 namespace errors = manifest_errors; |
| 20 |
19 namespace manifest_handler_helpers { | 21 namespace manifest_handler_helpers { |
20 | 22 |
21 bool NormalizeAndValidatePath(std::string* path) { | 23 bool NormalizeAndValidatePath(std::string* path) { |
22 size_t first_non_slash = path->find_first_not_of('/'); | 24 size_t first_non_slash = path->find_first_not_of('/'); |
23 if (first_non_slash == std::string::npos) { | 25 if (first_non_slash == std::string::npos) { |
24 *path = ""; | 26 *path = ""; |
25 return false; | 27 return false; |
26 } | 28 } |
27 | 29 |
28 *path = path->substr(first_non_slash); | 30 *path = path->substr(first_non_slash); |
(...skipping 21 matching lines...) Expand all Loading... |
50 errors::kInvalidIconPath, key); | 52 errors::kInvalidIconPath, key); |
51 return false; | 53 return false; |
52 } | 54 } |
53 | 55 |
54 icons->Add(icon_sizes[i], icon_path); | 56 icons->Add(icon_sizes[i], icon_path); |
55 } | 57 } |
56 } | 58 } |
57 return true; | 59 return true; |
58 } | 60 } |
59 | 61 |
| 62 } // namespace manifest_handler_helpers |
| 63 |
60 } // namespace extensions | 64 } // namespace extensions |
61 } // namespace manifest_handler_extensions | |
OLD | NEW |