| 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_PAGE_DOWNLOADS_DOWNLOAD_UI_ADAPTER_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGE_DOWNLOADS_DOWNLOAD_UI_ADAPTER_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGE_DOWNLOADS_DOWNLOAD_UI_ADAPTER_H_ | 6 #define COMPONENTS_OFFLINE_PAGE_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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 explicit DownloadUIAdapter(OfflinePageModel* model); | 53 explicit DownloadUIAdapter(OfflinePageModel* model); |
| 54 ~DownloadUIAdapter() override; | 54 ~DownloadUIAdapter() override; |
| 55 | 55 |
| 56 static DownloadUIAdapter* FromOfflinePageModel( | 56 static DownloadUIAdapter* FromOfflinePageModel( |
| 57 OfflinePageModel* offline_page_model); | 57 OfflinePageModel* offline_page_model); |
| 58 | 58 |
| 59 // Checks a client ID for proper namespace and ID format to be shown in the | 59 // Checks a client ID for proper namespace and ID format to be shown in the |
| 60 // Downloads Home UI. | 60 // Downloads Home UI. |
| 61 static bool IsVisibleInUI(const ClientId& page); | 61 bool IsVisibleInUI(const ClientId& page); |
| 62 | 62 |
| 63 // This adapter is potentially shared by UI elements, each of which adds | 63 // This adapter is potentially shared by UI elements, each of which adds |
| 64 // itself as an observer. | 64 // itself as an observer. |
| 65 // When the last observer si removed, cached list of items is destroyed and | 65 // When the last observer si removed, cached list of items is destroyed and |
| 66 // next time the initial loading will take longer. | 66 // next time the initial loading will take longer. |
| 67 void AddObserver(Observer* observer); | 67 void AddObserver(Observer* observer); |
| 68 void RemoveObserver(Observer* observer); | 68 void RemoveObserver(Observer* observer); |
| 69 | 69 |
| 70 // Returns all UI items. The list contains references to items in the cache | 70 // Returns all UI items. The list contains references to items in the cache |
| 71 // and has to be used synchronously. | 71 // and has to be used synchronously. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 int observers_count_; | 128 int observers_count_; |
| 129 | 129 |
| 130 base::WeakPtrFactory<DownloadUIAdapter> weak_ptr_factory_; | 130 base::WeakPtrFactory<DownloadUIAdapter> weak_ptr_factory_; |
| 131 | 131 |
| 132 DISALLOW_COPY_AND_ASSIGN(DownloadUIAdapter); | 132 DISALLOW_COPY_AND_ASSIGN(DownloadUIAdapter); |
| 133 }; | 133 }; |
| 134 | 134 |
| 135 } // namespace offline_pages | 135 } // namespace offline_pages |
| 136 | 136 |
| 137 #endif // COMPONENTS_OFFLINE_PAGE_DOWNLOADS_DOWNLOAD_UI_ADAPTER_H_ | 137 #endif // COMPONENTS_OFFLINE_PAGE_DOWNLOADS_DOWNLOAD_UI_ADAPTER_H_ |
| OLD | NEW |