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

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

Issue 2284933002: Remove OfflineURL from offline page (Closed)
Patch Set: Fix trybot Created 4 years, 3 months 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_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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 // Returns all UI items. The list contains references to items in the cache 66 // Returns all UI items. The list contains references to items in the cache
67 // and has to be used synchronously. 67 // and has to be used synchronously.
68 std::vector<const DownloadUIItem*> GetAllItems() const; 68 std::vector<const DownloadUIItem*> GetAllItems() const;
69 // May return nullptr if item with specified guid does not exist. 69 // May return nullptr if item with specified guid does not exist.
70 const DownloadUIItem* GetItem(const std::string& guid) const; 70 const DownloadUIItem* GetItem(const std::string& guid) const;
71 71
72 // Commands from UI. Start async operations, result is observable 72 // Commands from UI. Start async operations, result is observable
73 // via Observer or directly by the user (as in 'open'). 73 // via Observer or directly by the user (as in 'open').
74 void DeleteItem(const std::string& guid); 74 void DeleteItem(const std::string& guid);
75 GURL GetOfflineUrlByGuid(const std::string& guid) const;
76 75
77 // OfflinePageModel::Observer 76 // OfflinePageModel::Observer
78 void OfflinePageModelLoaded(OfflinePageModel* model) override; 77 void OfflinePageModelLoaded(OfflinePageModel* model) override;
79 void OfflinePageModelChanged(OfflinePageModel* model) override; 78 void OfflinePageModelChanged(OfflinePageModel* model) override;
80 void OfflinePageDeleted(int64_t offline_id, 79 void OfflinePageDeleted(int64_t offline_id,
81 const ClientId& client_id) override; 80 const ClientId& client_id) override;
82 81
83 private: 82 private:
84 enum class State { 83 enum class State {
85 NOT_LOADED, 84 NOT_LOADED,
86 LOADING, 85 LOADING,
87 LOADED 86 LOADED
88 }; 87 };
89 88
90 struct ItemInfo { 89 struct ItemInfo {
91 explicit ItemInfo(const OfflinePageItem& page); 90 explicit ItemInfo(const OfflinePageItem& page);
92 ~ItemInfo(); 91 ~ItemInfo();
93 92
94 std::unique_ptr<DownloadUIItem> ui_item; 93 std::unique_ptr<DownloadUIItem> ui_item;
95 // Additional cached data, not exposed to UI through DownloadUIItem. 94 // Additional cached data, not exposed to UI through DownloadUIItem.
96 int64_t offline_id; 95 int64_t offline_id;
97 GURL offline_url;
98 96
99 private: 97 private:
100 DISALLOW_COPY_AND_ASSIGN(ItemInfo); 98 DISALLOW_COPY_AND_ASSIGN(ItemInfo);
101 }; 99 };
102 100
103 typedef std::map<std::string, std::unique_ptr<ItemInfo>> DownloadUIItems; 101 typedef std::map<std::string, std::unique_ptr<ItemInfo>> DownloadUIItems;
104 102
105 void LoadCache(); 103 void LoadCache();
106 void ClearCache(); 104 void ClearCache();
107 105
(...skipping 18 matching lines...) Expand all
126 int observers_count_; 124 int observers_count_;
127 125
128 base::WeakPtrFactory<DownloadUIAdapter> weak_ptr_factory_; 126 base::WeakPtrFactory<DownloadUIAdapter> weak_ptr_factory_;
129 127
130 DISALLOW_COPY_AND_ASSIGN(DownloadUIAdapter); 128 DISALLOW_COPY_AND_ASSIGN(DownloadUIAdapter);
131 }; 129 };
132 130
133 } // namespace offline_pages 131 } // namespace offline_pages
134 132
135 #endif // COMPONENTS_OFFLINE_PAGE_DOWNLOADS_DOWNLOAD_UI_ADAPTER_H_ 133 #endif // COMPONENTS_OFFLINE_PAGE_DOWNLOADS_DOWNLOAD_UI_ADAPTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698