Chromium Code Reviews| 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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 424 UpdateCommandState(); | 424 UpdateCommandState(); |
| 425 } | 425 } |
| 426 | 426 |
| 427 void ChromeToMobileService::OnIncomingInvalidation( | 427 void ChromeToMobileService::OnIncomingInvalidation( |
| 428 const syncer::ObjectIdInvalidationMap& invalidation_map, | 428 const syncer::ObjectIdInvalidationMap& invalidation_map, |
| 429 syncer::IncomingInvalidationSource source) { | 429 syncer::IncomingInvalidationSource source) { |
| 430 DCHECK_EQ(1U, invalidation_map.size()); | 430 DCHECK_EQ(1U, invalidation_map.size()); |
| 431 DCHECK_EQ(1U, invalidation_map.count(invalidation::ObjectId( | 431 DCHECK_EQ(1U, invalidation_map.count(invalidation::ObjectId( |
| 432 ipc::invalidation::ObjectSource::CHROME_COMPONENTS, | 432 ipc::invalidation::ObjectSource::CHROME_COMPONENTS, |
| 433 kSyncInvalidationObjectIdChromeToMobileDeviceList))); | 433 kSyncInvalidationObjectIdChromeToMobileDeviceList))); |
| 434 // TODO(msw): Unit tests do not provide profiles; see http://crbug.com/122183 | |
|
akalin
2012/10/19 13:27:16
I think it should be acked only when the device se
dcheng
2012/10/19 19:38:11
Done. Added a TODO and filed a crbug.
| |
| 435 ProfileSyncService* profile_sync_service = | |
| 436 profile_ ? ProfileSyncServiceFactory::GetForProfile(profile_) : NULL; | |
| 437 if (profile_sync_service) { | |
| 438 profile_sync_service->AcknowledgeInvalidation( | |
| 439 invalidation_map.begin()->first, | |
| 440 invalidation_map.begin()->second.ack_handle); | |
| 441 } | |
| 434 RequestDeviceSearch(); | 442 RequestDeviceSearch(); |
| 435 } | 443 } |
| 436 | 444 |
| 437 const std::string& ChromeToMobileService::GetAccessTokenForTest() const { | 445 const std::string& ChromeToMobileService::GetAccessTokenForTest() const { |
| 438 return access_token_; | 446 return access_token_; |
| 439 } | 447 } |
| 440 | 448 |
| 441 void ChromeToMobileService::SetAccessTokenForTest( | 449 void ChromeToMobileService::SetAccessTokenForTest( |
| 442 const std::string& access_token) { | 450 const std::string& access_token) { |
| 443 access_token_ = access_token; | 451 access_token_ = access_token; |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 701 | 709 |
| 702 // Report failure below and ignore the second response. | 710 // Report failure below and ignore the second response. |
| 703 request_observer_map_.erase(other); | 711 request_observer_map_.erase(other); |
| 704 break; | 712 break; |
| 705 } | 713 } |
| 706 } | 714 } |
| 707 | 715 |
| 708 if (observer.get()) | 716 if (observer.get()) |
| 709 observer->OnSendComplete(success); | 717 observer->OnSendComplete(success); |
| 710 } | 718 } |
| OLD | NEW |