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