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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/operations/close_file.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/close_file.h" 5 #include "chrome/browser/chromeos/file_system_provider/operations/close_file.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "chrome/common/extensions/api/file_system_provider.h" 9 #include "chrome/common/extensions/api/file_system_provider.h"
10 #include "chrome/common/extensions/api/file_system_provider_internal.h" 10 #include "chrome/common/extensions/api/file_system_provider_internal.h"
11 11
12 namespace chromeos { 12 namespace chromeos {
13 namespace file_system_provider { 13 namespace file_system_provider {
14 namespace operations { 14 namespace operations {
15 15
16 CloseFile::CloseFile(extensions::EventRouter* event_router, 16 CloseFile::CloseFile(extensions::EventRouter* event_router,
17 const ProvidedFileSystemInfo& file_system_info, 17 const ProvidedFileSystemInfo& file_system_info,
18 int open_request_id, 18 int open_request_id,
19 const storage::AsyncFileUtil::StatusCallback& callback) 19 const storage::AsyncFileUtil::StatusCallback& callback)
20 : Operation(event_router, file_system_info), 20 : Operation(event_router, file_system_info),
21 open_request_id_(open_request_id), 21 open_request_id_(open_request_id),
22 callback_(callback) { 22 callback_(callback) {
23 } 23 }
24 24
25 CloseFile::~CloseFile() { 25 CloseFile::~CloseFile() {
26 } 26 }
27 27
28 bool CloseFile::Execute(int request_id) { 28 bool CloseFile::Execute(int request_id) {
29 scoped_ptr<base::DictionaryValue> values(new base::DictionaryValue); 29 using extensions::api::file_system_provider::CloseFileRequestedOptions;
30 values->SetInteger("openRequestId", open_request_id_); 30
31 CloseFileRequestedOptions options;
32 options.file_system_id = file_system_info_.file_system_id();
33 options.request_id = request_id;
34 options.open_request_id = open_request_id_;
31 35
32 return SendEvent( 36 return SendEvent(
33 request_id, 37 request_id,
34 extensions::api::file_system_provider::OnCloseFileRequested::kEventName, 38 extensions::api::file_system_provider::OnCloseFileRequested::kEventName,
35 values.Pass()); 39 extensions::api::file_system_provider::OnCloseFileRequested::Create(
40 options));
36 } 41 }
37 42
38 void CloseFile::OnSuccess(int /* request_id */, 43 void CloseFile::OnSuccess(int /* request_id */,
39 scoped_ptr<RequestValue> result, 44 scoped_ptr<RequestValue> result,
40 bool has_more) { 45 bool has_more) {
41 callback_.Run(base::File::FILE_OK); 46 callback_.Run(base::File::FILE_OK);
42 } 47 }
43 48
44 void CloseFile::OnError(int /* request_id */, 49 void CloseFile::OnError(int /* request_id */,
45 scoped_ptr<RequestValue> /* result */, 50 scoped_ptr<RequestValue> /* result */,
46 base::File::Error error) { 51 base::File::Error error) {
47 callback_.Run(error); 52 callback_.Run(error);
48 } 53 }
49 54
50 } // namespace operations 55 } // namespace operations
51 } // namespace file_system_provider 56 } // namespace file_system_provider
52 } // namespace chromeos 57 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698