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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 UpdateCommandState(); | 402 UpdateCommandState(); |
403 } | 403 } |
404 | 404 |
405 void ChromeToMobileService::OnIncomingInvalidation( | 405 void ChromeToMobileService::OnIncomingInvalidation( |
406 const syncer::ObjectIdStateMap& id_state_map, | 406 const syncer::ObjectIdStateMap& id_state_map, |
407 syncer::IncomingInvalidationSource source) { | 407 syncer::IncomingInvalidationSource source) { |
408 DCHECK_EQ(1U, id_state_map.size()); | 408 DCHECK_EQ(1U, id_state_map.size()); |
409 DCHECK_EQ(1U, id_state_map.count(invalidation::ObjectId( | 409 DCHECK_EQ(1U, id_state_map.count(invalidation::ObjectId( |
410 ipc::invalidation::ObjectSource::CHROME_COMPONENTS, | 410 ipc::invalidation::ObjectSource::CHROME_COMPONENTS, |
411 kSyncInvalidationObjectIdChromeToMobileDeviceList))); | 411 kSyncInvalidationObjectIdChromeToMobileDeviceList))); |
| 412 // TODO(msw): Unit tests do not provide profiles; see http://crbug.com/122183 |
| 413 ProfileSyncService* profile_sync_service = |
| 414 profile_ ? ProfileSyncServiceFactory::GetForProfile(profile_) : NULL; |
| 415 if (profile_sync_service) { |
| 416 profile_sync_service->AcknowledgeInvalidation( |
| 417 id_state_map.begin()->first, id_state_map.begin()->second.ack_handle); |
| 418 } |
412 RequestDeviceSearch(); | 419 RequestDeviceSearch(); |
413 } | 420 } |
414 | 421 |
415 const std::string& ChromeToMobileService::GetAccessTokenForTest() const { | 422 const std::string& ChromeToMobileService::GetAccessTokenForTest() const { |
416 return access_token_; | 423 return access_token_; |
417 } | 424 } |
418 | 425 |
419 void ChromeToMobileService::SetAccessTokenForTest( | 426 void ChromeToMobileService::SetAccessTokenForTest( |
420 const std::string& access_token) { | 427 const std::string& access_token) { |
421 access_token_ = access_token; | 428 access_token_ = access_token; |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 | 673 |
667 // Report failure below and ignore the second response. | 674 // Report failure below and ignore the second response. |
668 request_observer_map_.erase(other); | 675 request_observer_map_.erase(other); |
669 break; | 676 break; |
670 } | 677 } |
671 } | 678 } |
672 | 679 |
673 if (observer.get()) | 680 if (observer.get()) |
674 observer->OnSendComplete(success); | 681 observer->OnSendComplete(success); |
675 } | 682 } |
OLD | NEW |