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

Unified Diff: chrome/browser/sync/sync_js_controller.cc

Issue 9699057: [Sync] Move 'sync' target to sync/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Tim's comments Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync/sync_js_controller.h ('k') | chrome/browser/sync/sync_js_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/sync_js_controller.cc
diff --git a/chrome/browser/sync/sync_js_controller.cc b/chrome/browser/sync/sync_js_controller.cc
deleted file mode 100644
index e904c253b7975580b2d239c396b9453de372c04b..0000000000000000000000000000000000000000
--- a/chrome/browser/sync/sync_js_controller.cc
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/sync/sync_js_controller.h"
-
-#include "base/location.h"
-#include "chrome/browser/sync/js/js_backend.h"
-#include "chrome/browser/sync/js/js_event_details.h"
-
-namespace browser_sync {
-
-SyncJsController::PendingJsMessage::PendingJsMessage(
- const std::string& name, const JsArgList& args,
- const WeakHandle<JsReplyHandler>& reply_handler)
- : name(name), args(args), reply_handler(reply_handler) {}
-
-SyncJsController::PendingJsMessage::~PendingJsMessage() {}
-
-SyncJsController::SyncJsController() {}
-
-SyncJsController::~SyncJsController() {
- AttachJsBackend(WeakHandle<JsBackend>());
-}
-
-void SyncJsController::AddJsEventHandler(JsEventHandler* event_handler) {
- js_event_handlers_.AddObserver(event_handler);
- UpdateBackendEventHandler();
-}
-
-void SyncJsController::RemoveJsEventHandler(JsEventHandler* event_handler) {
- js_event_handlers_.RemoveObserver(event_handler);
- UpdateBackendEventHandler();
-}
-
-void SyncJsController::AttachJsBackend(
- const WeakHandle<JsBackend>& js_backend) {
- js_backend_ = js_backend;
- UpdateBackendEventHandler();
-
- if (js_backend_.IsInitialized()) {
- // Process any queued messages.
- for (PendingJsMessageList::const_iterator it =
- pending_js_messages_.begin();
- it != pending_js_messages_.end(); ++it) {
- js_backend_.Call(FROM_HERE, &JsBackend::ProcessJsMessage,
- it->name, it->args, it->reply_handler);
- }
- }
-}
-
-void SyncJsController::ProcessJsMessage(
- const std::string& name, const JsArgList& args,
- const WeakHandle<JsReplyHandler>& reply_handler) {
- if (js_backend_.IsInitialized()) {
- js_backend_.Call(FROM_HERE, &JsBackend::ProcessJsMessage,
- name, args, reply_handler);
- } else {
- pending_js_messages_.push_back(
- PendingJsMessage(name, args, reply_handler));
- }
-}
-
-void SyncJsController::HandleJsEvent(const std::string& name,
- const JsEventDetails& details) {
- FOR_EACH_OBSERVER(JsEventHandler, js_event_handlers_,
- HandleJsEvent(name, details));
-}
-
-void SyncJsController::UpdateBackendEventHandler() {
- if (js_backend_.IsInitialized()) {
- // To avoid making the backend send useless events, we clear the
- // event handler we pass to it if we don't have any event
- // handlers.
- WeakHandle<JsEventHandler> backend_event_handler =
- (js_event_handlers_.size() > 0) ?
- MakeWeakHandle(AsWeakPtr()) : WeakHandle<SyncJsController>();
- js_backend_.Call(FROM_HERE, &JsBackend::SetJsEventHandler,
- backend_event_handler);
- }
-}
-
-} // namespace browser_sync
« no previous file with comments | « chrome/browser/sync/sync_js_controller.h ('k') | chrome/browser/sync/sync_js_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698