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

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

Issue 10837044: Correct const accessors in base/values.(h|cc), Part II (ListValue) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 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 (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/gpu_internals_ui.h" 5 #include "chrome/browser/ui/webui/gpu_internals_ui.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 base::Unretained(this))); 125 base::Unretained(this)));
126 web_ui()->RegisterMessageCallback("callAsync", 126 web_ui()->RegisterMessageCallback("callAsync",
127 base::Bind(&GpuMessageHandler::OnCallAsync, 127 base::Bind(&GpuMessageHandler::OnCallAsync,
128 base::Unretained(this))); 128 base::Unretained(this)));
129 } 129 }
130 130
131 void GpuMessageHandler::OnCallAsync(const ListValue* args) { 131 void GpuMessageHandler::OnCallAsync(const ListValue* args) {
132 DCHECK_GE(args->GetSize(), static_cast<size_t>(2)); 132 DCHECK_GE(args->GetSize(), static_cast<size_t>(2));
133 // unpack args into requestId, submessage and submessageArgs 133 // unpack args into requestId, submessage and submessageArgs
134 bool ok; 134 bool ok;
135 Value* requestId; 135 const Value* requestId;
136 ok = args->Get(0, &requestId); 136 ok = args->Get(0, &requestId);
137 DCHECK(ok); 137 DCHECK(ok);
138 138
139 std::string submessage; 139 std::string submessage;
140 ok = args->GetString(1, &submessage); 140 ok = args->GetString(1, &submessage);
141 DCHECK(ok); 141 DCHECK(ok);
142 142
143 ListValue* submessageArgs = new ListValue(); 143 ListValue* submessageArgs = new ListValue();
144 for (size_t i = 2; i < args->GetSize(); ++i) { 144 for (size_t i = 2; i < args->GetSize(); ++i) {
145 Value* arg; 145 const Value* arg;
146 ok = args->Get(i, &arg); 146 ok = args->Get(i, &arg);
147 DCHECK(ok); 147 DCHECK(ok);
148 148
149 Value* argCopy = arg->DeepCopy(); 149 Value* argCopy = arg->DeepCopy();
150 submessageArgs->Append(argCopy); 150 submessageArgs->Append(argCopy);
151 } 151 }
152 152
153 // call the submessage handler 153 // call the submessage handler
154 Value* ret = NULL; 154 Value* ret = NULL;
155 if (submessage == "requestClientInfo") { 155 if (submessage == "requestClientInfo") {
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 //////////////////////////////////////////////////////////////////////////////// 296 ////////////////////////////////////////////////////////////////////////////////
297 297
298 GpuInternalsUI::GpuInternalsUI(content::WebUI* web_ui) 298 GpuInternalsUI::GpuInternalsUI(content::WebUI* web_ui)
299 : WebUIController(web_ui) { 299 : WebUIController(web_ui) {
300 web_ui->AddMessageHandler(new GpuMessageHandler()); 300 web_ui->AddMessageHandler(new GpuMessageHandler());
301 301
302 // Set up the chrome://gpu-internals/ source. 302 // Set up the chrome://gpu-internals/ source.
303 Profile* profile = Profile::FromWebUI(web_ui); 303 Profile* profile = Profile::FromWebUI(web_ui);
304 ChromeURLDataManager::AddDataSource(profile, CreateGpuHTMLSource()); 304 ChromeURLDataManager::AddDataSource(profile, CreateGpuHTMLSource());
305 } 305 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698