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

Side by Side Diff: content/browser/background_sync/background_sync_registration.h

Issue 1282013004: BackgroundSyncManager tracks client registrations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clean up Created 5 years, 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_REGISTRATION_H_ 5 #ifndef CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_REGISTRATION_H_
6 #define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_REGISTRATION_H_ 6 #define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_REGISTRATION_H_
7 7
8 #include "base/macros.h"
8 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
9 #include "content/browser/background_sync/background_sync.pb.h" 10 #include "content/browser/background_sync/background_sync.pb.h"
10 #include "content/browser/background_sync/background_sync_registration_options.h " 11 #include "content/browser/background_sync/background_sync_registration_options.h "
11 #include "content/common/background_sync_service.mojom.h" 12 #include "content/common/background_sync_service.mojom.h"
12 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
13 #include "third_party/mojo/src/mojo/public/cpp/bindings/type_converter.h" 14 #include "third_party/mojo/src/mojo/public/cpp/bindings/type_converter.h"
14 15
15 namespace content { 16 namespace content {
16 17
17 class CONTENT_EXPORT BackgroundSyncRegistration { 18 class CONTENT_EXPORT BackgroundSyncRegistration {
18 public: 19 public:
19 using RegistrationId = int64_t; 20 using RegistrationId = int64_t;
20 static const RegistrationId kInitialId; 21 static const RegistrationId kInitialId;
21 22
22 BackgroundSyncRegistration(); 23 BackgroundSyncRegistration();
24 virtual ~BackgroundSyncRegistration();
michaeln 2015/08/21 02:39:24 This class doesn't have any derivatives anymore, s
jkarlin 2015/08/25 17:32:58 Done.
25
23 bool Equals(const BackgroundSyncRegistration& other) const; 26 bool Equals(const BackgroundSyncRegistration& other) const;
24 bool IsValid() const; 27 bool IsValid() const;
25 28
26 const BackgroundSyncRegistrationOptions* options() const { return &options_; } 29 const BackgroundSyncRegistrationOptions* options() const { return &options_; }
27 BackgroundSyncRegistrationOptions* options() { return &options_; } 30 BackgroundSyncRegistrationOptions* options() { return &options_; }
28 31
29 RegistrationId id() const { return id_; } 32 RegistrationId id() const { return id_; }
30 void set_id(RegistrationId id) { id_ = id; } 33 void set_id(RegistrationId id) { id_ = id; }
31 34
32 SyncState sync_state() const { return sync_state_; } 35 SyncState sync_state() const { return sync_state_; }
33 void set_sync_state(SyncState state) { sync_state_ = state; } 36 void set_sync_state(SyncState state) { sync_state_ = state; }
34 37
35 private: 38 private:
36 static const RegistrationId kInvalidRegistrationId; 39 static const RegistrationId kInvalidRegistrationId;
37 40
38 BackgroundSyncRegistrationOptions options_; 41 BackgroundSyncRegistrationOptions options_;
39 RegistrationId id_ = kInvalidRegistrationId; 42 RegistrationId id_ = kInvalidRegistrationId;
40 SyncState sync_state_ = SYNC_STATE_PENDING; 43 SyncState sync_state_ = SYNC_STATE_PENDING;
44
45 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncRegistration);
41 }; 46 };
42 47
43 } // namespace content 48 } // namespace content
44 49
45 namespace mojo { 50 namespace mojo {
46 51
47 template <> 52 template <>
48 struct CONTENT_EXPORT 53 struct CONTENT_EXPORT
49 TypeConverter<scoped_ptr<content::BackgroundSyncRegistration>, 54 TypeConverter<scoped_ptr<content::BackgroundSyncRegistration>,
50 content::SyncRegistrationPtr> { 55 content::SyncRegistrationPtr> {
51 static scoped_ptr<content::BackgroundSyncRegistration> Convert( 56 static scoped_ptr<content::BackgroundSyncRegistration> Convert(
52 const content::SyncRegistrationPtr& input); 57 const content::SyncRegistrationPtr& input);
53 }; 58 };
54 59
55 template <> 60 template <>
56 struct CONTENT_EXPORT TypeConverter<content::SyncRegistrationPtr, 61 struct CONTENT_EXPORT TypeConverter<content::SyncRegistrationPtr,
57 content::BackgroundSyncRegistration> { 62 content::BackgroundSyncRegistration> {
58 static content::SyncRegistrationPtr Convert( 63 static content::SyncRegistrationPtr Convert(
59 const content::BackgroundSyncRegistration& input); 64 const content::BackgroundSyncRegistration& input);
60 }; 65 };
61 66
62 } // namespace 67 } // namespace
63 68
64 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_REGISTRATION_H_ 69 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_REGISTRATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698