OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/drive/drive_notification_manager.h" | 5 #include "chrome/browser/drive/drive_notification_manager.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "chrome/browser/drive/drive_notification_observer.h" | 8 #include "chrome/browser/drive/drive_notification_observer.h" |
9 #include "components/invalidation/invalidation_service.h" | 9 #include "components/invalidation/invalidation_service.h" |
10 #include "components/invalidation/object_id_invalidation_map.h" | 10 #include "components/invalidation/object_id_invalidation_map.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 DCHECK(!push_notification_enabled_); | 128 DCHECK(!push_notification_enabled_); |
129 | 129 |
130 if (!invalidation_service_) | 130 if (!invalidation_service_) |
131 return; | 131 return; |
132 | 132 |
133 invalidation_service_->RegisterInvalidationHandler(this); | 133 invalidation_service_->RegisterInvalidationHandler(this); |
134 syncer::ObjectIdSet ids; | 134 syncer::ObjectIdSet ids; |
135 ids.insert(invalidation::ObjectId( | 135 ids.insert(invalidation::ObjectId( |
136 ipc::invalidation::ObjectSource::COSMO_CHANGELOG, | 136 ipc::invalidation::ObjectSource::COSMO_CHANGELOG, |
137 kDriveInvalidationObjectId)); | 137 kDriveInvalidationObjectId)); |
138 invalidation_service_->UpdateRegisteredInvalidationIds(this, ids); | 138 CHECK(invalidation_service_->UpdateRegisteredInvalidationIds(this, ids)); |
139 push_notification_registered_ = true; | 139 push_notification_registered_ = true; |
140 OnInvalidatorStateChange(invalidation_service_->GetInvalidatorState()); | 140 OnInvalidatorStateChange(invalidation_service_->GetInvalidatorState()); |
141 | 141 |
142 UMA_HISTOGRAM_BOOLEAN("Drive.PushNotificationRegistered", | 142 UMA_HISTOGRAM_BOOLEAN("Drive.PushNotificationRegistered", |
143 push_notification_registered_); | 143 push_notification_registered_); |
144 } | 144 } |
145 | 145 |
146 // static | 146 // static |
147 std::string DriveNotificationManager::NotificationSourceToString( | 147 std::string DriveNotificationManager::NotificationSourceToString( |
148 NotificationSource source) { | 148 NotificationSource source) { |
149 switch (source) { | 149 switch (source) { |
150 case NOTIFICATION_XMPP: | 150 case NOTIFICATION_XMPP: |
151 return "NOTIFICATION_XMPP"; | 151 return "NOTIFICATION_XMPP"; |
152 case NOTIFICATION_POLLING: | 152 case NOTIFICATION_POLLING: |
153 return "NOTIFICATION_POLLING"; | 153 return "NOTIFICATION_POLLING"; |
154 } | 154 } |
155 | 155 |
156 NOTREACHED(); | 156 NOTREACHED(); |
157 return ""; | 157 return ""; |
158 } | 158 } |
159 | 159 |
160 } // namespace drive | 160 } // namespace drive |
OLD | NEW |