| OLD | NEW |
| (Empty) |
| 1 // Copyright 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 #ifndef COMPONENTS_SYNC_CORE_IMPL_JS_SYNC_ENCRYPTION_HANDLER_OBSERVER_H_ | |
| 6 #define COMPONENTS_SYNC_CORE_IMPL_JS_SYNC_ENCRYPTION_HANDLER_OBSERVER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/compiler_specific.h" | |
| 11 #include "base/macros.h" | |
| 12 #include "components/sync/base/weak_handle.h" | |
| 13 #include "components/sync/core/sync_encryption_handler.h" | |
| 14 #include "components/sync/protocol/sync_protocol_error.h" | |
| 15 | |
| 16 namespace tracked_objects { | |
| 17 class Location; | |
| 18 } // namespace tracked_objects | |
| 19 | |
| 20 namespace syncer { | |
| 21 | |
| 22 class JsEventDetails; | |
| 23 class JsEventHandler; | |
| 24 | |
| 25 // Routes SyncEncryptionHandler events to a JsEventHandler. | |
| 26 class JsSyncEncryptionHandlerObserver : public SyncEncryptionHandler::Observer { | |
| 27 public: | |
| 28 JsSyncEncryptionHandlerObserver(); | |
| 29 ~JsSyncEncryptionHandlerObserver() override; | |
| 30 | |
| 31 void SetJsEventHandler(const WeakHandle<JsEventHandler>& event_handler); | |
| 32 | |
| 33 // SyncEncryptionHandlerObserver::Observer implementation. | |
| 34 void OnPassphraseRequired( | |
| 35 PassphraseRequiredReason reason, | |
| 36 const sync_pb::EncryptedData& pending_keys) override; | |
| 37 void OnPassphraseAccepted() override; | |
| 38 void OnBootstrapTokenUpdated(const std::string& bootstrap_token, | |
| 39 BootstrapTokenType type) override; | |
| 40 void OnEncryptedTypesChanged(ModelTypeSet encrypted_types, | |
| 41 bool encrypt_everything) override; | |
| 42 void OnEncryptionComplete() override; | |
| 43 void OnCryptographerStateChanged(Cryptographer* cryptographer) override; | |
| 44 void OnPassphraseTypeChanged(PassphraseType type, | |
| 45 base::Time explicit_passphrase_time) override; | |
| 46 void OnLocalSetPassphraseEncryption( | |
| 47 const SyncEncryptionHandler::NigoriState& nigori_state) override; | |
| 48 | |
| 49 private: | |
| 50 void HandleJsEvent(const tracked_objects::Location& from_here, | |
| 51 const std::string& name, | |
| 52 const JsEventDetails& details); | |
| 53 | |
| 54 WeakHandle<JsEventHandler> event_handler_; | |
| 55 | |
| 56 DISALLOW_COPY_AND_ASSIGN(JsSyncEncryptionHandlerObserver); | |
| 57 }; | |
| 58 | |
| 59 } // namespace syncer | |
| 60 | |
| 61 #endif // COMPONENTS_SYNC_CORE_IMPL_JS_SYNC_ENCRYPTION_HANDLER_OBSERVER_H_ | |
| OLD | NEW |