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

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

Issue 2716013003: Fixes to enable indication of bytes downloaded for Offline Pages in Download Home. (Closed)
Patch Set: more Created 3 years, 10 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_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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 protected: 72 protected:
73 virtual ~Observer() = default; 73 virtual ~Observer() = default;
74 }; 74 };
75 75
76 DownloadUIAdapter(OfflinePageModel* model, 76 DownloadUIAdapter(OfflinePageModel* model,
77 RequestCoordinator* coordinator, 77 RequestCoordinator* coordinator,
78 std::unique_ptr<Delegate> delegate); 78 std::unique_ptr<Delegate> delegate);
79 ~DownloadUIAdapter() override; 79 ~DownloadUIAdapter() override;
80 80
81 // TODO(dimich): Refactor all pieces of OfflinePages into a single service
fgorski 2017/02/27 16:22:56 I think we have a bug for it. Todo is not necessar
Dmitry Titov 2017/02/27 20:02:17 Done. Removed TODO, added more info/context to htt
82 // and vend all the objects from there.
83 static DownloadUIAdapter* FromOfflinePageModel(OfflinePageModel* model);
84 static void AttachToOfflinePageModel(DownloadUIAdapter* adapter,
85 OfflinePageModel* model);
86
81 // This adapter is potentially shared by UI elements, each of which adds 87 // This adapter is potentially shared by UI elements, each of which adds
82 // itself as an observer. 88 // itself as an observer.
83 // When the last observer is removed, cached list of items is destroyed and 89 // When the last observer is removed, cached list of items is destroyed and
84 // next time the initial loading will take longer. 90 // next time the initial loading will take longer.
85 void AddObserver(Observer* observer); 91 void AddObserver(Observer* observer);
86 void RemoveObserver(Observer* observer); 92 void RemoveObserver(Observer* observer);
87 93
88 // Returns all UI items. The list contains references to items in the cache 94 // Returns all UI items. The list contains references to items in the cache
89 // and has to be used synchronously. 95 // and has to be used synchronously.
90 std::vector<const DownloadUIItem*> GetAllItems() const; 96 std::vector<const DownloadUIItem*> GetAllItems() const;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 int observers_count_; 186 int observers_count_;
181 187
182 base::WeakPtrFactory<DownloadUIAdapter> weak_ptr_factory_; 188 base::WeakPtrFactory<DownloadUIAdapter> weak_ptr_factory_;
183 189
184 DISALLOW_COPY_AND_ASSIGN(DownloadUIAdapter); 190 DISALLOW_COPY_AND_ASSIGN(DownloadUIAdapter);
185 }; 191 };
186 192
187 } // namespace offline_pages 193 } // namespace offline_pages
188 194
189 #endif // COMPONENTS_OFFLINE_PAGE_DOWNLOADS_DOWNLOAD_UI_ADAPTER_H_ 195 #endif // COMPONENTS_OFFLINE_PAGE_DOWNLOADS_DOWNLOAD_UI_ADAPTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698