| 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 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 13 #include "base/memory/ref_counted_memory.h" | 13 #include "base/memory/ref_counted_memory.h" |
| 14 #include "base/memory/singleton.h" | 14 #include "base/memory/singleton.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
| 17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 18 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
| 19 #include "base/values.h" | 19 #include "base/values.h" |
| 20 #include "chrome/browser/content_settings/host_content_settings_map.h" | 20 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 21 #include "chrome/browser/plugin_prefs.h" | 21 #include "chrome/browser/plugin_prefs.h" |
| 22 #include "chrome/browser/prefs/scoped_user_pref_update.h" | |
| 23 #include "chrome/browser/prefs/pref_member.h" | 22 #include "chrome/browser/prefs/pref_member.h" |
| 24 #include "chrome/browser/prefs/pref_service.h" | 23 #include "chrome/browser/prefs/pref_service.h" |
| 24 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 25 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 26 #include "chrome/browser/ui/browser.h" | 26 #include "chrome/browser/ui/browser.h" |
| 27 #include "chrome/browser/ui/browser_window.h" | 27 #include "chrome/browser/ui/browser_window.h" |
| 28 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 28 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 29 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" | 29 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
| 30 #include "chrome/common/chrome_content_client.h" | 30 #include "chrome/common/chrome_content_client.h" |
| 31 #include "chrome/common/chrome_notification_types.h" | 31 #include "chrome/common/chrome_notification_types.h" |
| 32 #include "chrome/common/chrome_paths.h" | 32 #include "chrome/common/chrome_paths.h" |
| 33 #include "chrome/common/pref_names.h" | 33 #include "chrome/common/pref_names.h" |
| 34 #include "chrome/common/url_constants.h" | 34 #include "chrome/common/url_constants.h" |
| 35 #include "content/public/browser/notification_source.h" | 35 #include "content/public/browser/notification_source.h" |
| 36 #include "content/public/browser/plugin_service.h" | 36 #include "content/public/browser/plugin_service.h" |
| 37 #include "content/public/browser/web_contents.h" | 37 #include "content/public/browser/web_contents.h" |
| 38 #include "content/public/browser/web_ui.h" | 38 #include "content/public/browser/web_ui.h" |
| 39 #include "content/public/browser/web_ui_message_handler.h" | 39 #include "content/public/browser/web_ui_message_handler.h" |
| 40 #include "grit/browser_resources.h" | 40 #include "grit/browser_resources.h" |
| 41 #include "grit/generated_resources.h" | 41 #include "grit/generated_resources.h" |
| 42 #include "grit/theme_resources.h" | 42 #include "grit/theme_resources.h" |
| 43 #include "grit/theme_resources_standard.h" | 43 #include "grit/theme_resources_standard.h" |
| 44 #include "ui/base/l10n/l10n_util.h" | 44 #include "ui/base/l10n/l10n_util.h" |
| 45 #include "ui/base/layout.h" |
| 45 #include "ui/base/resource/resource_bundle.h" | 46 #include "ui/base/resource/resource_bundle.h" |
| 46 #include "webkit/plugins/npapi/plugin_group.h" | 47 #include "webkit/plugins/npapi/plugin_group.h" |
| 47 | 48 |
| 48 #if defined(OS_CHROMEOS) | 49 #if defined(OS_CHROMEOS) |
| 49 #include "chrome/browser/ui/webui/chromeos/ui_account_tweaks.h" | 50 #include "chrome/browser/ui/webui/chromeos/ui_account_tweaks.h" |
| 50 #endif | 51 #endif |
| 51 | 52 |
| 52 #if defined(ENABLE_PLUGIN_INSTALLATION) | 53 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 53 #include "chrome/browser/plugin_finder.h" | 54 #include "chrome/browser/plugin_finder.h" |
| 54 #include "chrome/browser/plugin_installer.h" | 55 #include "chrome/browser/plugin_installer.h" |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 web_ui->AddMessageHandler(new PluginsDOMHandler()); | 477 web_ui->AddMessageHandler(new PluginsDOMHandler()); |
| 477 | 478 |
| 478 // Set up the chrome://plugins/ source. | 479 // Set up the chrome://plugins/ source. |
| 479 Profile* profile = Profile::FromWebUI(web_ui); | 480 Profile* profile = Profile::FromWebUI(web_ui); |
| 480 ChromeURLDataManager::AddDataSource(profile, CreatePluginsUIHTMLSource()); | 481 ChromeURLDataManager::AddDataSource(profile, CreatePluginsUIHTMLSource()); |
| 481 } | 482 } |
| 482 | 483 |
| 483 // static | 484 // static |
| 484 base::RefCountedMemory* PluginsUI::GetFaviconResourceBytes() { | 485 base::RefCountedMemory* PluginsUI::GetFaviconResourceBytes() { |
| 485 return ResourceBundle::GetSharedInstance(). | 486 return ResourceBundle::GetSharedInstance(). |
| 486 LoadDataResourceBytes(IDR_PLUGIN); | 487 LoadDataResourceBytes(IDR_PLUGIN, ui::SCALE_FACTOR_100P); |
| 487 } | 488 } |
| 488 | 489 |
| 489 // static | 490 // static |
| 490 void PluginsUI::RegisterUserPrefs(PrefService* prefs) { | 491 void PluginsUI::RegisterUserPrefs(PrefService* prefs) { |
| 491 prefs->RegisterBooleanPref(prefs::kPluginsShowDetails, | 492 prefs->RegisterBooleanPref(prefs::kPluginsShowDetails, |
| 492 false, | 493 false, |
| 493 PrefService::UNSYNCABLE_PREF); | 494 PrefService::UNSYNCABLE_PREF); |
| 494 prefs->RegisterBooleanPref(prefs::kPluginsShowSetReaderDefaultInfobar, | 495 prefs->RegisterBooleanPref(prefs::kPluginsShowSetReaderDefaultInfobar, |
| 495 true, | 496 true, |
| 496 PrefService::UNSYNCABLE_PREF); | 497 PrefService::UNSYNCABLE_PREF); |
| 497 prefs->RegisterDictionaryPref(prefs::kContentSettingsPluginWhitelist, | 498 prefs->RegisterDictionaryPref(prefs::kContentSettingsPluginWhitelist, |
| 498 PrefService::SYNCABLE_PREF); | 499 PrefService::SYNCABLE_PREF); |
| 499 } | 500 } |
| OLD | NEW |