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