Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(885)

Side by Side Diff: chrome/browser/chrome_to_mobile_service.cc

Issue 10911084: Implement Invalidator::Acknowledge (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698