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

Side by Side Diff: components/offline_pages/offline_page_model.h

Issue 2420543004: Improve the page download: (Closed)
Patch Set: Created 4 years, 2 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_OFFLINE_PAGE_MODEL_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_
6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ 6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 // Returns true if saving an offline page may be attempted for |url|. 75 // Returns true if saving an offline page may be attempted for |url|.
76 static bool CanSaveURL(const GURL& url); 76 static bool CanSaveURL(const GURL& url);
77 77
78 OfflinePageModel(); 78 OfflinePageModel();
79 ~OfflinePageModel() override; 79 ~OfflinePageModel() override;
80 80
81 virtual void AddObserver(Observer* observer) = 0; 81 virtual void AddObserver(Observer* observer) = 0;
82 virtual void RemoveObserver(Observer* observer) = 0; 82 virtual void RemoveObserver(Observer* observer) = 0;
83 83
84 static const int64_t kInvalidOfflineId = 0;
85
84 // Attempts to save a page addressed by |url| offline. Requires that the model 86 // Attempts to save a page addressed by |url| offline. Requires that the model
85 // is loaded. Generates a new offline id and returns 87 // is loaded. Generates a new offline id and returns
86 // it. |proposed_offline_id| is used for the offline_id for the saved file if 88 // it. |proposed_offline_id| is used for the offline_id for the saved file if
87 // it is non-zero. If it is zero, a new, random ID will be generated. 89 // it is non-zero. If it is kInvalidOfflineId, a new, random ID will be
90 // generated.
88 virtual void SavePage(const GURL& url, 91 virtual void SavePage(const GURL& url,
89 const ClientId& client_id, 92 const ClientId& client_id,
90 int64_t proposed_offline_id, 93 int64_t proposed_offline_id,
91 std::unique_ptr<OfflinePageArchiver> archiver, 94 std::unique_ptr<OfflinePageArchiver> archiver,
92 const SavePageCallback& callback) = 0; 95 const SavePageCallback& callback) = 0;
93 96
94 // Marks that the offline page related to the passed |offline_id| has been 97 // Marks that the offline page related to the passed |offline_id| has been
95 // accessed. Its access info, including last access time and access count, 98 // accessed. Its access info, including last access time and access count,
96 // will be updated. Requires that the model is loaded. 99 // will be updated. Requires that the model is loaded.
97 virtual void MarkPageAccessed(int64_t offline_id) = 0; 100 virtual void MarkPageAccessed(int64_t offline_id) = 0;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // TODO(dougarnett): Remove this and its uses. 166 // TODO(dougarnett): Remove this and its uses.
164 virtual bool is_loaded() const = 0; 167 virtual bool is_loaded() const = 0;
165 168
166 // Returns the logger. Ownership is retained by the model. 169 // Returns the logger. Ownership is retained by the model.
167 virtual OfflineEventLogger* GetLogger() = 0; 170 virtual OfflineEventLogger* GetLogger() = 0;
168 }; 171 };
169 172
170 } // namespace offline_pages 173 } // namespace offline_pages
171 174
172 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_ 175 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698