| 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/plugins_ui.h" | 5 #include "chrome/browser/ui/webui/plugins_ui.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #include "content/public/browser/notification_source.h" | 37 #include "content/public/browser/notification_source.h" |
| 38 #include "content/public/browser/plugin_service.h" | 38 #include "content/public/browser/plugin_service.h" |
| 39 #include "content/public/browser/web_contents.h" | 39 #include "content/public/browser/web_contents.h" |
| 40 #include "content/public/browser/web_ui.h" | 40 #include "content/public/browser/web_ui.h" |
| 41 #include "content/public/browser/web_ui_message_handler.h" | 41 #include "content/public/browser/web_ui_message_handler.h" |
| 42 #include "grit/browser_resources.h" | 42 #include "grit/browser_resources.h" |
| 43 #include "grit/generated_resources.h" | 43 #include "grit/generated_resources.h" |
| 44 #include "grit/theme_resources.h" | 44 #include "grit/theme_resources.h" |
| 45 #include "ui/base/l10n/l10n_util.h" | 45 #include "ui/base/l10n/l10n_util.h" |
| 46 #include "ui/base/resource/resource_bundle.h" | 46 #include "ui/base/resource/resource_bundle.h" |
| 47 #include "webkit/plugins/npapi/plugin_group.h" | |
| 48 | 47 |
| 49 #if defined(OS_CHROMEOS) | 48 #if defined(OS_CHROMEOS) |
| 50 #include "chrome/browser/ui/webui/chromeos/ui_account_tweaks.h" | 49 #include "chrome/browser/ui/webui/chromeos/ui_account_tweaks.h" |
| 51 #endif | 50 #endif |
| 52 | 51 |
| 53 using content::PluginService; | 52 using content::PluginService; |
| 54 using content::WebContents; | 53 using content::WebContents; |
| 55 using content::WebUIMessageHandler; | 54 using content::WebUIMessageHandler; |
| 56 using webkit::npapi::PluginGroup; | |
| 57 using webkit::WebPluginInfo; | 55 using webkit::WebPluginInfo; |
| 58 | 56 |
| 59 namespace { | 57 namespace { |
| 60 | 58 |
| 61 // Callback function to process result of EnablePlugin method. | 59 // Callback function to process result of EnablePlugin method. |
| 62 void AssertPluginEnabled(bool did_enable) { | 60 void AssertPluginEnabled(bool did_enable) { |
| 63 DCHECK(did_enable); | 61 DCHECK(did_enable); |
| 64 } | 62 } |
| 65 | 63 |
| 66 ChromeWebUIDataSource* CreatePluginsUIHTMLSource() { | 64 ChromeWebUIDataSource* CreatePluginsUIHTMLSource() { |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 string16 group_name; | 242 string16 group_name; |
| 245 if (!args->GetString(0, &group_name)) { | 243 if (!args->GetString(0, &group_name)) { |
| 246 NOTREACHED(); | 244 NOTREACHED(); |
| 247 return; | 245 return; |
| 248 } | 246 } |
| 249 | 247 |
| 250 plugin_prefs->EnablePluginGroup(enable, group_name); | 248 plugin_prefs->EnablePluginGroup(enable, group_name); |
| 251 if (enable) { | 249 if (enable) { |
| 252 // See http://crbug.com/50105 for background. | 250 // See http://crbug.com/50105 for background. |
| 253 string16 adobereader = ASCIIToUTF16( | 251 string16 adobereader = ASCIIToUTF16( |
| 254 PluginGroup::kAdobeReaderGroupName); | 252 PluginMetadata::kAdobeReaderGroupName); |
| 255 string16 internalpdf = | 253 string16 internalpdf = |
| 256 ASCIIToUTF16(chrome::ChromeContentClient::kPDFPluginName); | 254 ASCIIToUTF16(chrome::ChromeContentClient::kPDFPluginName); |
| 257 if (group_name == adobereader) | 255 if (group_name == adobereader) |
| 258 plugin_prefs->EnablePluginGroup(false, internalpdf); | 256 plugin_prefs->EnablePluginGroup(false, internalpdf); |
| 259 else if (group_name == internalpdf) | 257 else if (group_name == internalpdf) |
| 260 plugin_prefs->EnablePluginGroup(false, adobereader); | 258 plugin_prefs->EnablePluginGroup(false, adobereader); |
| 261 } | 259 } |
| 262 } else { | 260 } else { |
| 263 FilePath::StringType file_path; | 261 FilePath::StringType file_path; |
| 264 if (!args->GetString(0, &file_path)) { | 262 if (!args->GetString(0, &file_path)) { |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 void PluginsUI::RegisterUserPrefs(PrefService* prefs) { | 503 void PluginsUI::RegisterUserPrefs(PrefService* prefs) { |
| 506 prefs->RegisterBooleanPref(prefs::kPluginsShowDetails, | 504 prefs->RegisterBooleanPref(prefs::kPluginsShowDetails, |
| 507 false, | 505 false, |
| 508 PrefService::UNSYNCABLE_PREF); | 506 PrefService::UNSYNCABLE_PREF); |
| 509 prefs->RegisterBooleanPref(prefs::kPluginsShowSetReaderDefaultInfobar, | 507 prefs->RegisterBooleanPref(prefs::kPluginsShowSetReaderDefaultInfobar, |
| 510 true, | 508 true, |
| 511 PrefService::UNSYNCABLE_PREF); | 509 PrefService::UNSYNCABLE_PREF); |
| 512 prefs->RegisterDictionaryPref(prefs::kContentSettingsPluginWhitelist, | 510 prefs->RegisterDictionaryPref(prefs::kContentSettingsPluginWhitelist, |
| 513 PrefService::SYNCABLE_PREF); | 511 PrefService::SYNCABLE_PREF); |
| 514 } | 512 } |
| OLD | NEW |