| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/api/file_browser_handlers/file_browser_handle
r.h" | 5 #include "chrome/common/extensions/api/file_browser_handlers/file_browser_handle
r.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/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 *error = base::ASCIIToUTF16(errors::kInvalidFileFiltersList); | 188 *error = base::ASCIIToUTF16(errors::kInvalidFileFiltersList); |
| 189 return NULL; | 189 return NULL; |
| 190 } | 190 } |
| 191 for (size_t i = 0; i < file_filters->GetSize(); ++i) { | 191 for (size_t i = 0; i < file_filters->GetSize(); ++i) { |
| 192 std::string filter; | 192 std::string filter; |
| 193 if (!file_filters->GetString(i, &filter)) { | 193 if (!file_filters->GetString(i, &filter)) { |
| 194 *error = extensions::ErrorUtils::FormatErrorMessageUTF16( | 194 *error = extensions::ErrorUtils::FormatErrorMessageUTF16( |
| 195 errors::kInvalidFileFilterValue, base::IntToString(i)); | 195 errors::kInvalidFileFilterValue, base::IntToString(i)); |
| 196 return NULL; | 196 return NULL; |
| 197 } | 197 } |
| 198 StringToLowerASCII(&filter); | 198 base::StringToLowerASCII(&filter); |
| 199 if (!StartsWithASCII(filter, | 199 if (!StartsWithASCII(filter, |
| 200 std::string(url::kFileSystemScheme) + ':', | 200 std::string(url::kFileSystemScheme) + ':', |
| 201 true)) { | 201 true)) { |
| 202 *error = extensions::ErrorUtils::FormatErrorMessageUTF16( | 202 *error = extensions::ErrorUtils::FormatErrorMessageUTF16( |
| 203 errors::kInvalidURLPatternError, filter); | 203 errors::kInvalidURLPatternError, filter); |
| 204 return NULL; | 204 return NULL; |
| 205 } | 205 } |
| 206 // The user inputs filesystem:*; we don't actually implement scheme | 206 // The user inputs filesystem:*; we don't actually implement scheme |
| 207 // wildcards in URLPattern, so transform to what will match correctly. | 207 // wildcards in URLPattern, so transform to what will match correctly. |
| 208 filter.replace(0, 11, "chrome-extension://*/"); | 208 filter.replace(0, 11, "chrome-extension://*/"); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 return false; // Failed to parse file browser actions definition. | 282 return false; // Failed to parse file browser actions definition. |
| 283 } | 283 } |
| 284 | 284 |
| 285 extension->SetManifestData(keys::kFileBrowserHandlers, info.release()); | 285 extension->SetManifestData(keys::kFileBrowserHandlers, info.release()); |
| 286 return true; | 286 return true; |
| 287 } | 287 } |
| 288 | 288 |
| 289 const std::vector<std::string> FileBrowserHandlerParser::Keys() const { | 289 const std::vector<std::string> FileBrowserHandlerParser::Keys() const { |
| 290 return SingleKey(keys::kFileBrowserHandlers); | 290 return SingleKey(keys::kFileBrowserHandlers); |
| 291 } | 291 } |
| OLD | NEW |