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/nacl_ui.h" | 5 #include "chrome/browser/ui/webui/nacl_ui.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 // Obtain the version of the NaCl plugin. | 280 // Obtain the version of the NaCl plugin. |
281 std::vector<webkit::WebPluginInfo> info_array; | 281 std::vector<webkit::WebPluginInfo> info_array; |
282 PluginService::GetInstance()->GetPluginInfoArray( | 282 PluginService::GetInstance()->GetPluginInfoArray( |
283 GURL(), "application/x-nacl", false, &info_array, NULL); | 283 GURL(), "application/x-nacl", false, &info_array, NULL); |
284 string16 nacl_version; | 284 string16 nacl_version; |
285 string16 nacl_key = ASCIIToUTF16("NaCl plugin"); | 285 string16 nacl_key = ASCIIToUTF16("NaCl plugin"); |
286 if (info_array.empty()) { | 286 if (info_array.empty()) { |
287 AddPair(list.get(), nacl_key, ASCIIToUTF16("Disabled")); | 287 AddPair(list.get(), nacl_key, ASCIIToUTF16("Disabled")); |
288 } else { | 288 } else { |
289 PluginPrefs* plugin_prefs = | 289 PluginPrefs* plugin_prefs = |
290 PluginPrefs::GetForProfile(Profile::FromWebUI(web_ui())); | 290 PluginPrefs::GetForProfile(Profile::FromWebUI(web_ui())).get(); |
291 | 291 |
292 // Only the 0th plugin is used. | 292 // Only the 0th plugin is used. |
293 nacl_version = info_array[0].version + ASCIIToUTF16(" ") + | 293 nacl_version = info_array[0].version + ASCIIToUTF16(" ") + |
294 info_array[0].path.LossyDisplayName(); | 294 info_array[0].path.LossyDisplayName(); |
295 if (!plugin_prefs->IsPluginEnabled(info_array[0])) { | 295 if (!plugin_prefs->IsPluginEnabled(info_array[0])) { |
296 nacl_version += ASCIIToUTF16(" (Disabled in profile prefs)"); | 296 nacl_version += ASCIIToUTF16(" (Disabled in profile prefs)"); |
297 AddPair(list.get(), nacl_key, nacl_version); | 297 AddPair(list.get(), nacl_key, nacl_version); |
298 } | 298 } |
299 | 299 |
300 AddPair(list.get(), nacl_key, nacl_version); | 300 AddPair(list.get(), nacl_key, nacl_version); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 | 369 |
370 NaClUI::NaClUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 370 NaClUI::NaClUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
371 content::RecordAction(UserMetricsAction("ViewAboutNaCl")); | 371 content::RecordAction(UserMetricsAction("ViewAboutNaCl")); |
372 | 372 |
373 web_ui->AddMessageHandler(new NaClDomHandler()); | 373 web_ui->AddMessageHandler(new NaClDomHandler()); |
374 | 374 |
375 // Set up the about:nacl source. | 375 // Set up the about:nacl source. |
376 Profile* profile = Profile::FromWebUI(web_ui); | 376 Profile* profile = Profile::FromWebUI(web_ui); |
377 content::WebUIDataSource::Add(profile, CreateNaClUIHTMLSource()); | 377 content::WebUIDataSource::Add(profile, CreateNaClUIHTMLSource()); |
378 } | 378 } |
OLD | NEW |