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.
5 #ifndef SYNC_INTERNAL_API_JS_SYNC_ENCRYPTION_HANDLER_OBSERVER_H_
6 #define SYNC_INTERNAL_API_JS_SYNC_ENCRYPTION_HANDLER_OBSERVER_H_
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "sync/base/sync_export.h"
13 #include "sync/internal_api/public/sync_encryption_handler.h"
14 #include "sync/internal_api/public/util/weak_handle.h"
15 #include "sync/protocol/sync_protocol_error.h"
17 namespace tracked_objects
{
19 } // namespace tracked_objects
26 // Routes SyncEncryptionHandler events to a JsEventHandler.
27 class SYNC_EXPORT_PRIVATE JsSyncEncryptionHandlerObserver
28 : public SyncEncryptionHandler::Observer
{
30 JsSyncEncryptionHandlerObserver();
31 virtual ~JsSyncEncryptionHandlerObserver();
33 void SetJsEventHandler(const WeakHandle
<JsEventHandler
>& event_handler
);
35 // SyncEncryptionHandlerObserver::Observer implementation.
36 virtual void OnPassphraseRequired(
37 PassphraseRequiredReason reason
,
38 const sync_pb::EncryptedData
& pending_keys
) OVERRIDE
;
39 virtual void OnPassphraseAccepted() OVERRIDE
;
40 virtual void OnBootstrapTokenUpdated(
41 const std::string
& bootstrap_token
,
42 BootstrapTokenType type
) OVERRIDE
;
43 virtual void OnEncryptedTypesChanged(
44 ModelTypeSet encrypted_types
,
45 bool encrypt_everything
) OVERRIDE
;
46 virtual void OnEncryptionComplete() OVERRIDE
;
47 virtual void OnCryptographerStateChanged(
48 Cryptographer
* cryptographer
) OVERRIDE
;
49 virtual void OnPassphraseTypeChanged(
51 base::Time explicit_passphrase_time
) OVERRIDE
;
54 void HandleJsEvent(const tracked_objects::Location
& from_here
,
55 const std::string
& name
, const JsEventDetails
& details
);
57 WeakHandle
<JsEventHandler
> event_handler_
;
59 DISALLOW_COPY_AND_ASSIGN(JsSyncEncryptionHandlerObserver
);
64 #endif // SYNC_INTERNAL_API_JS_SYNC_ENCRYPTION_HANDLER_OBSERVER_H_