OLD | NEW |
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 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_REQUEST_VALUE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_REQUEST_VALUE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_REQUEST_VALUE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_REQUEST_VALUE_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "chrome/common/extensions/api/file_system_provider_internal.h" | 12 #include "chrome/common/extensions/api/file_system_provider_internal.h" |
13 | 13 |
14 namespace chromeos { | 14 namespace chromeos { |
15 namespace file_system_provider { | 15 namespace file_system_provider { |
16 | 16 |
17 // Holds a parsed value returned by a providing extension. Each accessor can | 17 // Holds a parsed value returned by a providing extension. Each accessor can |
18 // return NULL in case the requested value type is not available. It is used | 18 // return NULL in case the requested value type is not available. It is used |
19 // to pass values of success callbacks. | 19 // to pass values of success callbacks. |
20 class RequestValue { | 20 class RequestValue { |
21 public: | 21 public: |
22 // Creates an empty value. Use static methods to create a value holding a | 22 // Creates an empty value. Use static methods to create a value holding a |
23 // proper content. | 23 // proper content. |
24 RequestValue(); | 24 RequestValue(); |
25 | 25 |
26 virtual ~RequestValue(); | 26 virtual ~RequestValue(); |
27 | 27 |
28 static scoped_ptr<RequestValue> CreateForUnmountSuccess( | 28 static std::unique_ptr<RequestValue> CreateForUnmountSuccess( |
29 scoped_ptr<extensions::api::file_system_provider_internal:: | 29 std::unique_ptr<extensions::api::file_system_provider_internal:: |
30 UnmountRequestedSuccess::Params> params); | 30 UnmountRequestedSuccess::Params> params); |
31 | 31 |
32 static scoped_ptr<RequestValue> CreateForGetMetadataSuccess( | 32 static std::unique_ptr<RequestValue> CreateForGetMetadataSuccess( |
33 scoped_ptr<extensions::api::file_system_provider_internal:: | 33 std::unique_ptr<extensions::api::file_system_provider_internal:: |
34 GetMetadataRequestedSuccess::Params> params); | 34 GetMetadataRequestedSuccess::Params> params); |
35 | 35 |
36 static scoped_ptr<RequestValue> CreateForGetActionsSuccess( | 36 static std::unique_ptr<RequestValue> CreateForGetActionsSuccess( |
37 scoped_ptr<extensions::api::file_system_provider_internal:: | 37 std::unique_ptr<extensions::api::file_system_provider_internal:: |
38 GetActionsRequestedSuccess::Params> params); | 38 GetActionsRequestedSuccess::Params> params); |
39 | 39 |
40 static scoped_ptr<RequestValue> CreateForReadDirectorySuccess( | 40 static std::unique_ptr<RequestValue> CreateForReadDirectorySuccess( |
41 scoped_ptr<extensions::api::file_system_provider_internal:: | 41 std::unique_ptr<extensions::api::file_system_provider_internal:: |
42 ReadDirectoryRequestedSuccess::Params> params); | 42 ReadDirectoryRequestedSuccess::Params> params); |
43 | 43 |
44 static scoped_ptr<RequestValue> CreateForReadFileSuccess( | 44 static std::unique_ptr<RequestValue> CreateForReadFileSuccess( |
45 scoped_ptr<extensions::api::file_system_provider_internal:: | 45 std::unique_ptr<extensions::api::file_system_provider_internal:: |
46 ReadFileRequestedSuccess::Params> params); | 46 ReadFileRequestedSuccess::Params> params); |
47 | 47 |
48 static scoped_ptr<RequestValue> CreateForOperationSuccess( | 48 static std::unique_ptr<RequestValue> CreateForOperationSuccess( |
49 scoped_ptr<extensions::api::file_system_provider_internal:: | 49 std::unique_ptr<extensions::api::file_system_provider_internal:: |
50 OperationRequestedSuccess::Params> params); | 50 OperationRequestedSuccess::Params> params); |
51 | 51 |
52 static scoped_ptr<RequestValue> CreateForOperationError( | 52 static std::unique_ptr<RequestValue> CreateForOperationError( |
53 scoped_ptr<extensions::api::file_system_provider_internal:: | 53 std::unique_ptr<extensions::api::file_system_provider_internal:: |
54 OperationRequestedError::Params> params); | 54 OperationRequestedError::Params> params); |
55 | 55 |
56 static scoped_ptr<RequestValue> CreateForTesting(const std::string& params); | 56 static std::unique_ptr<RequestValue> CreateForTesting( |
| 57 const std::string& params); |
57 | 58 |
58 const extensions::api::file_system_provider_internal:: | 59 const extensions::api::file_system_provider_internal:: |
59 UnmountRequestedSuccess::Params* | 60 UnmountRequestedSuccess::Params* |
60 unmount_success_params() const { | 61 unmount_success_params() const { |
61 return unmount_success_params_.get(); | 62 return unmount_success_params_.get(); |
62 } | 63 } |
63 | 64 |
64 const extensions::api::file_system_provider_internal:: | 65 const extensions::api::file_system_provider_internal:: |
65 GetMetadataRequestedSuccess::Params* | 66 GetMetadataRequestedSuccess::Params* |
66 get_metadata_success_params() const { | 67 get_metadata_success_params() const { |
(...skipping 26 matching lines...) Expand all Loading... |
93 | 94 |
94 const extensions::api::file_system_provider_internal:: | 95 const extensions::api::file_system_provider_internal:: |
95 OperationRequestedError::Params* | 96 OperationRequestedError::Params* |
96 operation_error_params() const { | 97 operation_error_params() const { |
97 return operation_error_params_.get(); | 98 return operation_error_params_.get(); |
98 } | 99 } |
99 | 100 |
100 const std::string* testing_params() const { return testing_params_.get(); } | 101 const std::string* testing_params() const { return testing_params_.get(); } |
101 | 102 |
102 private: | 103 private: |
103 scoped_ptr<extensions::api::file_system_provider_internal:: | 104 std::unique_ptr<extensions::api::file_system_provider_internal:: |
104 UnmountRequestedSuccess::Params> unmount_success_params_; | 105 UnmountRequestedSuccess::Params> |
105 scoped_ptr<extensions::api::file_system_provider_internal:: | 106 unmount_success_params_; |
106 GetMetadataRequestedSuccess::Params> | 107 std::unique_ptr<extensions::api::file_system_provider_internal:: |
| 108 GetMetadataRequestedSuccess::Params> |
107 get_metadata_success_params_; | 109 get_metadata_success_params_; |
108 scoped_ptr<extensions::api::file_system_provider_internal:: | 110 std::unique_ptr<extensions::api::file_system_provider_internal:: |
109 GetActionsRequestedSuccess::Params> | 111 GetActionsRequestedSuccess::Params> |
110 get_actions_success_params_; | 112 get_actions_success_params_; |
111 scoped_ptr<extensions::api::file_system_provider_internal:: | 113 std::unique_ptr<extensions::api::file_system_provider_internal:: |
112 ReadDirectoryRequestedSuccess::Params> | 114 ReadDirectoryRequestedSuccess::Params> |
113 read_directory_success_params_; | 115 read_directory_success_params_; |
114 scoped_ptr<extensions::api::file_system_provider_internal:: | 116 std::unique_ptr<extensions::api::file_system_provider_internal:: |
115 ReadFileRequestedSuccess::Params> read_file_success_params_; | 117 ReadFileRequestedSuccess::Params> |
116 scoped_ptr<extensions::api::file_system_provider_internal:: | 118 read_file_success_params_; |
117 OperationRequestedSuccess::Params> operation_success_params_; | 119 std::unique_ptr<extensions::api::file_system_provider_internal:: |
118 scoped_ptr<extensions::api::file_system_provider_internal:: | 120 OperationRequestedSuccess::Params> |
119 OperationRequestedError::Params> operation_error_params_; | 121 operation_success_params_; |
120 scoped_ptr<std::string> testing_params_; | 122 std::unique_ptr<extensions::api::file_system_provider_internal:: |
| 123 OperationRequestedError::Params> |
| 124 operation_error_params_; |
| 125 std::unique_ptr<std::string> testing_params_; |
121 | 126 |
122 DISALLOW_COPY_AND_ASSIGN(RequestValue); | 127 DISALLOW_COPY_AND_ASSIGN(RequestValue); |
123 }; | 128 }; |
124 | 129 |
125 } // namespace file_system_provider | 130 } // namespace file_system_provider |
126 } // namespace chromeos | 131 } // namespace chromeos |
127 | 132 |
128 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_REQUEST_VALUE_H_ | 133 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_REQUEST_VALUE_H_ |
OLD | NEW |