OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/content_verifier.h" | 5 #include "extensions/browser/content_verifier.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 // Remove the first component if it is '.' or '/' or '//'. | 117 // Remove the first component if it is '.' or '/' or '//'. |
118 const base::FilePath::StringType separators( | 118 const base::FilePath::StringType separators( |
119 base::FilePath::kSeparators, base::FilePath::kSeparatorsLength); | 119 base::FilePath::kSeparators, base::FilePath::kSeparatorsLength); |
120 if (!parts[0].empty() && | 120 if (!parts[0].empty() && |
121 (parts[0] == base::FilePath::kCurrentDirectory || | 121 (parts[0] == base::FilePath::kCurrentDirectory || |
122 parts[0].find_first_not_of(separators) == std::string::npos)) | 122 parts[0].find_first_not_of(separators) == std::string::npos)) |
123 parts.erase(parts.begin()); | 123 parts.erase(parts.begin()); |
124 | 124 |
125 // Note that elsewhere we always normalize path separators to '/' so this | 125 // Note that elsewhere we always normalize path separators to '/' so this |
126 // should work for all platforms. | 126 // should work for all platforms. |
127 return base::FilePath(JoinString(parts, '/')); | 127 return base::FilePath( |
| 128 base::JoinString(parts, base::FilePath::StringType(1, '/'))); |
128 } | 129 } |
129 | 130 |
130 void ContentVerifier::OnExtensionLoaded( | 131 void ContentVerifier::OnExtensionLoaded( |
131 content::BrowserContext* browser_context, | 132 content::BrowserContext* browser_context, |
132 const Extension* extension) { | 133 const Extension* extension) { |
133 if (shutdown_) | 134 if (shutdown_) |
134 return; | 135 return; |
135 | 136 |
136 ContentVerifierDelegate::Mode mode = delegate_->ShouldBeVerified(*extension); | 137 ContentVerifierDelegate::Mode mode = delegate_->ShouldBeVerified(*extension); |
137 if (mode != ContentVerifierDelegate::NONE) { | 138 if (mode != ContentVerifierDelegate::NONE) { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 !extension_l10n_util::ShouldSkipValidation( | 262 !extension_l10n_util::ShouldSkipValidation( |
262 locales_dir, full_path.DirName(), *all_locales)) | 263 locales_dir, full_path.DirName(), *all_locales)) |
263 continue; | 264 continue; |
264 } | 265 } |
265 return true; | 266 return true; |
266 } | 267 } |
267 return false; | 268 return false; |
268 } | 269 } |
269 | 270 |
270 } // namespace extensions | 271 } // namespace extensions |
OLD | NEW |