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

Unified Diff: chrome/browser/dom_ui/sync_internals_message_handler.cc

Issue 6299002: [Sync] Port about:sync to DOMUI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added workaround for bug 69633 Created 9 years, 11 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/dom_ui/sync_internals_message_handler.h ('k') | chrome/browser/dom_ui/sync_internals_ui.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/dom_ui/sync_internals_message_handler.cc
diff --git a/chrome/browser/dom_ui/sync_internals_message_handler.cc b/chrome/browser/dom_ui/sync_internals_message_handler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5ef008433262dd0aa9fce75054c551609536e460
--- /dev/null
+++ b/chrome/browser/dom_ui/sync_internals_message_handler.cc
@@ -0,0 +1,48 @@
+// 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/dom_ui/sync_internals_message_handler.h"
+
+#include "base/callback.h"
+#include "base/logging.h"
+#include "base/values.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/sync/sync_ui_util.h"
+
+SyncInternalsMessageHandler::SyncInternalsMessageHandler(Profile* profile)
+ : profile_(profile) {
+ DCHECK(profile_);
+ ProfileSyncService* service = profile_->GetProfileSyncService();
+ if (service) {
+ service->AddObserver(this);
+ }
+ // TODO(akalin): Listen for when the service gets created/destroyed.
+}
+
+SyncInternalsMessageHandler::~SyncInternalsMessageHandler() {
+ ProfileSyncService* service = profile_->GetProfileSyncService();
+ if (service) {
+ service->RemoveObserver(this);
+ }
+}
+
+void SyncInternalsMessageHandler::OnStateChanged() {
+ dom_ui_->CallJavascriptFunction(L"onSyncServiceStateChanged");
+}
+
+void SyncInternalsMessageHandler::RegisterMessages() {
+ dom_ui_->RegisterMessageCallback(
+ "getAboutInfo",
+ NewCallback(
+ this, &SyncInternalsMessageHandler::HandleGetAboutInfo));
+}
+
+void SyncInternalsMessageHandler::HandleGetAboutInfo(const ListValue* args) {
+ ProfileSyncService* service = profile_->GetProfileSyncService();
+ DictionaryValue about_info;
+ sync_ui_util::ConstructAboutInformation(service, &about_info);
+
+ dom_ui_->CallJavascriptFunction(L"onGetAboutInfoFinished", about_info);
+}
« no previous file with comments | « chrome/browser/dom_ui/sync_internals_message_handler.h ('k') | chrome/browser/dom_ui/sync_internals_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698