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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 syncer::InvalidatorState state) { | 472 syncer::InvalidatorState state) { |
473 sync_invalidation_enabled_ = (state == syncer::INVALIDATIONS_ENABLED); | 473 sync_invalidation_enabled_ = (state == syncer::INVALIDATIONS_ENABLED); |
474 } | 474 } |
475 | 475 |
476 void ChromeToMobileService::OnIncomingInvalidation( | 476 void ChromeToMobileService::OnIncomingInvalidation( |
477 const syncer::ObjectIdInvalidationMap& invalidation_map) { | 477 const syncer::ObjectIdInvalidationMap& invalidation_map) { |
478 DCHECK_EQ(1U, invalidation_map.size()); | 478 DCHECK_EQ(1U, invalidation_map.size()); |
479 DCHECK_EQ(1U, invalidation_map.count(invalidation::ObjectId( | 479 DCHECK_EQ(1U, invalidation_map.count(invalidation::ObjectId( |
480 ipc::invalidation::ObjectSource::CHROME_COMPONENTS, | 480 ipc::invalidation::ObjectSource::CHROME_COMPONENTS, |
481 kSyncInvalidationObjectIdChromeToMobileDeviceList))); | 481 kSyncInvalidationObjectIdChromeToMobileDeviceList))); |
| 482 // TODO(msw): Unit tests do not provide profiles; see http://crbug.com/122183 |
| 483 ProfileSyncService* profile_sync_service = |
| 484 profile_ ? ProfileSyncServiceFactory::GetForProfile(profile_) : NULL; |
| 485 if (profile_sync_service) { |
| 486 // TODO(dcheng): Only acknowledge the invalidation once the device search |
| 487 // has finished. http://crbug.com/156843. |
| 488 profile_sync_service->AcknowledgeInvalidation( |
| 489 invalidation_map.begin()->first, |
| 490 invalidation_map.begin()->second.ack_handle); |
| 491 } |
482 RequestDeviceSearch(); | 492 RequestDeviceSearch(); |
483 } | 493 } |
484 | 494 |
485 const std::string& ChromeToMobileService::GetAccessTokenForTest() const { | 495 const std::string& ChromeToMobileService::GetAccessTokenForTest() const { |
486 return access_token_; | 496 return access_token_; |
487 } | 497 } |
488 | 498 |
489 void ChromeToMobileService::SetAccessTokenForTest( | 499 void ChromeToMobileService::SetAccessTokenForTest( |
490 const std::string& access_token) { | 500 const std::string& access_token) { |
491 access_token_ = access_token; | 501 access_token_ = access_token; |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 | 752 |
743 // Report failure below and ignore the second response. | 753 // Report failure below and ignore the second response. |
744 request_observer_map_.erase(other); | 754 request_observer_map_.erase(other); |
745 break; | 755 break; |
746 } | 756 } |
747 } | 757 } |
748 | 758 |
749 if (observer.get()) | 759 if (observer.get()) |
750 observer->OnSendComplete(success); | 760 observer->OnSendComplete(success); |
751 } | 761 } |
OLD | NEW |