Chromium Code Reviews| Index: chrome/browser/ui/webui/nacl_ui.cc |
| diff --git a/chrome/browser/ui/webui/nacl_ui.cc b/chrome/browser/ui/webui/nacl_ui.cc |
| index ed94181ae17d4b25eb98211aa841d282a041c164..2f2f8a205953029227de5135d88b3d97d4cd66e9 100644 |
| --- a/chrome/browser/ui/webui/nacl_ui.cc |
| +++ b/chrome/browser/ui/webui/nacl_ui.cc |
| @@ -217,15 +217,6 @@ void AddLineBreak(ListValue* list) { |
| AddPair(list, ASCIIToUTF16(""), ASCIIToUTF16("")); |
| } |
| -// Check whether a commandline switch is turned on or off. |
| -void ListFlagStatus(ListValue* list, const std::string& flag_label, |
| - const std::string& flag_name) { |
| - if (CommandLine::ForCurrentProcess()->HasSwitch(flag_name)) |
| - AddPair(list, ASCIIToUTF16(flag_label), ASCIIToUTF16("On")); |
| - else |
| - AddPair(list, ASCIIToUTF16(flag_label), ASCIIToUTF16("Off")); |
| -} |
| - |
| void NaClDomHandler::HandleRequestNaClInfo(const ListValue* args) { |
| page_has_requested_data_ = true; |
| // Force re-validation of pnacl's path in the next call to |
| @@ -287,8 +278,10 @@ void NaClDomHandler::PopulatePageInformation(DictionaryValue* naclInfo) { |
| GURL(), "application/x-nacl", false, &info_array, NULL); |
| string16 nacl_version; |
| string16 nacl_key = ASCIIToUTF16("NaCl plugin"); |
| + bool plugin_enabled = true; |
| if (info_array.empty()) { |
| AddPair(list.get(), nacl_key, ASCIIToUTF16("Disabled")); |
| + plugin_enabled = false; |
| } else { |
| PluginPrefs* plugin_prefs = |
| PluginPrefs::GetForProfile(Profile::FromWebUI(web_ui())).get(); |
| @@ -297,6 +290,7 @@ void NaClDomHandler::PopulatePageInformation(DictionaryValue* naclInfo) { |
| nacl_version = info_array[0].version + ASCIIToUTF16(" ") + |
| info_array[0].path.LossyDisplayName(); |
| if (!plugin_prefs->IsPluginEnabled(info_array[0])) { |
| + plugin_enabled = false; |
| nacl_version += ASCIIToUTF16(" (Disabled in profile prefs)"); |
| AddPair(list.get(), nacl_key, nacl_version); |
| } |
| @@ -308,17 +302,37 @@ void NaClDomHandler::PopulatePageInformation(DictionaryValue* naclInfo) { |
| nacl_version = info_array[i].version + ASCIIToUTF16(" ") + |
| info_array[i].path.LossyDisplayName(); |
| nacl_version += ASCIIToUTF16(" (not used)"); |
| - if (!plugin_prefs->IsPluginEnabled(info_array[i])) |
| + if (!plugin_prefs->IsPluginEnabled(info_array[i])) { |
| + plugin_enabled = false; |
|
Mark Seaborn
2013/07/22 23:28:10
I don't understand this. If there are multiple pl
sehr
2013/07/23 22:03:26
There weren't multiple plugins handling the mime t
|
| nacl_version += ASCIIToUTF16(" (Disabled in profile prefs)"); |
| + } |
| AddPair(list.get(), nacl_key, nacl_version); |
| } |
| } |
| - // Check that commandline flags are enabled. |
| - ListFlagStatus(list.get(), "Flag '--enable-nacl'", switches::kEnableNaCl); |
| + // Display whether NaCl is enabled. |
| + string16 nacl_enabled_string = ASCIIToUTF16("Disabled"); |
| + if (plugin_enabled && |
| + CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableNaCl)) { |
| + nacl_enabled_string = ASCIIToUTF16("Enabled by flag '--enable-nacl'"); |
| + } |
| + AddPair(list.get(), ASCIIToUTF16("Native Client"), nacl_enabled_string); |
| AddLineBreak(list.get()); |
| + // Display whether PNaCl is enabled. |
| + string16 pnacl_enabled_string = ASCIIToUTF16("Enabled"); |
| + if (!plugin_enabled) { |
| + pnacl_enabled_string = ASCIIToUTF16("Disabled in profile prefs"); |
| + } |
| + else if (CommandLine::ForCurrentProcess()->HasSwitch( |
|
Mark Seaborn
2013/07/22 23:28:10
Should go on previous line as "} else if"
sehr
2013/07/23 22:03:26
Done.
|
| + switches::kDisablePnacl)) { |
|
Mark Seaborn
2013/07/22 23:28:10
Fix indentation here.
// good
if (SomeFunc(
sehr
2013/07/23 22:03:26
Done.
|
| + pnacl_enabled_string = ASCIIToUTF16("Disabled by flag '--disable-pnacl'"); |
| + } |
| + AddPair(list.get(), |
| + ASCIIToUTF16("Portable Native Client"), |
| + pnacl_enabled_string); |
| + |
| // Obtain the version of the PNaCl translator. |
| base::FilePath pnacl_path; |
| bool got_path = PathService::Get(chrome::DIR_PNACL_COMPONENT, &pnacl_path); |
| @@ -338,7 +352,6 @@ void NaClDomHandler::PopulatePageInformation(DictionaryValue* naclInfo) { |
| pnacl_path.DirName().DirName().BaseName().LossyDisplayName()); |
| } |
| - ListFlagStatus(list.get(), "Flag '--enable-pnacl'", switches::kEnablePnacl); |
| // naclInfo will take ownership of list, and clean it up on destruction. |
| naclInfo->Set("naclInfo", list.release()); |
| } |