| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_DOWNLOAD_INTERNAL_MODEL_H_ | 5 #ifndef COMPONENTS_DOWNLOAD_INTERNAL_MODEL_H_ |
| 6 #define COMPONENTS_DOWNLOAD_INTERNAL_MODEL_H_ | 6 #define COMPONENTS_DOWNLOAD_INTERNAL_MODEL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 class Client { | 25 class Client { |
| 26 public: | 26 public: |
| 27 virtual ~Client() = default; | 27 virtual ~Client() = default; |
| 28 | 28 |
| 29 // Called asynchronously in response to a Model::Initialize call. If | 29 // Called asynchronously in response to a Model::Initialize call. If |
| 30 // |success| is |false|, initialization of the Model and/or the underlying | 30 // |success| is |false|, initialization of the Model and/or the underlying |
| 31 // Store failed. Initialization of the Model is complete after this | 31 // Store failed. Initialization of the Model is complete after this |
| 32 // callback. If |success| is true it can be accessed now. | 32 // callback. If |success| is true it can be accessed now. |
| 33 virtual void OnInitialized(bool success) = 0; | 33 virtual void OnInitialized(bool success) = 0; |
| 34 | 34 |
| 35 // Called asynchronously in response to a Model::Destroy call. If |success| | 35 // Called asynchronously in response to a Model::Destroy call. |
| 36 // is |false|, destruction of the Model and/or the underlying Store failed. | |
| 37 // Destruction of the Model is effectively complete after this callback. | 36 // Destruction of the Model is effectively complete after this callback. |
| 38 virtual void OnDestroyed(bool success) = 0; | 37 virtual void OnDestroyed() = 0; |
| 39 | 38 |
| 40 // Called when an Entry addition is complete. |success| determines whether | 39 // Called when an Entry addition is complete. |success| determines whether |
| 41 // or not the entry has been successfully persisted to the Store. | 40 // or not the entry has been successfully persisted to the Store. |
| 42 virtual void OnItemAdded(bool success, | 41 virtual void OnItemAdded(bool success, |
| 43 DownloadClient client, | 42 DownloadClient client, |
| 44 const std::string& guid) = 0; | 43 const std::string& guid) = 0; |
| 45 | 44 |
| 46 // Called when an Entry update is complete. |success| determines whether or | 45 // Called when an Entry update is complete. |success| determines whether or |
| 47 // not the update has been successfully persisted to the Store. | 46 // not the update has been successfully persisted to the Store. |
| 48 virtual void OnItemUpdated(bool success, | 47 virtual void OnItemUpdated(bool success, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // Returns a temporary list of Entry objects that this Model stores. | 88 // Returns a temporary list of Entry objects that this Model stores. |
| 90 // IMPORTANT NOTE: Like Get(), the result of this method should be used | 89 // IMPORTANT NOTE: Like Get(), the result of this method should be used |
| 91 // immediately and NOT stored. The underlying data may get updated or removed | 90 // immediately and NOT stored. The underlying data may get updated or removed |
| 92 // by any other modifications to this model. | 91 // by any other modifications to this model. |
| 93 virtual EntryList PeekEntries() = 0; | 92 virtual EntryList PeekEntries() = 0; |
| 94 }; | 93 }; |
| 95 | 94 |
| 96 } // namespace download | 95 } // namespace download |
| 97 | 96 |
| 98 #endif // COMPONENTS_DOWNLOAD_INTERNAL_MODEL_H_ | 97 #endif // COMPONENTS_DOWNLOAD_INTERNAL_MODEL_H_ |
| OLD | NEW |