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

Side by Side Diff: chrome/browser/android/offline_pages/downloads/offline_page_download_bridge.cc

Issue 2342443006: [Offline pages] Use the new policy bits (Closed)
Patch Set: also rename isUserRequested in offline page model impl 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 #include "chrome/browser/android/offline_pages/downloads/offline_page_download_b ridge.h" 5 #include "chrome/browser/android/offline_pages/downloads/offline_page_download_b ridge.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 ConvertUTF8ToJavaString(env, item.target_path.value()), 67 ConvertUTF8ToJavaString(env, item.target_path.value()),
68 item.start_time.ToJavaTime(), item.total_bytes); 68 item.start_time.ToJavaTime(), item.total_bytes);
69 } 69 }
70 70
71 std::vector<int64_t> FilterRequestsByGuid( 71 std::vector<int64_t> FilterRequestsByGuid(
72 std::vector<std::unique_ptr<SavePageRequest>> requests, 72 std::vector<std::unique_ptr<SavePageRequest>> requests,
73 const std::string& guid) { 73 const std::string& guid) {
74 std::vector<int64_t> request_ids; 74 std::vector<int64_t> request_ids;
75 for (const auto& request : requests) { 75 for (const auto& request : requests) {
76 if (request->client_id().id == guid && 76 if (request->client_id().id == guid &&
77 (request->client_id().name_space == kDownloadNamespace || 77 DownloadUIAdapter::IsVisibleInUI(request->client_id())) {
fgorski 2016/09/19 22:18:54 Have you considered calling the policy directly he
chili 2016/09/20 00:02:33 At first I picked DownloadUIAdapter because this i
78 request->client_id().name_space == kAsyncNamespace)) {
79 request_ids.push_back(request->request_id()); 78 request_ids.push_back(request->request_id());
80 } 79 }
81 } 80 }
82 return request_ids; 81 return request_ids;
83 } 82 }
84 83
85 void CancelRequestCallback(const RequestQueue::UpdateMultipleRequestResults&) { 84 void CancelRequestCallback(const RequestQueue::UpdateMultipleRequestResults&) {
86 // Results ignored here, as UI uses observer to update itself. 85 // Results ignored here, as UI uses observer to update itself.
87 } 86 }
88 87
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 353
355 DownloadUIAdapter* adapter = 354 DownloadUIAdapter* adapter =
356 DownloadUIAdapter::FromOfflinePageModel(offline_page_model); 355 DownloadUIAdapter::FromOfflinePageModel(offline_page_model);
357 356
358 return reinterpret_cast<jlong>( 357 return reinterpret_cast<jlong>(
359 new OfflinePageDownloadBridge(env, obj, adapter, browser_context)); 358 new OfflinePageDownloadBridge(env, obj, adapter, browser_context));
360 } 359 }
361 360
362 } // namespace android 361 } // namespace android
363 } // namespace offline_pages 362 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698