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

Side by Side Diff: third_party/WebKit/Source/modules/background_fetch/BackgroundFetchRegistration.cpp

Issue 2762573003: Implement BackgroundFetchManager.fetch() and struct traits (Closed)
Patch Set: Add a missing file Created 3 years, 9 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 2017 The Chromium Authors. All rights reserved. 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 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 "modules/background_fetch/BackgroundFetchRegistration.h" 5 #include "modules/background_fetch/BackgroundFetchRegistration.h"
6 6
7 #include "modules/background_fetch/BackgroundFetchBridge.h" 7 #include "modules/background_fetch/BackgroundFetchBridge.h"
8 #include "modules/background_fetch/IconDefinition.h" 8 #include "modules/background_fetch/IconDefinition.h"
9 #include "modules/serviceworkers/ServiceWorkerRegistration.h" 9 #include "modules/serviceworkers/ServiceWorkerRegistration.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 BackgroundFetchRegistration::BackgroundFetchRegistration( 13 BackgroundFetchRegistration::BackgroundFetchRegistration(
14 ServiceWorkerRegistration* registration,
15 String tag, 14 String tag,
16 HeapVector<IconDefinition> icons, 15 HeapVector<IconDefinition> icons,
17 long long totalDownloadSize, 16 long long totalDownloadSize,
18 String title) 17 String title)
19 : m_registration(registration), 18 : m_tag(tag),
20 m_tag(tag),
21 m_icons(icons), 19 m_icons(icons),
22 m_totalDownloadSize(totalDownloadSize), 20 m_totalDownloadSize(totalDownloadSize),
23 m_title(title) {} 21 m_title(title) {}
24 22
25 BackgroundFetchRegistration::~BackgroundFetchRegistration() = default; 23 BackgroundFetchRegistration::~BackgroundFetchRegistration() = default;
26 24
25 void BackgroundFetchRegistration::setServiceWorkerRegistration(
26 ServiceWorkerRegistration* registration) {
27 m_registration = registration;
28 }
29
27 String BackgroundFetchRegistration::tag() const { 30 String BackgroundFetchRegistration::tag() const {
28 return m_tag; 31 return m_tag;
29 } 32 }
30 33
31 HeapVector<IconDefinition> BackgroundFetchRegistration::icons() const { 34 HeapVector<IconDefinition> BackgroundFetchRegistration::icons() const {
32 return m_icons; 35 return m_icons;
33 } 36 }
34 37
35 long long BackgroundFetchRegistration::totalDownloadSize() const { 38 long long BackgroundFetchRegistration::totalDownloadSize() const {
36 return m_totalDownloadSize; 39 return m_totalDownloadSize;
37 } 40 }
38 41
39 String BackgroundFetchRegistration::title() const { 42 String BackgroundFetchRegistration::title() const {
40 return m_title; 43 return m_title;
41 } 44 }
42 45
43 void BackgroundFetchRegistration::abort() { 46 void BackgroundFetchRegistration::abort() {
47 DCHECK(m_registration);
44 BackgroundFetchBridge::from(m_registration)->abort(m_tag); 48 BackgroundFetchBridge::from(m_registration)->abort(m_tag);
45 } 49 }
46 50
47 DEFINE_TRACE(BackgroundFetchRegistration) { 51 DEFINE_TRACE(BackgroundFetchRegistration) {
48 visitor->trace(m_registration); 52 visitor->trace(m_registration);
49 visitor->trace(m_icons); 53 visitor->trace(m_icons);
50 } 54 }
51 55
52 } // namespace blink 56 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698