Home | History | Annotate | Download | only in tools
      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
      3 // found in the LICENSE file.
      4 
      5 #include "sync/tools/null_invalidation_state_tracker.h"
      6 
      7 #include "base/base64.h"
      8 #include "base/bind.h"
      9 #include "base/callback.h"
     10 #include "base/location.h"
     11 #include "base/logging.h"
     12 #include "base/task_runner.h"
     13 #include "sync/notifier/invalidation_util.h"
     14 
     15 namespace syncer {
     16 
     17 NullInvalidationStateTracker::NullInvalidationStateTracker() {}
     18 NullInvalidationStateTracker::~NullInvalidationStateTracker() {}
     19 
     20 void NullInvalidationStateTracker::ClearAndSetNewClientId(
     21     const std::string& data) {
     22   LOG(INFO) << "Setting invalidator client ID to: " << data;
     23 }
     24 
     25 std::string NullInvalidationStateTracker::GetInvalidatorClientId() const {
     26   // The caller of this function is probably looking for an ID it can use to
     27   // identify this client as the originator of some notifiable change.  It does
     28   // this so the invalidation server can prevent it from being notified of its
     29   // own changes.  This invalidation state tracker doesn't remember its ID, so
     30   // it can't support this feature.
     31   NOTREACHED() << "This state tracker does not support reflection-blocking";
     32   return std::string();
     33 }
     34 
     35 std::string NullInvalidationStateTracker::GetBootstrapData() const {
     36   return std::string();
     37 }
     38 
     39 void NullInvalidationStateTracker::SetBootstrapData(const std::string& data) {
     40   std::string base64_data;
     41   base::Base64Encode(data, &base64_data);
     42   LOG(INFO) << "Setting bootstrap data to: " << base64_data;
     43 }
     44 
     45 void NullInvalidationStateTracker::Clear() {
     46   // We have no members to clear.
     47 }
     48 
     49 void NullInvalidationStateTracker::SetSavedInvalidations(
     50     const UnackedInvalidationsMap& states) {
     51   // Do nothing.
     52 }
     53 
     54 UnackedInvalidationsMap
     55 NullInvalidationStateTracker::GetSavedInvalidations() const {
     56   return UnackedInvalidationsMap();
     57 }
     58 
     59 }  // namespace syncer
     60