| 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..653a210e2130826b9f1f94eca6b2aff7f9641fed 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,8 +290,8 @@ 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);
|
| }
|
|
|
| AddPair(list.get(), nacl_key, nacl_version);
|
| @@ -308,17 +301,27 @@ 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])) {
|
| 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);
|
| -
|
| 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(
|
| + switches::kDisablePnacl)) {
|
| + pnacl_enabled_string = ASCIIToUTF16("Disabled by flag '--disable-pnacl'");
|
| + }
|
| + AddPair(list.get(),
|
| + ASCIIToUTF16("Portable Native Client (PNaCl)"),
|
| + 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 +341,19 @@ void NaClDomHandler::PopulatePageInformation(DictionaryValue* naclInfo) {
|
| pnacl_path.DirName().DirName().BaseName().LossyDisplayName());
|
| }
|
|
|
| - ListFlagStatus(list.get(), "Flag '--enable-pnacl'", switches::kEnablePnacl);
|
| + AddLineBreak(list.get());
|
| +
|
| + // 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 (non-portable, outside web store)"),
|
| + nacl_enabled_string);
|
| +
|
| // naclInfo will take ownership of list, and clean it up on destruction.
|
| naclInfo->Set("naclInfo", list.release());
|
| }
|
|
|