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

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

Issue 2698603003: [Sync] Use ExtractIntegerValue to extract request_id from js args (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | ios/chrome/browser/ui/webui/sync_internals/sync_internals_message_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 web_ui()->CallJavascriptFunctionUnsafe( 148 web_ui()->CallJavascriptFunctionUnsafe(
149 syncer::sync_ui_util::kDispatchEvent, 149 syncer::sync_ui_util::kDispatchEvent,
150 base::StringValue(syncer::sync_ui_util::kOnReceivedListOfTypes), 150 base::StringValue(syncer::sync_ui_util::kOnReceivedListOfTypes),
151 event_details); 151 event_details);
152 } 152 }
153 153
154 void SyncInternalsMessageHandler::HandleGetAllNodes( 154 void SyncInternalsMessageHandler::HandleGetAllNodes(
155 const base::ListValue* args) { 155 const base::ListValue* args) {
156 DCHECK_EQ(1U, args->GetSize()); 156 DCHECK_EQ(1U, args->GetSize());
157 int request_id = 0; 157 int request_id = 0;
158 bool success = args->GetInteger(0, &request_id); 158 bool success = ExtractIntegerValue(args, &request_id);
159 DCHECK(success); 159 DCHECK(success);
160 160
161 ProfileSyncService* service = GetProfileSyncService(); 161 ProfileSyncService* service = GetProfileSyncService();
162 if (service) { 162 if (service) {
163 service->GetAllNodes( 163 service->GetAllNodes(
164 base::Bind(&SyncInternalsMessageHandler::OnReceivedAllNodes, 164 base::Bind(&SyncInternalsMessageHandler::OnReceivedAllNodes,
165 weak_ptr_factory_.GetWeakPtr(), request_id)); 165 weak_ptr_factory_.GetWeakPtr(), request_id));
166 } 166 }
167 } 167 }
168 168
(...skipping 70 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
« no previous file with comments | « no previous file | ios/chrome/browser/ui/webui/sync_internals/sync_internals_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698