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

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

Issue 10824410: [Sync] Refactor passphrase state handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 3 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698