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

Side by Side Diff: chrome/browser/sync/js/js_sync_manager_observer.cc

Issue 8356026: [Sync] Cache encrypted types info in ProfileSyncService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments (retry) Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/sync/js/js_sync_manager_observer.h" 5 #include "chrome/browser/sync/js/js_sync_manager_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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 void JsSyncManagerObserver::OnPassphraseAccepted( 73 void JsSyncManagerObserver::OnPassphraseAccepted(
74 const std::string& bootstrap_token) { 74 const std::string& bootstrap_token) {
75 if (!event_handler_.IsInitialized()) { 75 if (!event_handler_.IsInitialized()) {
76 return; 76 return;
77 } 77 }
78 DictionaryValue details; 78 DictionaryValue details;
79 details.SetString("bootstrapToken", "<redacted>"); 79 details.SetString("bootstrapToken", "<redacted>");
80 HandleJsEvent(FROM_HERE, "onPassphraseAccepted", JsEventDetails(&details)); 80 HandleJsEvent(FROM_HERE, "onPassphraseAccepted", JsEventDetails(&details));
81 } 81 }
82 82
83 void JsSyncManagerObserver::OnEncryptionComplete( 83 void JsSyncManagerObserver::OnEncryptedTypesChanged(
84 const syncable::ModelTypeSet& encrypted_types) { 84 const syncable::ModelTypeSet& encrypted_types,
85 bool encrypt_everything) {
85 if (!event_handler_.IsInitialized()) { 86 if (!event_handler_.IsInitialized()) {
86 return; 87 return;
87 } 88 }
88 DictionaryValue details; 89 DictionaryValue details;
89 details.Set("encryptedTypes", 90 details.Set("encryptedTypes",
90 syncable::ModelTypeSetToValue(encrypted_types)); 91 syncable::ModelTypeSetToValue(encrypted_types));
91 HandleJsEvent(FROM_HERE, "onEncryptionComplete", JsEventDetails(&details)); 92 details.SetBoolean("encryptEverything", encrypt_everything);
93 HandleJsEvent(FROM_HERE,
94 "onEncryptedTypesChanged", JsEventDetails(&details));
95 }
96
97 void JsSyncManagerObserver::OnEncryptionComplete() {
98 if (!event_handler_.IsInitialized()) {
99 return;
100 }
101 DictionaryValue details;
102 HandleJsEvent(FROM_HERE, "onEncryptionComplete", JsEventDetails());
92 } 103 }
93 104
94 void JsSyncManagerObserver::OnActionableError( 105 void JsSyncManagerObserver::OnActionableError(
95 const SyncProtocolError& sync_error) { 106 const SyncProtocolError& sync_error) {
96 if (!event_handler_.IsInitialized()) { 107 if (!event_handler_.IsInitialized()) {
97 return; 108 return;
98 } 109 }
99 DictionaryValue details; 110 DictionaryValue details;
100 details.Set("syncError", sync_error.ToValue()); 111 details.Set("syncError", sync_error.ToValue());
101 HandleJsEvent(FROM_HERE, "onActionableError", 112 HandleJsEvent(FROM_HERE, "onActionableError",
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 const std::string& name, const JsEventDetails& details) { 150 const std::string& name, const JsEventDetails& details) {
140 if (!event_handler_.IsInitialized()) { 151 if (!event_handler_.IsInitialized()) {
141 NOTREACHED(); 152 NOTREACHED();
142 return; 153 return;
143 } 154 }
144 event_handler_.Call(from_here, 155 event_handler_.Call(from_here,
145 &JsEventHandler::HandleJsEvent, name, details); 156 &JsEventHandler::HandleJsEvent, name, details);
146 } 157 }
147 158
148 } // namespace browser_sync 159 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/js/js_sync_manager_observer.h ('k') | chrome/browser/sync/js/js_sync_manager_observer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698