Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Side by Side Diff: components/offline_pages/core/downloads/download_ui_adapter.h

Issue 2489443002: Move all components/offline_pages/ files into component/offline_pages/core (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_PAGES_CORE_DOWNLOADS_DOWNLOAD_UI_ADAPTER_H_
6 #define COMPONENTS_OFFLINE_PAGE_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>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/observer_list.h" 13 #include "base/observer_list.h"
14 #include "base/supports_user_data.h" 14 #include "base/supports_user_data.h"
15 #include "components/offline_pages/downloads/download_ui_item.h" 15 #include "components/offline_pages/core/downloads/download_ui_item.h"
16 #include "components/offline_pages/offline_page_model.h" 16 #include "components/offline_pages/core/offline_page_model.h"
17 #include "components/offline_pages/offline_page_types.h" 17 #include "components/offline_pages/core/offline_page_types.h"
18 #include "url/gurl.h" 18 #include "url/gurl.h"
19 19
20 namespace offline_pages { 20 namespace offline_pages {
21 // C++ side of the UI Adapter. Mimics DownloadManager/Item/History (since we 21 // C++ side of the UI Adapter. Mimics DownloadManager/Item/History (since we
22 // share UI with Downloads). 22 // share UI with Downloads).
23 // An instance of this class is owned by OfflinePageModel and is shared between 23 // An instance of this class is owned by OfflinePageModel and is shared between
24 // UI components if needed. It manages the cache of DownloadUIItems, so after 24 // UI components if needed. It manages the cache of DownloadUIItems, so after
25 // initial load the UI components can synchronously pull the whoel list or any 25 // initial load the UI components can synchronously pull the whoel list or any
26 // item by its guid. 26 // item by its guid.
27 class DownloadUIAdapter : public OfflinePageModel::Observer, 27 class DownloadUIAdapter : public OfflinePageModel::Observer,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 OfflinePageModelChanged(OfflinePageModel* model) override;
84 void OfflinePageDeleted(int64_t offline_id, 84 void OfflinePageDeleted(int64_t offline_id,
85 const ClientId& client_id) override; 85 const ClientId& client_id) override;
86 86
87 private: 87 private:
88 enum class State { 88 enum class State { NOT_LOADED, LOADING, LOADED };
89 NOT_LOADED,
90 LOADING,
91 LOADED
92 };
93 89
94 struct ItemInfo { 90 struct ItemInfo {
95 explicit ItemInfo(const OfflinePageItem& page); 91 explicit ItemInfo(const OfflinePageItem& page);
96 ~ItemInfo(); 92 ~ItemInfo();
97 93
98 std::unique_ptr<DownloadUIItem> ui_item; 94 std::unique_ptr<DownloadUIItem> ui_item;
99 // Additional cached data, not exposed to UI through DownloadUIItem. 95 // Additional cached data, not exposed to UI through DownloadUIItem.
100 int64_t offline_id; 96 int64_t offline_id;
101 97
102 private: 98 private:
(...skipping 24 matching lines...) Expand all
127 int observers_count_; 123 int observers_count_;
128 124
129 base::WeakPtrFactory<DownloadUIAdapter> weak_ptr_factory_; 125 base::WeakPtrFactory<DownloadUIAdapter> weak_ptr_factory_;
130 126
131 DISALLOW_COPY_AND_ASSIGN(DownloadUIAdapter); 127 DISALLOW_COPY_AND_ASSIGN(DownloadUIAdapter);
132 }; 128 };
133 129
134 } // namespace offline_pages 130 } // namespace offline_pages
135 131
136 #endif // COMPONENTS_OFFLINE_PAGE_DOWNLOADS_DOWNLOAD_UI_ADAPTER_H_ 132 #endif // COMPONENTS_OFFLINE_PAGE_DOWNLOADS_DOWNLOAD_UI_ADAPTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698