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

Side by Side Diff: chrome/browser/services/gcm/push_messaging_application_id.h

Issue 930083002: Unregister with push service and SW database when permission is lost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 10 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
« no previous file with comments | « no previous file | chrome/browser/services/gcm/push_messaging_application_id.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_APPLICATION_ID_H_ 5 #ifndef CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_APPLICATION_ID_H_
6 #define CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_APPLICATION_ID_H_ 6 #define CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_APPLICATION_ID_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector>
9 10
10 #include "base/basictypes.h" 11 #include "base/basictypes.h"
11 #include "url/gurl.h" 12 #include "url/gurl.h"
12 13
13 class Profile; 14 class Profile;
14 15
15 namespace user_prefs { 16 namespace user_prefs {
16 class PrefRegistrySyncable; 17 class PrefRegistrySyncable;
17 } 18 }
18 19
(...skipping 18 matching lines...) Expand all
37 // Looks up an application id by app_id_guid. Will be invalid if not found. 38 // Looks up an application id by app_id_guid. Will be invalid if not found.
38 static PushMessagingApplicationId Get(Profile* profile, 39 static PushMessagingApplicationId Get(Profile* profile,
39 const std::string& app_id_guid); 40 const std::string& app_id_guid);
40 41
41 // Looks up an application id by origin & service worker registration id. 42 // Looks up an application id by origin & service worker registration id.
42 // Will be invalid if not found. 43 // Will be invalid if not found.
43 static PushMessagingApplicationId Get(Profile* profile, 44 static PushMessagingApplicationId Get(Profile* profile,
44 const GURL& origin, 45 const GURL& origin,
45 int64 service_worker_registration_id); 46 int64 service_worker_registration_id);
46 47
48 // Returns all the PushMessagingApplicationId currently registered for the
49 // given |profile|.
50 static std::vector<PushMessagingApplicationId> GetAll(Profile* profile);
51
47 ~PushMessagingApplicationId(); 52 ~PushMessagingApplicationId();
48 53
49 // Persist this application id to disk. 54 // Persist this application id to disk.
50 void PersistToDisk(Profile* profile) const; 55 void PersistToDisk(Profile* profile) const;
51 56
52 // Delete this application id from disk. 57 // Delete this application id from disk.
53 void DeleteFromDisk(Profile* profile) const; // TODO: Does const make sense? 58 void DeleteFromDisk(Profile* profile) const; // TODO: Does const make sense?
54 59
55 bool IsValid() const; 60 bool IsValid() const;
56 61
57 const std::string& app_id_guid() const { return app_id_guid_; } 62 const std::string& app_id_guid() const { return app_id_guid_; }
58 const GURL& origin() const { return origin_; } 63 const GURL& origin() const { return origin_; }
59 int64 service_worker_registration_id() const { 64 int64 service_worker_registration_id() const {
60 return service_worker_registration_id_; 65 return service_worker_registration_id_;
61 } 66 }
62 67
63 private: 68 private:
64 friend class PushMessagingApplicationIdTest; 69 friend class PushMessagingApplicationIdTest;
65 70
66 // Constructs an invalid app id. 71 // Constructs an invalid app id.
67 PushMessagingApplicationId(); 72 PushMessagingApplicationId();
68 // Constructs a valid app id. 73 // Constructs a valid app id.
69 PushMessagingApplicationId(const std::string& app_id_guid, 74 PushMessagingApplicationId(const std::string& app_id_guid,
70 const GURL& origin, 75 const GURL& origin,
71 int64 service_worker_registration_id); 76 int64 service_worker_registration_id);
72 77
73 const std::string app_id_guid_; 78 std::string app_id_guid_;
74 const GURL origin_; 79 GURL origin_;
75 const int64 service_worker_registration_id_; 80 int64 service_worker_registration_id_;
76 }; 81 };
77 82
78 } // namespace gcm 83 } // namespace gcm
79 84
80 #endif // CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_APPLICATION_ID_H_ 85 #endif // CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_APPLICATION_ID_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/services/gcm/push_messaging_application_id.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698