OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "components/offline_pages/core/background/resource_tracker_observer_stu
b.h" |
| 6 |
| 7 namespace offline_pages { |
| 8 |
| 9 ResourceTrackerObserverStub::ResourceTrackerObserverStub() |
| 10 : images_started_(0), images_completed_(0) {} |
| 11 |
| 12 ResourceTrackerObserverStub::~ResourceTrackerObserverStub() {} |
| 13 |
| 14 // When we are notified of a resource load starting or ending, pass the |
| 15 // information along to the offliner. |
| 16 // TODO(petewil): Today this just supports images, expand to support all types. |
| 17 void ResourceTrackerObserverStub::ObserveResourceTracking( |
| 18 const ResourceDataType type, |
| 19 int64_t started_count, |
| 20 int64_t completed_count) { |
| 21 if (type == ResourceDataType::IMAGE) { |
| 22 images_started_ = started_count; |
| 23 images_completed_ = completed_count; |
| 24 } |
| 25 } |
| 26 |
| 27 // Returns the most recently seen counts for a specific resource type. |
| 28 // TODO(petewil): Today this just supports images, later support all types. |
| 29 void ResourceTrackerObserverStub::GetResourcePercentageCounts( |
| 30 const ResourceDataType type, |
| 31 int64_t* started, |
| 32 int64_t* completed) { |
| 33 if (type == ResourceDataType::IMAGE) { |
| 34 if (started) |
| 35 *started = images_started_; |
| 36 if (completed) |
| 37 *completed = images_completed_; |
| 38 } |
| 39 } |
| 40 |
| 41 } // namespace offline_pages |
OLD | NEW |