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 |
| 73 source->AddResourcePath( |
| 74 "chrome/browser/ui/webui/plugins/plugins.mojom", IDR_PLUGINS_MOJO_JS); |
| 75 source->AddMojoResources(); |
| 76 |
72 return source; | 77 return source; |
73 } | 78 } |
74 | 79 |
75 } // namespace | 80 } // namespace |
76 | 81 |
77 | 82 |
78 PluginsUI::PluginsUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 83 PluginsUI::PluginsUI(content::WebUI* web_ui) : MojoWebUIController(web_ui) { |
79 web_ui->AddMessageHandler(new PluginsHandler()); | 84 LOG(ERROR) << "PluginsUI"; |
80 | |
81 // Set up the chrome://plugins/ source. | 85 // Set up the chrome://plugins/ source. |
82 Profile* profile = Profile::FromWebUI(web_ui); | 86 Profile* profile = Profile::FromWebUI(web_ui); |
83 content::WebUIDataSource::Add(profile, CreatePluginsUIHTMLSource(profile)); | 87 content::WebUIDataSource::Add(profile, CreatePluginsUIHTMLSource(profile)); |
84 } | 88 } |
85 | 89 |
| 90 PluginsUI::~PluginsUI() {} |
| 91 |
86 // static | 92 // static |
87 base::RefCountedMemory* PluginsUI::GetFaviconResourceBytes( | 93 base::RefCountedMemory* PluginsUI::GetFaviconResourceBytes( |
88 ui::ScaleFactor scale_factor) { | 94 ui::ScaleFactor scale_factor) { |
89 return ResourceBundle::GetSharedInstance(). | 95 return ResourceBundle::GetSharedInstance(). |
90 LoadDataResourceBytesForScale(IDR_PLUGINS_FAVICON, scale_factor); | 96 LoadDataResourceBytesForScale(IDR_PLUGINS_FAVICON, scale_factor); |
91 } | 97 } |
92 | 98 |
93 // static | 99 // static |
94 void PluginsUI::RegisterProfilePrefs( | 100 void PluginsUI::RegisterProfilePrefs( |
95 user_prefs::PrefRegistrySyncable* registry) { | 101 user_prefs::PrefRegistrySyncable* registry) { |
96 registry->RegisterBooleanPref(prefs::kPluginsShowDetails, false); | 102 registry->RegisterBooleanPref(prefs::kPluginsShowDetails, false); |
97 registry->RegisterDictionaryPref( | 103 registry->RegisterDictionaryPref( |
98 prefs::kContentSettingsPluginWhitelist, | 104 prefs::kContentSettingsPluginWhitelist, |
99 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 105 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
100 } | 106 } |
| 107 |
| 108 void PluginsUI::BindUIHandler( |
| 109 mojo::InterfaceRequest<PluginsHandlerMojo> request) { |
| 110 // PluginsHandler deletes itself when the pipe is closed. |
| 111 LOG(ERROR) << "bindUIHandler"; |
| 112 plugins_handler_.reset(new PluginsHandler(web_ui(), std::move(request))); |
| 113 } |
OLD | NEW |