OLD | NEW |
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 "chrome/browser/ui/webui/sync_internals_ui.h" | 5 #include "chrome/browser/ui/webui/sync_internals_ui.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 profile->GetOriginalProfile()); | 75 profile->GetOriginalProfile()); |
76 } | 76 } |
77 | 77 |
78 } // namespace | 78 } // namespace |
79 | 79 |
80 SyncInternalsUI::SyncInternalsUI(content::WebUI* web_ui) | 80 SyncInternalsUI::SyncInternalsUI(content::WebUI* web_ui) |
81 : WebUIController(web_ui), | 81 : WebUIController(web_ui), |
82 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 82 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
83 // TODO(akalin): Fix. | 83 // TODO(akalin): Fix. |
84 Profile* profile = Profile::FromWebUI(web_ui); | 84 Profile* profile = Profile::FromWebUI(web_ui); |
85 ChromeURLDataManager::AddDataSource(profile, CreateSyncInternalsHTMLSource()); | 85 ChromeURLDataManager::AddDataSourceImpl(profile, |
| 86 CreateSyncInternalsHTMLSource()); |
86 ProfileSyncService* sync_service = GetProfileSyncService(profile); | 87 ProfileSyncService* sync_service = GetProfileSyncService(profile); |
87 if (sync_service) { | 88 if (sync_service) { |
88 js_controller_ = sync_service->GetJsController(); | 89 js_controller_ = sync_service->GetJsController(); |
89 } | 90 } |
90 if (js_controller_.get()) { | 91 if (js_controller_.get()) { |
91 js_controller_->AddJsEventHandler(this); | 92 js_controller_->AddJsEventHandler(this); |
92 } | 93 } |
93 } | 94 } |
94 | 95 |
95 SyncInternalsUI::~SyncInternalsUI() { | 96 SyncInternalsUI::~SyncInternalsUI() { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 } | 138 } |
138 | 139 |
139 void SyncInternalsUI::HandleJsReply( | 140 void SyncInternalsUI::HandleJsReply( |
140 const std::string& name, const JsArgList& args) { | 141 const std::string& name, const JsArgList& args) { |
141 VLOG(1) << "Handling reply for " << name << " message with args " | 142 VLOG(1) << "Handling reply for " << name << " message with args " |
142 << args.ToString(); | 143 << args.ToString(); |
143 const std::string& reply_handler = "chrome.sync." + name + ".handleReply"; | 144 const std::string& reply_handler = "chrome.sync." + name + ".handleReply"; |
144 std::vector<const Value*> arg_list(args.Get().begin(), args.Get().end()); | 145 std::vector<const Value*> arg_list(args.Get().begin(), args.Get().end()); |
145 web_ui()->CallJavascriptFunction(reply_handler, arg_list); | 146 web_ui()->CallJavascriptFunction(reply_handler, arg_list); |
146 } | 147 } |
OLD | NEW |