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( | 127 return base::FilePath(JoinString(parts, '/')); |
128 base::JoinString(parts, base::FilePath::StringType(1, '/'))); | |
129 } | 128 } |
130 | 129 |
131 void ContentVerifier::OnExtensionLoaded( | 130 void ContentVerifier::OnExtensionLoaded( |
132 content::BrowserContext* browser_context, | 131 content::BrowserContext* browser_context, |
133 const Extension* extension) { | 132 const Extension* extension) { |
134 if (shutdown_) | 133 if (shutdown_) |
135 return; | 134 return; |
136 | 135 |
137 ContentVerifierDelegate::Mode mode = delegate_->ShouldBeVerified(*extension); | 136 ContentVerifierDelegate::Mode mode = delegate_->ShouldBeVerified(*extension); |
138 if (mode != ContentVerifierDelegate::NONE) { | 137 if (mode != ContentVerifierDelegate::NONE) { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 !extension_l10n_util::ShouldSkipValidation( | 261 !extension_l10n_util::ShouldSkipValidation( |
263 locales_dir, full_path.DirName(), *all_locales)) | 262 locales_dir, full_path.DirName(), *all_locales)) |
264 continue; | 263 continue; |
265 } | 264 } |
266 return true; | 265 return true; |
267 } | 266 } |
268 return false; | 267 return false; |
269 } | 268 } |
270 | 269 |
271 } // namespace extensions | 270 } // namespace extensions |
OLD | NEW |