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

Side by Side Diff: components/sync/js/sync_js_controller.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 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
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/js/sync_js_controller.h" 5 #include "components/sync/js/sync_js_controller.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "sync/js/js_backend.h" 8 #include "components/sync/js/js_backend.h"
9 #include "sync/js/js_event_details.h" 9 #include "components/sync/js/js_event_details.h"
10 10
11 namespace syncer { 11 namespace syncer {
12 12
13 SyncJsController::SyncJsController() {} 13 SyncJsController::SyncJsController() {}
14 14
15 SyncJsController::~SyncJsController() { 15 SyncJsController::~SyncJsController() {
16 AttachJsBackend(WeakHandle<JsBackend>()); 16 AttachJsBackend(WeakHandle<JsBackend>());
17 } 17 }
18 18
19 void SyncJsController::AddJsEventHandler(JsEventHandler* event_handler) { 19 void SyncJsController::AddJsEventHandler(JsEventHandler* event_handler) {
(...skipping 17 matching lines...) Expand all
37 FOR_EACH_OBSERVER(JsEventHandler, js_event_handlers_, 37 FOR_EACH_OBSERVER(JsEventHandler, js_event_handlers_,
38 HandleJsEvent(name, details)); 38 HandleJsEvent(name, details));
39 } 39 }
40 40
41 void SyncJsController::UpdateBackendEventHandler() { 41 void SyncJsController::UpdateBackendEventHandler() {
42 if (js_backend_.IsInitialized()) { 42 if (js_backend_.IsInitialized()) {
43 // To avoid making the backend send useless events, we clear the 43 // To avoid making the backend send useless events, we clear the
44 // event handler we pass to it if we don't have any event 44 // event handler we pass to it if we don't have any event
45 // handlers. 45 // handlers.
46 WeakHandle<JsEventHandler> backend_event_handler = 46 WeakHandle<JsEventHandler> backend_event_handler =
47 js_event_handlers_.might_have_observers() ? 47 js_event_handlers_.might_have_observers()
48 MakeWeakHandle(AsWeakPtr()) : WeakHandle<SyncJsController>(); 48 ? MakeWeakHandle(AsWeakPtr())
49 : WeakHandle<SyncJsController>();
49 js_backend_.Call(FROM_HERE, &JsBackend::SetJsEventHandler, 50 js_backend_.Call(FROM_HERE, &JsBackend::SetJsEventHandler,
50 backend_event_handler); 51 backend_event_handler);
51 } 52 }
52 } 53 }
53 54
54 } // namespace syncer 55 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/js/sync_js_controller.h ('k') | components/sync/js/sync_js_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698