| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_UPDATE_CLIENT_ACTION_H_ | 5 #ifndef COMPONENTS_UPDATE_CLIENT_ACTION_H_ |
| 6 #define COMPONENTS_UPDATE_CLIENT_ACTION_H_ | 6 #define COMPONENTS_UPDATE_CLIENT_ACTION_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 enum class ErrorCategory { | 33 enum class ErrorCategory { |
| 34 kErrorNone = 0, | 34 kErrorNone = 0, |
| 35 kNetworkError, | 35 kNetworkError, |
| 36 kUnpackError, | 36 kUnpackError, |
| 37 kInstallError, | 37 kInstallError, |
| 38 kServiceError, // Runtime errors which occur in the service itself. | 38 kServiceError, // Runtime errors which occur in the service itself. |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 enum class ServiceError { | 41 enum class ServiceError { |
| 42 ERROR_WAIT = 1, | 42 ERROR_WAIT = 1, |
| 43 ERROR_UPDATE_DISABLED = 2, |
| 43 }; | 44 }; |
| 44 | 45 |
| 45 using Callback = base::Callback<void(int error)>; | 46 using Callback = base::Callback<void(int error)>; |
| 46 virtual ~Action() {} | 47 virtual ~Action() {} |
| 47 | 48 |
| 48 // Runs the code encapsulated by the action. When an action completes, it can | 49 // Runs the code encapsulated by the action. When an action completes, it can |
| 49 // chain up and transfer the execution flow to another action or it can | 50 // chain up and transfer the execution flow to another action or it can |
| 50 // invoke the |callback| when this function has completed and there is nothing | 51 // invoke the |callback| when this function has completed and there is nothing |
| 51 // else to do. | 52 // else to do. |
| 52 virtual void Run(UpdateContext* update_context, Callback callback) = 0; | 53 virtual void Run(UpdateContext* update_context, Callback callback) = 0; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 UpdateContext* update_context_; // Not owned by this class. | 92 UpdateContext* update_context_; // Not owned by this class. |
| 92 Action::Callback callback_; | 93 Action::Callback callback_; |
| 93 | 94 |
| 94 private: | 95 private: |
| 95 DISALLOW_COPY_AND_ASSIGN(ActionImpl); | 96 DISALLOW_COPY_AND_ASSIGN(ActionImpl); |
| 96 }; | 97 }; |
| 97 | 98 |
| 98 } // namespace update_client | 99 } // namespace update_client |
| 99 | 100 |
| 100 #endif // COMPONENTS_UPDATE_CLIENT_ACTION_H_ | 101 #endif // COMPONENTS_UPDATE_CLIENT_ACTION_H_ |
| OLD | NEW |