| 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/browser/chromeos/extensions/file_manager/file_browser_handler.h
" | 5 #include "chrome/browser/chromeos/extensions/file_manager/file_browser_handler.h
" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 return NULL; | 175 return NULL; |
| 176 } | 176 } |
| 177 } | 177 } |
| 178 } | 178 } |
| 179 if (!result->ValidateFileAccessPermissions()) { | 179 if (!result->ValidateFileAccessPermissions()) { |
| 180 *error = ASCIIToUTF16(errors::kInvalidFileAccessList); | 180 *error = ASCIIToUTF16(errors::kInvalidFileAccessList); |
| 181 return NULL; | 181 return NULL; |
| 182 } | 182 } |
| 183 | 183 |
| 184 // Initialize file filters (mandatory, unless "create" access is specified, | 184 // Initialize file filters (mandatory, unless "create" access is specified, |
| 185 // in which case is ignored). | 185 // in which case is ignored). The list can be empty. |
| 186 if (!result->HasCreateAccessPermission()) { | 186 if (!result->HasCreateAccessPermission()) { |
| 187 const ListValue* file_filters = NULL; | 187 const ListValue* file_filters = NULL; |
| 188 if (!file_browser_handler->HasKey(keys::kFileFilters) || | 188 if (!file_browser_handler->HasKey(keys::kFileFilters) || |
| 189 !file_browser_handler->GetList(keys::kFileFilters, &file_filters) || | 189 !file_browser_handler->GetList(keys::kFileFilters, &file_filters)) { |
| 190 file_filters->empty()) { | |
| 191 *error = ASCIIToUTF16(errors::kInvalidFileFiltersList); | 190 *error = ASCIIToUTF16(errors::kInvalidFileFiltersList); |
| 192 return NULL; | 191 return NULL; |
| 193 } | 192 } |
| 194 for (size_t i = 0; i < file_filters->GetSize(); ++i) { | 193 for (size_t i = 0; i < file_filters->GetSize(); ++i) { |
| 195 std::string filter; | 194 std::string filter; |
| 196 if (!file_filters->GetString(i, &filter)) { | 195 if (!file_filters->GetString(i, &filter)) { |
| 197 *error = extensions::ErrorUtils::FormatErrorMessageUTF16( | 196 *error = extensions::ErrorUtils::FormatErrorMessageUTF16( |
| 198 errors::kInvalidFileFilterValue, base::IntToString(i)); | 197 errors::kInvalidFileFilterValue, base::IntToString(i)); |
| 199 return NULL; | 198 return NULL; |
| 200 } | 199 } |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 return false; // Failed to parse file browser actions definition. | 283 return false; // Failed to parse file browser actions definition. |
| 285 } | 284 } |
| 286 | 285 |
| 287 extension->SetManifestData(keys::kFileBrowserHandlers, info.release()); | 286 extension->SetManifestData(keys::kFileBrowserHandlers, info.release()); |
| 288 return true; | 287 return true; |
| 289 } | 288 } |
| 290 | 289 |
| 291 const std::vector<std::string> FileBrowserHandlerParser::Keys() const { | 290 const std::vector<std::string> FileBrowserHandlerParser::Keys() const { |
| 292 return SingleKey(keys::kFileBrowserHandlers); | 291 return SingleKey(keys::kFileBrowserHandlers); |
| 293 } | 292 } |
| OLD | NEW |