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 #include "chrome/browser/chromeos/extensions/file_manager_util.h" | 4 #include "chrome/browser/chromeos/extensions/file_manager_util.h" |
5 | 5 |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 } | 325 } |
326 | 326 |
327 DictionaryValue* dict = new DictionaryValue(); | 327 DictionaryValue* dict = new DictionaryValue(); |
328 dict->Set("extensions", extensions_list); | 328 dict->Set("extensions", extensions_list); |
329 | 329 |
330 if (i < file_types->extension_description_overrides.size()) { | 330 if (i < file_types->extension_description_overrides.size()) { |
331 string16 desc = file_types->extension_description_overrides[i]; | 331 string16 desc = file_types->extension_description_overrides[i]; |
332 dict->SetString("description", desc); | 332 dict->SetString("description", desc); |
333 } | 333 } |
334 | 334 |
| 335 // file_type_index is 1-based. 0 means no selection at all. |
335 dict->SetBoolean("selected", | 336 dict->SetBoolean("selected", |
336 (static_cast<size_t>(file_type_index) == i)); | 337 (static_cast<size_t>(file_type_index) == (i + 1))); |
337 | 338 |
338 types_list->Set(i, dict); | 339 types_list->Set(i, dict); |
339 } | 340 } |
340 arg_value.Set("typeList", types_list); | 341 arg_value.Set("typeList", types_list); |
| 342 |
| 343 arg_value.SetBoolean("includeAllFiles", file_types->include_all_files); |
341 } | 344 } |
342 | 345 |
343 std::string json_args; | 346 std::string json_args; |
344 base::JSONWriter::Write(&arg_value, &json_args); | 347 base::JSONWriter::Write(&arg_value, &json_args); |
345 | 348 |
346 // kChromeUIFileManagerURL could not be used since query parameters are not | 349 // kChromeUIFileManagerURL could not be used since query parameters are not |
347 // supported for it. | 350 // supported for it. |
348 std::string url = GetFileBrowserUrl().spec() + | 351 std::string url = GetFileBrowserUrl().spec() + |
349 '?' + net::EscapeUrlEncodedData(json_args, false); | 352 '?' + net::EscapeUrlEncodedData(json_args, false); |
350 return GURL(url); | 353 return GURL(url); |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 GDataOperationRegistry::ProgressStatus>::const_iterator iter = | 719 GDataOperationRegistry::ProgressStatus>::const_iterator iter = |
717 list.begin(); | 720 list.begin(); |
718 iter != list.end(); ++iter) { | 721 iter != list.end(); ++iter) { |
719 result_list->Append( | 722 result_list->Append( |
720 ProgessStatusToDictionaryValue(profile, origin_url, *iter)); | 723 ProgessStatusToDictionaryValue(profile, origin_url, *iter)); |
721 } | 724 } |
722 return result_list.release(); | 725 return result_list.release(); |
723 } | 726 } |
724 | 727 |
725 } // namespace file_manager_util | 728 } // namespace file_manager_util |
OLD | NEW |