| Index: components/offline_pages/core/background/resource_tracker_observer_stub.cc
|
| diff --git a/components/offline_pages/core/background/resource_tracker_observer_stub.cc b/components/offline_pages/core/background/resource_tracker_observer_stub.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c2408719e6c74c3bfe274d37d7ea483cbbc5070e
|
| --- /dev/null
|
| +++ b/components/offline_pages/core/background/resource_tracker_observer_stub.cc
|
| @@ -0,0 +1,41 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "components/offline_pages/core/background/resource_tracker_observer_stub.h"
|
| +
|
| +namespace offline_pages {
|
| +
|
| +ResourceTrackerObserverStub::ResourceTrackerObserverStub()
|
| + : images_started_(0), images_completed_(0) {}
|
| +
|
| +ResourceTrackerObserverStub::~ResourceTrackerObserverStub() {}
|
| +
|
| +// When we are notified of a resource load starting or ending, pass the
|
| +// information along to the offliner.
|
| +// TODO(petewil): Today this just supports images, expand to support all types.
|
| +void ResourceTrackerObserverStub::ObserveResourceTracking(
|
| + const ResourceDataType type,
|
| + int64_t started_count,
|
| + int64_t completed_count) {
|
| + if (type == ResourceDataType::IMAGE) {
|
| + images_started_ = started_count;
|
| + images_completed_ = completed_count;
|
| + }
|
| +}
|
| +
|
| +// Returns the most recently seen counts for a specific resource type.
|
| +// TODO(petewil): Today this just supports images, later support all types.
|
| +void ResourceTrackerObserverStub::GetResourcePercentageCounts(
|
| + const ResourceDataType type,
|
| + int64_t* started,
|
| + int64_t* completed) {
|
| + if (type == ResourceDataType::IMAGE) {
|
| + if (started)
|
| + *started = images_started_;
|
| + if (completed)
|
| + *completed = images_completed_;
|
| + }
|
| +}
|
| +
|
| +} // namespace offline_pages
|
|
|