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

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

Issue 1093383002: [WIP] Provided file system from NACL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved several modules to chromeos folder. Created 5 years, 5 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 template <class DestinationPolicy>
16 CloseFile::CloseFile(extensions::EventRouter* event_router, 16 CloseFile<DestinationPolicy>::CloseFile(
17 const ProvidedFileSystemInfo& file_system_info, 17 typename DestinationPolicy::EventRouterType* event_router,
18 int open_request_id, 18 const ProvidedFileSystemInfo& file_system_info,
19 const storage::AsyncFileUtil::StatusCallback& callback) 19 int open_request_id,
20 : Operation(event_router, file_system_info), 20 const storage::AsyncFileUtil::StatusCallback& callback)
21 : Operation<DestinationPolicy>(event_router, file_system_info),
21 open_request_id_(open_request_id), 22 open_request_id_(open_request_id),
22 callback_(callback) { 23 callback_(callback) {
23 } 24 }
24 25
25 CloseFile::~CloseFile() { 26 template <class DestinationPolicy>
27 CloseFile<DestinationPolicy>::~CloseFile() {
26 } 28 }
27 29
28 bool CloseFile::Execute(int request_id) { 30 template <class DestinationPolicy>
31 bool CloseFile<DestinationPolicy>::Execute(int request_id) {
29 using extensions::api::file_system_provider::CloseFileRequestedOptions; 32 using extensions::api::file_system_provider::CloseFileRequestedOptions;
30 33
31 CloseFileRequestedOptions options; 34 CloseFileRequestedOptions options;
32 options.file_system_id = file_system_info_.file_system_id(); 35 options.file_system_id = this->file_system_info_.file_system_id();
33 options.request_id = request_id; 36 options.request_id = request_id;
34 options.open_request_id = open_request_id_; 37 options.open_request_id = open_request_id_;
35 38
36 return SendEvent( 39 return this->SendEvent(
37 request_id, 40 request_id,
38 extensions::api::file_system_provider::OnCloseFileRequested::kEventName, 41 extensions::api::file_system_provider::OnCloseFileRequested::kEventName,
39 extensions::api::file_system_provider::OnCloseFileRequested::Create( 42 extensions::api::file_system_provider::OnCloseFileRequested::Create(
40 options)); 43 options));
41 } 44 }
42 45
43 void CloseFile::OnSuccess(int /* request_id */, 46 template <class DestinationPolicy>
44 scoped_ptr<RequestValue> result, 47 void CloseFile<DestinationPolicy>::OnSuccess(int /* request_id */,
45 bool has_more) { 48 scoped_ptr<RequestValue> result,
49 bool has_more) {
46 callback_.Run(base::File::FILE_OK); 50 callback_.Run(base::File::FILE_OK);
47 } 51 }
48 52
49 void CloseFile::OnError(int /* request_id */, 53 template <class DestinationPolicy>
50 scoped_ptr<RequestValue> /* result */, 54 void CloseFile<DestinationPolicy>::OnError(int /* request_id */,
51 base::File::Error error) { 55 scoped_ptr<RequestValue> /* result */,
56 base::File::Error error) {
52 callback_.Run(error); 57 callback_.Run(error);
53 } 58 }
54 59
60 FOR_EACH_DESTINATION_SPECIALIZE(CloseFile)
61
55 } // namespace operations 62 } // namespace operations
56 } // namespace file_system_provider 63 } // namespace file_system_provider
57 } // namespace chromeos 64 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698