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.
5 #include "sync/notifier/invalidator_state.h"
7 #include "base/logging.h"
11 const char* InvalidatorStateToString(InvalidatorState state
) {
13 case TRANSIENT_INVALIDATION_ERROR
:
14 return "TRANSIENT_INVALIDATION_ERROR";
15 case INVALIDATION_CREDENTIALS_REJECTED
:
16 return "INVALIDATION_CREDENTIALS_REJECTED";
17 case INVALIDATIONS_ENABLED
:
18 return "INVALIDATIONS_ENABLED";
21 return "UNKNOWN_INVALIDATOR_STATE";
25 InvalidatorState
FromNotifierReason(
26 notifier::NotificationsDisabledReason reason
) {
28 case notifier::NO_NOTIFICATION_ERROR
:
29 return INVALIDATIONS_ENABLED
;
30 case notifier::TRANSIENT_NOTIFICATION_ERROR
:
31 return TRANSIENT_INVALIDATION_ERROR
;
32 case notifier::NOTIFICATION_CREDENTIALS_REJECTED
:
33 return INVALIDATION_CREDENTIALS_REJECTED
;
36 return DEFAULT_INVALIDATION_ERROR
;
40 notifier::NotificationsDisabledReason
ToNotifierReasonForTest(
41 InvalidatorState state
) {
43 case TRANSIENT_INVALIDATION_ERROR
:
44 return notifier::TRANSIENT_NOTIFICATION_ERROR
;
45 case INVALIDATION_CREDENTIALS_REJECTED
:
46 return notifier::NOTIFICATION_CREDENTIALS_REJECTED
;
47 case INVALIDATIONS_ENABLED
:
51 return notifier::TRANSIENT_NOTIFICATION_ERROR
;