OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/extensions/api/push_messaging/push_messaging_invalidati
on_handler.h" | 5 #include "chrome/browser/extensions/api/push_messaging/push_messaging_invalidati
on_handler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
11 #include "base/strings/string_split.h" | 11 #include "base/strings/string_split.h" |
12 #include "chrome/browser/extensions/api/push_messaging/push_messaging_invalidati
on_handler_delegate.h" | 12 #include "chrome/browser/extensions/api/push_messaging/push_messaging_invalidati
on_handler_delegate.h" |
13 #include "chrome/browser/invalidation/invalidation_frontend.h" | 13 #include "chrome/browser/invalidation/invalidation_service.h" |
14 #include "chrome/common/extensions/extension.h" | 14 #include "chrome/common/extensions/extension.h" |
15 #include "google/cacheinvalidation/types.pb.h" | 15 #include "google/cacheinvalidation/types.pb.h" |
16 | 16 |
17 namespace extensions { | 17 namespace extensions { |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 const int kNumberOfSubchannels = 4; | 21 const int kNumberOfSubchannels = 4; |
22 | 22 |
23 // Chrome push messaging object IDs currently have the following format: | 23 // Chrome push messaging object IDs currently have the following format: |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 if (*subchannel < 0 || *subchannel >= kNumberOfSubchannels) { | 71 if (*subchannel < 0 || *subchannel >= kNumberOfSubchannels) { |
72 DLOG(WARNING) << "Subchannel out of range from object name " << name; | 72 DLOG(WARNING) << "Subchannel out of range from object name " << name; |
73 return false; | 73 return false; |
74 } | 74 } |
75 return true; | 75 return true; |
76 } | 76 } |
77 | 77 |
78 } // namespace | 78 } // namespace |
79 | 79 |
80 PushMessagingInvalidationHandler::PushMessagingInvalidationHandler( | 80 PushMessagingInvalidationHandler::PushMessagingInvalidationHandler( |
81 invalidation::InvalidationFrontend* service, | 81 invalidation::InvalidationService* service, |
82 PushMessagingInvalidationHandlerDelegate* delegate) | 82 PushMessagingInvalidationHandlerDelegate* delegate) |
83 : service_(service), | 83 : service_(service), |
84 delegate_(delegate) { | 84 delegate_(delegate) { |
85 DCHECK(service_); | 85 DCHECK(service_); |
86 service_->RegisterInvalidationHandler(this); | 86 service_->RegisterInvalidationHandler(this); |
87 } | 87 } |
88 | 88 |
89 PushMessagingInvalidationHandler::~PushMessagingInvalidationHandler() { | 89 PushMessagingInvalidationHandler::~PushMessagingInvalidationHandler() { |
90 DCHECK(thread_checker_.CalledOnValidThread()); | 90 DCHECK(thread_checker_.CalledOnValidThread()); |
91 service_->UnregisterInvalidationHandler(this); | 91 service_->UnregisterInvalidationHandler(this); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 for (std::set<std::string>::const_iterator it = | 150 for (std::set<std::string>::const_iterator it = |
151 registered_extensions_.begin(); it != registered_extensions_.end(); | 151 registered_extensions_.begin(); it != registered_extensions_.end(); |
152 ++it) { | 152 ++it) { |
153 const syncer::ObjectIdSet& object_ids = ExtensionIdToObjectIds(*it); | 153 const syncer::ObjectIdSet& object_ids = ExtensionIdToObjectIds(*it); |
154 ids.insert(object_ids.begin(), object_ids.end()); | 154 ids.insert(object_ids.begin(), object_ids.end()); |
155 } | 155 } |
156 service_->UpdateRegisteredInvalidationIds(this, ids); | 156 service_->UpdateRegisteredInvalidationIds(this, ids); |
157 } | 157 } |
158 | 158 |
159 } // namespace extensions | 159 } // namespace extensions |
OLD | NEW |