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

Side by Side Diff: chrome/browser/ui/webui/sync_internals_message_handler.cc

Issue 2657673004: Add shutdown notification and service refs to SyncServiceObserver. (Closed)
Patch Set: Use parameter Created 3 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_message_handler.h" 5 #include "chrome/browser/ui/webui/sync_internals_message_handler.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 } 167 }
168 168
169 void SyncInternalsMessageHandler::OnReceivedAllNodes( 169 void SyncInternalsMessageHandler::OnReceivedAllNodes(
170 int request_id, 170 int request_id,
171 std::unique_ptr<base::ListValue> nodes) { 171 std::unique_ptr<base::ListValue> nodes) {
172 base::FundamentalValue id(request_id); 172 base::FundamentalValue id(request_id);
173 web_ui()->CallJavascriptFunctionUnsafe( 173 web_ui()->CallJavascriptFunctionUnsafe(
174 syncer::sync_ui_util::kGetAllNodesCallback, id, *nodes); 174 syncer::sync_ui_util::kGetAllNodesCallback, id, *nodes);
175 } 175 }
176 176
177 void SyncInternalsMessageHandler::OnStateChanged() { 177 void SyncInternalsMessageHandler::OnStateChanged(syncer::SyncService* sync) {
178 SendAboutInfo(); 178 SendAboutInfo();
179 } 179 }
180 180
181 void SyncInternalsMessageHandler::OnProtocolEvent( 181 void SyncInternalsMessageHandler::OnProtocolEvent(
182 const syncer::ProtocolEvent& event) { 182 const syncer::ProtocolEvent& event) {
183 std::unique_ptr<base::DictionaryValue> value( 183 std::unique_ptr<base::DictionaryValue> value(
184 syncer::ProtocolEvent::ToValue(event)); 184 syncer::ProtocolEvent::ToValue(event));
185 web_ui()->CallJavascriptFunctionUnsafe( 185 web_ui()->CallJavascriptFunctionUnsafe(
186 syncer::sync_ui_util::kDispatchEvent, 186 syncer::sync_ui_util::kDispatchEvent,
187 base::StringValue(syncer::sync_ui_util::kOnProtocolEvent), *value); 187 base::StringValue(syncer::sync_ui_util::kOnProtocolEvent), *value);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 base::StringValue(syncer::sync_ui_util::kOnAboutInfoUpdated), *value); 239 base::StringValue(syncer::sync_ui_util::kOnAboutInfoUpdated), *value);
240 } 240 }
241 241
242 // Gets the ProfileSyncService of the underlying original profile. 242 // Gets the ProfileSyncService of the underlying original profile.
243 // May return NULL (e.g., if sync is disabled on the command line). 243 // May return NULL (e.g., if sync is disabled on the command line).
244 ProfileSyncService* SyncInternalsMessageHandler::GetProfileSyncService() { 244 ProfileSyncService* SyncInternalsMessageHandler::GetProfileSyncService() {
245 Profile* profile = Profile::FromWebUI(web_ui()); 245 Profile* profile = Profile::FromWebUI(web_ui());
246 return ProfileSyncServiceFactory::GetForProfile( 246 return ProfileSyncServiceFactory::GetForProfile(
247 profile->GetOriginalProfile()); 247 profile->GetOriginalProfile());
248 } 248 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698