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

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

Issue 2512073002: [Offline Pages] Removes two-step expiration related. (Closed)
Patch Set: adding unit in histograms. 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 #include "components/offline_pages/downloads/download_ui_adapter.h" 5 #include "components/offline_pages/downloads/download_ui_adapter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/guid.h" 8 #include "base/guid.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } 116 }
117 117
118 void DownloadUIAdapter::DeleteItem(const std::string& guid) { 118 void DownloadUIAdapter::DeleteItem(const std::string& guid) {
119 // TODO(dimich): Also remove pending request from RequestQueue. 119 // TODO(dimich): Also remove pending request from RequestQueue.
120 DownloadUIItems::const_iterator it = items_.find(guid); 120 DownloadUIItems::const_iterator it = items_.find(guid);
121 if (it == items_.end()) 121 if (it == items_.end())
122 return; 122 return;
123 123
124 std::vector<int64_t> page_ids; 124 std::vector<int64_t> page_ids;
125 page_ids.push_back(it->second->offline_id); 125 page_ids.push_back(it->second->offline_id);
126 // TODO(dimich): This should be ExpirePages(...Now()..) when Expire is
127 // firing Observer method. The resulting Observer notification will update
128 // local cache.
129 model_->DeletePagesByOfflineId( 126 model_->DeletePagesByOfflineId(
130 page_ids, base::Bind(&DownloadUIAdapter::OnDeletePagesDone, 127 page_ids, base::Bind(&DownloadUIAdapter::OnDeletePagesDone,
131 weak_ptr_factory_.GetWeakPtr())); 128 weak_ptr_factory_.GetWeakPtr()));
132 } 129 }
133 130
134 int64_t DownloadUIAdapter::GetOfflineIdByGuid( 131 int64_t DownloadUIAdapter::GetOfflineIdByGuid(
135 const std::string& guid) const { 132 const std::string& guid) const {
136 // TODO(dimich): when requests are also in the cache, filter them out. 133 // TODO(dimich): when requests are also in the cache, filter them out.
137 // Requests do not yet have offline ID. 134 // Requests do not yet have offline ID.
138 DownloadUIItems::const_iterator it = items_.find(guid); 135 DownloadUIItems::const_iterator it = items_.find(guid);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 // TODO(dimich): Consider adding UMA to record user actions. 208 // TODO(dimich): Consider adding UMA to record user actions.
212 } 209 }
213 210
214 bool DownloadUIAdapter::IsVisibleInUI(const ClientId& client_id) { 211 bool DownloadUIAdapter::IsVisibleInUI(const ClientId& client_id) {
215 const std::string& name_space = client_id.name_space; 212 const std::string& name_space = client_id.name_space;
216 return model_->GetPolicyController()->IsSupportedByDownload(name_space) && 213 return model_->GetPolicyController()->IsSupportedByDownload(name_space) &&
217 base::IsValidGUID(client_id.id); 214 base::IsValidGUID(client_id.id);
218 } 215 }
219 216
220 } // namespace offline_pages 217 } // namespace offline_pages
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/offline/offline_internals_ui_message_handler.cc ('k') | components/offline_pages/offline_page_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698