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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/dom_ui/sync_internals_message_handler.h"
6
7 #include "base/callback.h"
8 #include "base/logging.h"
9 #include "base/values.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/sync/profile_sync_service.h"
12 #include "chrome/browser/sync/sync_ui_util.h"
13
14 SyncInternalsMessageHandler::SyncInternalsMessageHandler(Profile* profile)
15 : profile_(profile) {
16 DCHECK(profile_);
17 ProfileSyncService* service = profile_->GetProfileSyncService();
18 if (service) {
19 service->AddObserver(this);
20 }
21 // TODO(akalin): Listen for when the service gets created/destroyed.
22 }
23
24 SyncInternalsMessageHandler::~SyncInternalsMessageHandler() {
25 ProfileSyncService* service = profile_->GetProfileSyncService();
26 if (service) {
27 service->RemoveObserver(this);
28 }
29 }
30
31 void SyncInternalsMessageHandler::OnStateChanged() {
32 dom_ui_->CallJavascriptFunction(L"onSyncServiceStateChanged");
33 }
34
35 void SyncInternalsMessageHandler::RegisterMessages() {
36 dom_ui_->RegisterMessageCallback(
37 "getAboutInfo",
38 NewCallback(
39 this, &SyncInternalsMessageHandler::HandleGetAboutInfo));
40 }
41
42 void SyncInternalsMessageHandler::HandleGetAboutInfo(const ListValue* args) {
43 ProfileSyncService* service = profile_->GetProfileSyncService();
44 DictionaryValue about_info;
45 sync_ui_util::ConstructAboutInformation(service, &about_info);
46
47 dom_ui_->CallJavascriptFunction(L"onGetAboutInfoFinished", about_info);
48 }
OLDNEW
« 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