Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(432)

Side by Side Diff: chrome/browser/chromeos/file_system_provider/operations/read_directory.cc

Issue 547313002: [fsp] Use auto generated methods for generating dictionaries. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/chromeos/file_system_provider/operations/read_directory .h" 5 #include "chrome/browser/chromeos/file_system_provider/operations/read_directory .h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/memory/linked_ptr.h" 9 #include "base/memory/linked_ptr.h"
10 #include "chrome/common/extensions/api/file_system_provider.h" 10 #include "chrome/common/extensions/api/file_system_provider.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 const storage::AsyncFileUtil::ReadDirectoryCallback& callback) 59 const storage::AsyncFileUtil::ReadDirectoryCallback& callback)
60 : Operation(event_router, file_system_info), 60 : Operation(event_router, file_system_info),
61 directory_path_(directory_path), 61 directory_path_(directory_path),
62 callback_(callback) { 62 callback_(callback) {
63 } 63 }
64 64
65 ReadDirectory::~ReadDirectory() { 65 ReadDirectory::~ReadDirectory() {
66 } 66 }
67 67
68 bool ReadDirectory::Execute(int request_id) { 68 bool ReadDirectory::Execute(int request_id) {
69 scoped_ptr<base::DictionaryValue> values(new base::DictionaryValue); 69 using extensions::api::file_system_provider::ReadDirectoryRequestedOptions;
70 values->SetString("directoryPath", directory_path_.AsUTF8Unsafe()); 70
71 return SendEvent(request_id, 71 ReadDirectoryRequestedOptions options;
72 extensions::api::file_system_provider:: 72 options.file_system_id = file_system_info_.file_system_id();
73 OnReadDirectoryRequested::kEventName, 73 options.request_id = request_id;
74 values.Pass()); 74 options.directory_path = directory_path_.AsUTF8Unsafe();
75
76 return SendEvent(
77 request_id,
78 extensions::api::file_system_provider::OnReadDirectoryRequested::
79 kEventName,
80 extensions::api::file_system_provider::OnReadDirectoryRequested::Create(
81 options));
75 } 82 }
76 83
77 void ReadDirectory::OnSuccess(int /* request_id */, 84 void ReadDirectory::OnSuccess(int /* request_id */,
78 scoped_ptr<RequestValue> result, 85 scoped_ptr<RequestValue> result,
79 bool has_more) { 86 bool has_more) {
80 storage::AsyncFileUtil::EntryList entry_list; 87 storage::AsyncFileUtil::EntryList entry_list;
81 const bool convert_result = 88 const bool convert_result =
82 ConvertRequestValueToEntryList(result.Pass(), &entry_list); 89 ConvertRequestValueToEntryList(result.Pass(), &entry_list);
83 90
84 if (!convert_result) { 91 if (!convert_result) {
(...skipping 11 matching lines...) Expand all
96 void ReadDirectory::OnError(int /* request_id */, 103 void ReadDirectory::OnError(int /* request_id */,
97 scoped_ptr<RequestValue> /* result */, 104 scoped_ptr<RequestValue> /* result */,
98 base::File::Error error) { 105 base::File::Error error) {
99 callback_.Run( 106 callback_.Run(
100 error, storage::AsyncFileUtil::EntryList(), false /* has_more */); 107 error, storage::AsyncFileUtil::EntryList(), false /* has_more */);
101 } 108 }
102 109
103 } // namespace operations 110 } // namespace operations
104 } // namespace file_system_provider 111 } // namespace file_system_provider
105 } // namespace chromeos 112 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698