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

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

Issue 2342443006: [Offline pages] Use the new policy bits (Closed)
Patch Set: i think i got it! Made sure it compiles 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 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"
11 #include "base/threading/thread_task_runner_handle.h" 11 #include "base/threading/thread_task_runner_handle.h"
12 #include "components/offline_pages/client_namespace_constants.h" 12 #include "components/offline_pages/client_namespace_constants.h"
13 #include "components/offline_pages/client_policy_controller.h"
13 #include "components/offline_pages/downloads/download_ui_item.h" 14 #include "components/offline_pages/downloads/download_ui_item.h"
14 #include "components/offline_pages/offline_page_model.h" 15 #include "components/offline_pages/offline_page_model.h"
15 16
16 namespace offline_pages { 17 namespace offline_pages {
17 18
18 namespace { 19 namespace {
19 const char kDownloadUIAdapterKey[] = "download-ui-adapter"; 20 const char kDownloadUIAdapterKey[] = "download-ui-adapter";
20 } 21 }
21 22
22 DownloadUIAdapter::ItemInfo::ItemInfo(const OfflinePageItem& page) 23 DownloadUIAdapter::ItemInfo::ItemInfo(const OfflinePageItem& page)
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 for (auto& guid : added_guids) { 202 for (auto& guid : added_guids) {
202 const DownloadUIItem& item = *(items_.find(guid)->second->ui_item.get()); 203 const DownloadUIItem& item = *(items_.find(guid)->second->ui_item.get());
203 FOR_EACH_OBSERVER(Observer, observers_, ItemAdded(item)); 204 FOR_EACH_OBSERVER(Observer, observers_, ItemAdded(item));
204 } 205 }
205 } 206 }
206 207
207 void DownloadUIAdapter::OnDeletePagesDone(DeletePageResult result) { 208 void DownloadUIAdapter::OnDeletePagesDone(DeletePageResult result) {
208 // TODO(dimich): Consider adding UMA to record user actions. 209 // TODO(dimich): Consider adding UMA to record user actions.
209 } 210 }
210 211
211 // static
212 bool DownloadUIAdapter::IsVisibleInUI(const ClientId& client_id) { 212 bool DownloadUIAdapter::IsVisibleInUI(const ClientId& client_id) {
213 const std::string& name_space = client_id.name_space; 213 const std::string& name_space = client_id.name_space;
214 return (name_space == kAsyncNamespace || name_space == kDownloadNamespace) && 214 return model_->GetPolicyController()->IsSupportedByDownload(name_space) &&
215 base::IsValidGUID(client_id.id); 215 base::IsValidGUID(client_id.id);
216 } 216 }
217 217
218 } // namespace offline_pages 218 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698