| 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 "sync/internal_api/js_sync_encryption_handler_observer.h" | 5 #include "sync/internal_api/js_sync_encryption_handler_observer.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 DictionaryValue details; | 90 DictionaryValue details; |
| 91 details.SetBoolean("ready", | 91 details.SetBoolean("ready", |
| 92 cryptographer->is_ready()); | 92 cryptographer->is_ready()); |
| 93 details.SetBoolean("hasPendingKeys", | 93 details.SetBoolean("hasPendingKeys", |
| 94 cryptographer->has_pending_keys()); | 94 cryptographer->has_pending_keys()); |
| 95 HandleJsEvent(FROM_HERE, | 95 HandleJsEvent(FROM_HERE, |
| 96 "onCryptographerStateChanged", | 96 "onCryptographerStateChanged", |
| 97 JsEventDetails(&details)); | 97 JsEventDetails(&details)); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void JsSyncEncryptionHandlerObserver::OnPassphraseStateChanged( | 100 void JsSyncEncryptionHandlerObserver::OnPassphraseTypeChanged( |
| 101 PassphraseState state) { | 101 PassphraseType type) { |
| 102 if (!event_handler_.IsInitialized()) { | 102 if (!event_handler_.IsInitialized()) { |
| 103 return; | 103 return; |
| 104 } | 104 } |
| 105 DictionaryValue details; | 105 DictionaryValue details; |
| 106 details.SetString("passphraseState", | 106 details.SetString("passphraseType", |
| 107 PassphraseStateToString(state)); | 107 PassphraseTypeToString(type)); |
| 108 HandleJsEvent(FROM_HERE, | 108 HandleJsEvent(FROM_HERE, |
| 109 "onPassphraseStateChanged", | 109 "onPassphraseTypeChanged", |
| 110 JsEventDetails(&details)); | 110 JsEventDetails(&details)); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void JsSyncEncryptionHandlerObserver::HandleJsEvent( | 113 void JsSyncEncryptionHandlerObserver::HandleJsEvent( |
| 114 const tracked_objects::Location& from_here, | 114 const tracked_objects::Location& from_here, |
| 115 const std::string& name, const JsEventDetails& details) { | 115 const std::string& name, const JsEventDetails& details) { |
| 116 if (!event_handler_.IsInitialized()) { | 116 if (!event_handler_.IsInitialized()) { |
| 117 NOTREACHED(); | 117 NOTREACHED(); |
| 118 return; | 118 return; |
| 119 } | 119 } |
| 120 event_handler_.Call(from_here, | 120 event_handler_.Call(from_here, |
| 121 &JsEventHandler::HandleJsEvent, name, details); | 121 &JsEventHandler::HandleJsEvent, name, details); |
| 122 } | 122 } |
| 123 | 123 |
| 124 } // namespace syncer | 124 } // namespace syncer |
| OLD | NEW |