| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 std::vector<const DownloadUIItem*> GetAllItems() const; | 72 std::vector<const DownloadUIItem*> GetAllItems() const; |
| 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; | |
| 83 void OfflinePageAdded(OfflinePageModel* model, | 82 void OfflinePageAdded(OfflinePageModel* model, |
| 84 const OfflinePageItem& added_page) override; | 83 const OfflinePageItem& added_page) override; |
| 85 void OfflinePageDeleted(int64_t offline_id, | 84 void OfflinePageDeleted(int64_t offline_id, |
| 86 const ClientId& client_id) override; | 85 const ClientId& client_id) override; |
| 87 | 86 |
| 88 private: | 87 private: |
| 89 enum class State { NOT_LOADED, LOADING, LOADED }; | 88 enum class State { NOT_LOADED, LOADING, LOADED }; |
| 90 | 89 |
| 91 struct ItemInfo { | 90 struct ItemInfo { |
| 92 explicit ItemInfo(const OfflinePageItem& page); | 91 explicit ItemInfo(const OfflinePageItem& page); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 123 int observers_count_; | 122 int observers_count_; |
| 124 | 123 |
| 125 base::WeakPtrFactory<DownloadUIAdapter> weak_ptr_factory_; | 124 base::WeakPtrFactory<DownloadUIAdapter> weak_ptr_factory_; |
| 126 | 125 |
| 127 DISALLOW_COPY_AND_ASSIGN(DownloadUIAdapter); | 126 DISALLOW_COPY_AND_ASSIGN(DownloadUIAdapter); |
| 128 }; | 127 }; |
| 129 | 128 |
| 130 } // namespace offline_pages | 129 } // namespace offline_pages |
| 131 | 130 |
| 132 #endif // COMPONENTS_OFFLINE_PAGE_DOWNLOADS_DOWNLOAD_UI_ADAPTER_H_ | 131 #endif // COMPONENTS_OFFLINE_PAGE_DOWNLOADS_DOWNLOAD_UI_ADAPTER_H_ |
| OLD | NEW |