Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: sync/internal_api/js_sync_encryption_handler_observer.cc

Issue 17034006: Add base namespace to more values in sync and elsewhere. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 17 matching lines...) Expand all
28 const WeakHandle<JsEventHandler>& event_handler) { 28 const WeakHandle<JsEventHandler>& event_handler) {
29 event_handler_ = event_handler; 29 event_handler_ = event_handler;
30 } 30 }
31 31
32 void JsSyncEncryptionHandlerObserver::OnPassphraseRequired( 32 void JsSyncEncryptionHandlerObserver::OnPassphraseRequired(
33 PassphraseRequiredReason reason, 33 PassphraseRequiredReason reason,
34 const sync_pb::EncryptedData& pending_keys) { 34 const sync_pb::EncryptedData& pending_keys) {
35 if (!event_handler_.IsInitialized()) { 35 if (!event_handler_.IsInitialized()) {
36 return; 36 return;
37 } 37 }
38 DictionaryValue details; 38 base::DictionaryValue details;
39 details.SetString("reason", 39 details.SetString("reason",
40 PassphraseRequiredReasonToString(reason)); 40 PassphraseRequiredReasonToString(reason));
41 HandleJsEvent(FROM_HERE, "onPassphraseRequired", JsEventDetails(&details)); 41 HandleJsEvent(FROM_HERE, "onPassphraseRequired", JsEventDetails(&details));
42 } 42 }
43 43
44 void JsSyncEncryptionHandlerObserver::OnPassphraseAccepted() { 44 void JsSyncEncryptionHandlerObserver::OnPassphraseAccepted() {
45 if (!event_handler_.IsInitialized()) { 45 if (!event_handler_.IsInitialized()) {
46 return; 46 return;
47 } 47 }
48 DictionaryValue details; 48 base::DictionaryValue details;
49 HandleJsEvent(FROM_HERE, "onPassphraseAccepted", JsEventDetails(&details)); 49 HandleJsEvent(FROM_HERE, "onPassphraseAccepted", JsEventDetails(&details));
50 } 50 }
51 51
52 void JsSyncEncryptionHandlerObserver::OnBootstrapTokenUpdated( 52 void JsSyncEncryptionHandlerObserver::OnBootstrapTokenUpdated(
53 const std::string& boostrap_token, 53 const std::string& boostrap_token,
54 BootstrapTokenType type) { 54 BootstrapTokenType type) {
55 if (!event_handler_.IsInitialized()) { 55 if (!event_handler_.IsInitialized()) {
56 return; 56 return;
57 } 57 }
58 DictionaryValue details; 58 base::DictionaryValue details;
59 details.SetString("bootstrapToken", "<redacted>"); 59 details.SetString("bootstrapToken", "<redacted>");
60 details.SetString("type", BootstrapTokenTypeToString(type)); 60 details.SetString("type", BootstrapTokenTypeToString(type));
61 HandleJsEvent(FROM_HERE, "onBootstrapTokenUpdated", JsEventDetails(&details)); 61 HandleJsEvent(FROM_HERE, "onBootstrapTokenUpdated", JsEventDetails(&details));
62 } 62 }
63 63
64 void JsSyncEncryptionHandlerObserver::OnEncryptedTypesChanged( 64 void JsSyncEncryptionHandlerObserver::OnEncryptedTypesChanged(
65 ModelTypeSet encrypted_types, 65 ModelTypeSet encrypted_types,
66 bool encrypt_everything) { 66 bool encrypt_everything) {
67 if (!event_handler_.IsInitialized()) { 67 if (!event_handler_.IsInitialized()) {
68 return; 68 return;
69 } 69 }
70 DictionaryValue details; 70 base::DictionaryValue details;
71 details.Set("encryptedTypes", 71 details.Set("encryptedTypes",
72 ModelTypeSetToValue(encrypted_types)); 72 ModelTypeSetToValue(encrypted_types));
73 details.SetBoolean("encryptEverything", encrypt_everything); 73 details.SetBoolean("encryptEverything", encrypt_everything);
74 HandleJsEvent(FROM_HERE, 74 HandleJsEvent(FROM_HERE,
75 "onEncryptedTypesChanged", JsEventDetails(&details)); 75 "onEncryptedTypesChanged", JsEventDetails(&details));
76 } 76 }
77 77
78 void JsSyncEncryptionHandlerObserver::OnEncryptionComplete() { 78 void JsSyncEncryptionHandlerObserver::OnEncryptionComplete() {
79 if (!event_handler_.IsInitialized()) { 79 if (!event_handler_.IsInitialized()) {
80 return; 80 return;
81 } 81 }
82 DictionaryValue details; 82 base::DictionaryValue details;
83 HandleJsEvent(FROM_HERE, "onEncryptionComplete", JsEventDetails()); 83 HandleJsEvent(FROM_HERE, "onEncryptionComplete", JsEventDetails());
84 } 84 }
85 85
86 void JsSyncEncryptionHandlerObserver::OnCryptographerStateChanged( 86 void JsSyncEncryptionHandlerObserver::OnCryptographerStateChanged(
87 Cryptographer* cryptographer) { 87 Cryptographer* cryptographer) {
88 if (!event_handler_.IsInitialized()) { 88 if (!event_handler_.IsInitialized()) {
89 return; 89 return;
90 } 90 }
91 DictionaryValue details; 91 base::DictionaryValue details;
92 details.SetBoolean("ready", 92 details.SetBoolean("ready",
93 cryptographer->is_ready()); 93 cryptographer->is_ready());
94 details.SetBoolean("hasPendingKeys", 94 details.SetBoolean("hasPendingKeys",
95 cryptographer->has_pending_keys()); 95 cryptographer->has_pending_keys());
96 HandleJsEvent(FROM_HERE, 96 HandleJsEvent(FROM_HERE,
97 "onCryptographerStateChanged", 97 "onCryptographerStateChanged",
98 JsEventDetails(&details)); 98 JsEventDetails(&details));
99 } 99 }
100 100
101 void JsSyncEncryptionHandlerObserver::OnPassphraseTypeChanged( 101 void JsSyncEncryptionHandlerObserver::OnPassphraseTypeChanged(
102 PassphraseType type, 102 PassphraseType type,
103 base::Time explicit_passphrase_time) { 103 base::Time explicit_passphrase_time) {
104 if (!event_handler_.IsInitialized()) { 104 if (!event_handler_.IsInitialized()) {
105 return; 105 return;
106 } 106 }
107 DictionaryValue details; 107 base::DictionaryValue details;
108 details.SetString("passphraseType", 108 details.SetString("passphraseType",
109 PassphraseTypeToString(type)); 109 PassphraseTypeToString(type));
110 details.SetInteger("explicitPassphraseTime", 110 details.SetInteger("explicitPassphraseTime",
111 TimeToProtoTime(explicit_passphrase_time)); 111 TimeToProtoTime(explicit_passphrase_time));
112 HandleJsEvent(FROM_HERE, 112 HandleJsEvent(FROM_HERE,
113 "onPassphraseTypeChanged", 113 "onPassphraseTypeChanged",
114 JsEventDetails(&details)); 114 JsEventDetails(&details));
115 } 115 }
116 116
117 void JsSyncEncryptionHandlerObserver::HandleJsEvent( 117 void JsSyncEncryptionHandlerObserver::HandleJsEvent(
118 const tracked_objects::Location& from_here, 118 const tracked_objects::Location& from_here,
119 const std::string& name, const JsEventDetails& details) { 119 const std::string& name, const JsEventDetails& details) {
120 if (!event_handler_.IsInitialized()) { 120 if (!event_handler_.IsInitialized()) {
121 NOTREACHED(); 121 NOTREACHED();
122 return; 122 return;
123 } 123 }
124 event_handler_.Call(from_here, 124 event_handler_.Call(from_here,
125 &JsEventHandler::HandleJsEvent, name, details); 125 &JsEventHandler::HandleJsEvent, name, details);
126 } 126 }
127 127
128 } // namespace syncer 128 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/js_mutation_event_observer_unittest.cc ('k') | sync/internal_api/js_sync_manager_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698