OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 } | 241 } |
242 } | 242 } |
243 | 243 |
244 void GpuMessageHandler::OnBrowserBridgeInitialized(const ListValue* args) { | 244 void GpuMessageHandler::OnBrowserBridgeInitialized(const ListValue* args) { |
245 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 245 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
246 | 246 |
247 DCHECK(!gpu_info_update_callback_); | 247 DCHECK(!gpu_info_update_callback_); |
248 | 248 |
249 // Watch for changes in GPUInfo | 249 // Watch for changes in GPUInfo |
250 gpu_info_update_callback_ = | 250 gpu_info_update_callback_ = |
251 NewCallback(this, &GpuMessageHandler::OnGpuInfoUpdate); | 251 NewCallback(this, &GpuMessageHandler::OnGpuInfoUpdate); |
252 gpu_data_manager_->AddGpuInfoUpdateCallback(gpu_info_update_callback_); | 252 gpu_data_manager_->AddGpuInfoUpdateCallback(gpu_info_update_callback_); |
253 | 253 |
254 // Tell GpuDataManager it should have full GpuInfo. If the | 254 // Tell GpuDataManager it should have full GpuInfo. If the |
255 // Gpu process has not run yet, this will trigger its launch. | 255 // Gpu process has not run yet, this will trigger its launch. |
256 gpu_data_manager_->RequestCompleteGpuInfoIfNeeded(); | 256 gpu_data_manager_->RequestCompleteGpuInfoIfNeeded(); |
257 | 257 |
258 // Run callback immediately in case the info is ready and no update in the | 258 // Run callback immediately in case the info is ready and no update in the |
259 // future. | 259 // future. |
260 OnGpuInfoUpdate(); | 260 OnGpuInfoUpdate(); |
261 } | 261 } |
262 | 262 |
263 Value* GpuMessageHandler::OnRequestClientInfo(const ListValue* list) { | 263 Value* GpuMessageHandler::OnRequestClientInfo(const ListValue* list) { |
264 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 264 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
265 | 265 |
266 DictionaryValue* dict = new DictionaryValue(); | 266 DictionaryValue* dict = new DictionaryValue(); |
267 | 267 |
268 chrome::VersionInfo version_info; | 268 chrome::VersionInfo version_info; |
269 | 269 |
270 if (!version_info.is_valid()) { | 270 if (!version_info.is_valid()) { |
271 DLOG(ERROR) << "Unable to create chrome::VersionInfo"; | 271 DLOG(ERROR) << "Unable to create chrome::VersionInfo"; |
272 } else { | 272 } else { |
273 // We have everything we need to send the right values. | 273 // We have everything we need to send the right values. |
274 dict->SetString("version", version_info.Version()); | 274 dict->SetString("version", version_info.Version()); |
275 dict->SetString("cl", version_info.LastChange()); | 275 dict->SetString("cl", version_info.LastChange()); |
276 dict->SetString("version_mod", | 276 dict->SetString("version_mod", |
277 platform_util::GetVersionStringModifier()); | 277 platform_util::GetVersionStringModifier()); |
278 dict->SetString("official", | 278 dict->SetString("official", |
279 l10n_util::GetStringUTF16( | 279 l10n_util::GetStringUTF16( |
280 version_info.IsOfficialBuild() ? | 280 version_info.IsOfficialBuild() ? |
281 IDS_ABOUT_VERSION_OFFICIAL | 281 IDS_ABOUT_VERSION_OFFICIAL : |
282 : IDS_ABOUT_VERSION_UNOFFICIAL)); | 282 IDS_ABOUT_VERSION_UNOFFICIAL)); |
283 | 283 |
284 dict->SetString("command_line", | 284 dict->SetString("command_line", |
285 CommandLine::ForCurrentProcess()->command_line_string()); | 285 CommandLine::ForCurrentProcess()->command_line_string()); |
286 } | 286 } |
287 | 287 |
| 288 dict->SetString("blacklist_version", |
| 289 GpuDataManager::GetInstance()->GetBlacklistVersion()); |
| 290 |
288 return dict; | 291 return dict; |
289 } | 292 } |
290 | 293 |
291 DictionaryValue* NewDescriptionValuePair(const std::string& desc, | 294 DictionaryValue* NewDescriptionValuePair(const std::string& desc, |
292 const std::string& value) { | 295 const std::string& value) { |
293 DictionaryValue* dict = new DictionaryValue(); | 296 DictionaryValue* dict = new DictionaryValue(); |
294 dict->SetString("description", desc); | 297 dict->SetString("description", desc); |
295 dict->SetString("value", value); | 298 dict->SetString("value", value); |
296 return dict; | 299 return dict; |
297 } | 300 } |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 //////////////////////////////////////////////////////////////////////////////// | 445 //////////////////////////////////////////////////////////////////////////////// |
443 | 446 |
444 GpuInternalsUI::GpuInternalsUI(TabContents* contents) : WebUI(contents) { | 447 GpuInternalsUI::GpuInternalsUI(TabContents* contents) : WebUI(contents) { |
445 AddMessageHandler((new GpuMessageHandler())->Attach(this)); | 448 AddMessageHandler((new GpuMessageHandler())->Attach(this)); |
446 | 449 |
447 GpuHTMLSource* html_source = new GpuHTMLSource(); | 450 GpuHTMLSource* html_source = new GpuHTMLSource(); |
448 | 451 |
449 // Set up the chrome://gpu/ source. | 452 // Set up the chrome://gpu/ source. |
450 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); | 453 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); |
451 } | 454 } |
OLD | NEW |