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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 DictionaryValue details; | 88 DictionaryValue details; |
89 details.SetBoolean("ready", | 89 details.SetBoolean("ready", |
90 cryptographer->is_ready()); | 90 cryptographer->is_ready()); |
91 details.SetBoolean("hasPendingKeys", | 91 details.SetBoolean("hasPendingKeys", |
92 cryptographer->has_pending_keys()); | 92 cryptographer->has_pending_keys()); |
93 HandleJsEvent(FROM_HERE, | 93 HandleJsEvent(FROM_HERE, |
94 "onCryptographerStateChanged", | 94 "onCryptographerStateChanged", |
95 JsEventDetails(&details)); | 95 JsEventDetails(&details)); |
96 } | 96 } |
97 | 97 |
| 98 void JsSyncEncryptionHandlerObserver::OnPassphraseStateChanged( |
| 99 PassphraseState state) { |
| 100 if (!event_handler_.IsInitialized()) { |
| 101 return; |
| 102 } |
| 103 DictionaryValue details; |
| 104 details.SetString("passphraseState", |
| 105 PassphraseStateToString(state)); |
| 106 HandleJsEvent(FROM_HERE, |
| 107 "onPassphraseStateChanged", |
| 108 JsEventDetails(&details)); |
| 109 } |
| 110 |
98 void JsSyncEncryptionHandlerObserver::HandleJsEvent( | 111 void JsSyncEncryptionHandlerObserver::HandleJsEvent( |
99 const tracked_objects::Location& from_here, | 112 const tracked_objects::Location& from_here, |
100 const std::string& name, const JsEventDetails& details) { | 113 const std::string& name, const JsEventDetails& details) { |
101 if (!event_handler_.IsInitialized()) { | 114 if (!event_handler_.IsInitialized()) { |
102 NOTREACHED(); | 115 NOTREACHED(); |
103 return; | 116 return; |
104 } | 117 } |
105 event_handler_.Call(from_here, | 118 event_handler_.Call(from_here, |
106 &JsEventHandler::HandleJsEvent, name, details); | 119 &JsEventHandler::HandleJsEvent, name, details); |
107 } | 120 } |
108 | 121 |
109 } // namespace syncer | 122 } // namespace syncer |
OLD | NEW |