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/plugins_ui.h" | 5 #include "chrome/browser/ui/webui/plugins/plugins_ui.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 source->AddLocalizedString("enable", IDS_PLUGINS_ENABLE); | 62 source->AddLocalizedString("enable", IDS_PLUGINS_ENABLE); |
63 source->AddLocalizedString("alwaysAllowed", IDS_PLUGINS_ALWAYS_ALLOWED); | 63 source->AddLocalizedString("alwaysAllowed", IDS_PLUGINS_ALWAYS_ALLOWED); |
64 source->AddLocalizedString("noPlugins", IDS_PLUGINS_NO_PLUGINS); | 64 source->AddLocalizedString("noPlugins", IDS_PLUGINS_NO_PLUGINS); |
65 | 65 |
66 source->SetJsonPath("strings.js"); | 66 source->SetJsonPath("strings.js"); |
67 source->AddResourcePath("plugins.js", IDR_PLUGINS_JS); | 67 source->AddResourcePath("plugins.js", IDR_PLUGINS_JS); |
68 source->SetDefaultResource(IDR_PLUGINS_HTML); | 68 source->SetDefaultResource(IDR_PLUGINS_HTML); |
69 #if defined(OS_CHROMEOS) | 69 #if defined(OS_CHROMEOS) |
70 chromeos::AddAccountUITweaksLocalizedValues(source, profile); | 70 chromeos::AddAccountUITweaksLocalizedValues(source, profile); |
71 #endif | 71 #endif |
| 72 source->AddResourcePath("chrome/browser/ui/webui/plugins/plugins.mojom", |
| 73 IDR_PLUGINS_MOJO_JS); |
| 74 |
72 return source; | 75 return source; |
73 } | 76 } |
74 | 77 |
75 } // namespace | 78 } // namespace |
76 | 79 |
77 | 80 PluginsUI::PluginsUI(content::WebUI* web_ui) : MojoWebUIController(web_ui) { |
78 PluginsUI::PluginsUI(content::WebUI* web_ui) : WebUIController(web_ui) { | |
79 web_ui->AddMessageHandler(new PluginsHandler()); | |
80 | |
81 // Set up the chrome://plugins/ source. | 81 // Set up the chrome://plugins/ source. |
82 Profile* profile = Profile::FromWebUI(web_ui); | 82 Profile* profile = Profile::FromWebUI(web_ui); |
83 content::WebUIDataSource::Add(profile, CreatePluginsUIHTMLSource(profile)); | 83 content::WebUIDataSource::Add(profile, CreatePluginsUIHTMLSource(profile)); |
84 } | 84 } |
85 | 85 |
| 86 PluginsUI::~PluginsUI() {} |
| 87 |
86 // static | 88 // static |
87 base::RefCountedMemory* PluginsUI::GetFaviconResourceBytes( | 89 base::RefCountedMemory* PluginsUI::GetFaviconResourceBytes( |
88 ui::ScaleFactor scale_factor) { | 90 ui::ScaleFactor scale_factor) { |
89 return ResourceBundle::GetSharedInstance(). | 91 return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( |
90 LoadDataResourceBytesForScale(IDR_PLUGINS_FAVICON, scale_factor); | 92 IDR_PLUGINS_FAVICON, scale_factor); |
91 } | 93 } |
92 | 94 |
93 // static | 95 // static |
94 void PluginsUI::RegisterProfilePrefs( | 96 void PluginsUI::RegisterProfilePrefs( |
95 user_prefs::PrefRegistrySyncable* registry) { | 97 user_prefs::PrefRegistrySyncable* registry) { |
96 registry->RegisterBooleanPref(prefs::kPluginsShowDetails, false); | 98 registry->RegisterBooleanPref(prefs::kPluginsShowDetails, false); |
97 registry->RegisterDictionaryPref( | 99 registry->RegisterDictionaryPref( |
98 prefs::kContentSettingsPluginWhitelist, | 100 prefs::kContentSettingsPluginWhitelist, |
99 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 101 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
100 } | 102 } |
| 103 |
| 104 void PluginsUI::BindUIHandler( |
| 105 mojo::InterfaceRequest<PluginsHandlerMojo> request) { |
| 106 plugins_handler_.reset(new PluginsHandler(web_ui(), std::move(request))); |
| 107 } |
OLD | NEW |