| 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/chrome_to_mobile_service.h" | 5 #include "chrome/browser/chrome_to_mobile_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/guid.h" | 10 #include "base/guid.h" |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 UpdateCommandState(); | 369 UpdateCommandState(); |
| 370 } | 370 } |
| 371 | 371 |
| 372 void ChromeToMobileService::OnNotificationsDisabled( | 372 void ChromeToMobileService::OnNotificationsDisabled( |
| 373 syncer::NotificationsDisabledReason reason) { | 373 syncer::NotificationsDisabledReason reason) { |
| 374 sync_invalidation_enabled_ = false; | 374 sync_invalidation_enabled_ = false; |
| 375 UpdateCommandState(); | 375 UpdateCommandState(); |
| 376 } | 376 } |
| 377 | 377 |
| 378 void ChromeToMobileService::OnIncomingNotification( | 378 void ChromeToMobileService::OnIncomingNotification( |
| 379 const syncer::ObjectIdPayloadMap& id_payloads, | 379 const syncer::ObjectIdStateMap& id_state_map, |
| 380 syncer::IncomingNotificationSource source) { | 380 syncer::IncomingNotificationSource source) { |
| 381 DCHECK_EQ(id_payloads.size(), 1U); | 381 DCHECK_EQ(1U, id_state_map.size()); |
| 382 DCHECK_EQ(id_payloads.count(invalidation::ObjectId( | 382 DCHECK_EQ(1U, id_state_map.count(invalidation::ObjectId( |
| 383 ipc::invalidation::ObjectSource::CHROME_COMPONENTS, | 383 ipc::invalidation::ObjectSource::CHROME_COMPONENTS, |
| 384 kSyncInvalidationObjectIdChromeToMobileDeviceList)), 1U); | 384 kSyncInvalidationObjectIdChromeToMobileDeviceList))); |
| 385 RequestDeviceSearch(); | 385 RequestDeviceSearch(); |
| 386 } | 386 } |
| 387 | 387 |
| 388 const std::string& ChromeToMobileService::GetAccessTokenForTest() const { | 388 const std::string& ChromeToMobileService::GetAccessTokenForTest() const { |
| 389 return access_token_; | 389 return access_token_; |
| 390 } | 390 } |
| 391 | 391 |
| 392 void ChromeToMobileService::SetAccessTokenForTest( | 392 void ChromeToMobileService::SetAccessTokenForTest( |
| 393 const std::string& access_token) { | 393 const std::string& access_token) { |
| 394 access_token_ = access_token; | 394 access_token_ = access_token; |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 | 599 |
| 600 // Ensure a second response is not sent after reporting failure below. | 600 // Ensure a second response is not sent after reporting failure below. |
| 601 request_observer_map_.erase(other); | 601 request_observer_map_.erase(other); |
| 602 break; | 602 break; |
| 603 } | 603 } |
| 604 } | 604 } |
| 605 | 605 |
| 606 LogMetric(success ? SEND_SUCCESS : SEND_ERROR); | 606 LogMetric(success ? SEND_SUCCESS : SEND_ERROR); |
| 607 observer->OnSendComplete(success); | 607 observer->OnSendComplete(success); |
| 608 } | 608 } |
| OLD | NEW |