| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_OFFLINE_PAGES_CORE_DOWNLOADS_DOWNLOAD_UI_ADAPTER_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_DOWNLOADS_DOWNLOAD_UI_ADAPTER_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_CORE_DOWNLOADS_DOWNLOAD_UI_ADAPTER_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_CORE_DOWNLOADS_DOWNLOAD_UI_ADAPTER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // May return nullptr if item with specified guid does not exist. | 73 // May return nullptr if item with specified guid does not exist. |
| 74 const DownloadUIItem* GetItem(const std::string& guid) const; | 74 const DownloadUIItem* GetItem(const std::string& guid) const; |
| 75 | 75 |
| 76 // Commands from UI. Start async operations, result is observable | 76 // Commands from UI. Start async operations, result is observable |
| 77 // via Observer or directly by the user (as in 'open'). | 77 // via Observer or directly by the user (as in 'open'). |
| 78 void DeleteItem(const std::string& guid); | 78 void DeleteItem(const std::string& guid); |
| 79 int64_t GetOfflineIdByGuid(const std::string& guid) const; | 79 int64_t GetOfflineIdByGuid(const std::string& guid) const; |
| 80 | 80 |
| 81 // OfflinePageModel::Observer | 81 // OfflinePageModel::Observer |
| 82 void OfflinePageModelLoaded(OfflinePageModel* model) override; | 82 void OfflinePageModelLoaded(OfflinePageModel* model) override; |
| 83 void OfflinePageModelChanged(OfflinePageModel* model) override; | 83 void OfflinePageAdded(OfflinePageModel* model, |
| 84 const OfflinePageItem& added_page) override; |
| 84 void OfflinePageDeleted(int64_t offline_id, | 85 void OfflinePageDeleted(int64_t offline_id, |
| 85 const ClientId& client_id) override; | 86 const ClientId& client_id) override; |
| 86 | 87 |
| 87 private: | 88 private: |
| 88 enum class State { NOT_LOADED, LOADING, LOADED }; | 89 enum class State { NOT_LOADED, LOADING, LOADED }; |
| 89 | 90 |
| 90 struct ItemInfo { | 91 struct ItemInfo { |
| 91 explicit ItemInfo(const OfflinePageItem& page); | 92 explicit ItemInfo(const OfflinePageItem& page); |
| 92 ~ItemInfo(); | 93 ~ItemInfo(); |
| 93 | 94 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 123 int observers_count_; | 124 int observers_count_; |
| 124 | 125 |
| 125 base::WeakPtrFactory<DownloadUIAdapter> weak_ptr_factory_; | 126 base::WeakPtrFactory<DownloadUIAdapter> weak_ptr_factory_; |
| 126 | 127 |
| 127 DISALLOW_COPY_AND_ASSIGN(DownloadUIAdapter); | 128 DISALLOW_COPY_AND_ASSIGN(DownloadUIAdapter); |
| 128 }; | 129 }; |
| 129 | 130 |
| 130 } // namespace offline_pages | 131 } // namespace offline_pages |
| 131 | 132 |
| 132 #endif // COMPONENTS_OFFLINE_PAGE_DOWNLOADS_DOWNLOAD_UI_ADAPTER_H_ | 133 #endif // COMPONENTS_OFFLINE_PAGE_DOWNLOADS_DOWNLOAD_UI_ADAPTER_H_ |
| OLD | NEW |