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

Side by Side Diff: chrome/browser/extensions/api/push_messaging/push_messaging_invalidation_handler.cc

Issue 17911005: Merge 208347 "Revert 208315 "Make use of InvalidationService"" (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1547/src/
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
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_service.h" 13 #include "chrome/browser/invalidation/invalidation_frontend.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
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::InvalidationService* service, 81 invalidation::InvalidationFrontend* 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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698