Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(659)

Side by Side Diff: chrome/browser/ui/webui/plugins_ui.cc

Issue 144983002: Fixed chrome://settings/accounts availability for MP. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed proxy_settings_ui. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 using content::WebPluginInfo; 55 using content::WebPluginInfo;
56 using content::WebUIMessageHandler; 56 using content::WebUIMessageHandler;
57 57
58 namespace { 58 namespace {
59 59
60 // Callback function to process result of EnablePlugin method. 60 // Callback function to process result of EnablePlugin method.
61 void AssertPluginEnabled(bool did_enable) { 61 void AssertPluginEnabled(bool did_enable) {
62 DCHECK(did_enable); 62 DCHECK(did_enable);
63 } 63 }
64 64
65 content::WebUIDataSource* CreatePluginsUIHTMLSource() { 65 content::WebUIDataSource* CreatePluginsUIHTMLSource(Profile* profile) {
66 content::WebUIDataSource* source = 66 content::WebUIDataSource* source =
67 content::WebUIDataSource::Create(chrome::kChromeUIPluginsHost); 67 content::WebUIDataSource::Create(chrome::kChromeUIPluginsHost);
68 source->SetUseJsonJSFormatV2(); 68 source->SetUseJsonJSFormatV2();
69 69
70 source->AddLocalizedString("pluginsTitle", IDS_PLUGINS_TITLE); 70 source->AddLocalizedString("pluginsTitle", IDS_PLUGINS_TITLE);
71 source->AddLocalizedString("pluginsDetailsModeLink", 71 source->AddLocalizedString("pluginsDetailsModeLink",
72 IDS_PLUGINS_DETAILS_MODE_LINK); 72 IDS_PLUGINS_DETAILS_MODE_LINK);
73 source->AddLocalizedString("pluginsNoneInstalled", 73 source->AddLocalizedString("pluginsNoneInstalled",
74 IDS_PLUGINS_NONE_INSTALLED); 74 IDS_PLUGINS_NONE_INSTALLED);
75 source->AddLocalizedString("pluginDisabled", IDS_PLUGINS_DISABLED_PLUGIN); 75 source->AddLocalizedString("pluginDisabled", IDS_PLUGINS_DISABLED_PLUGIN);
(...skipping 18 matching lines...) Expand all
94 IDS_PLUGINS_MIME_TYPES_FILE_EXTENSIONS); 94 IDS_PLUGINS_MIME_TYPES_FILE_EXTENSIONS);
95 source->AddLocalizedString("disable", IDS_PLUGINS_DISABLE); 95 source->AddLocalizedString("disable", IDS_PLUGINS_DISABLE);
96 source->AddLocalizedString("enable", IDS_PLUGINS_ENABLE); 96 source->AddLocalizedString("enable", IDS_PLUGINS_ENABLE);
97 source->AddLocalizedString("alwaysAllowed", IDS_PLUGINS_ALWAYS_ALLOWED); 97 source->AddLocalizedString("alwaysAllowed", IDS_PLUGINS_ALWAYS_ALLOWED);
98 source->AddLocalizedString("noPlugins", IDS_PLUGINS_NO_PLUGINS); 98 source->AddLocalizedString("noPlugins", IDS_PLUGINS_NO_PLUGINS);
99 99
100 source->SetJsonPath("strings.js"); 100 source->SetJsonPath("strings.js");
101 source->AddResourcePath("plugins.js", IDR_PLUGINS_JS); 101 source->AddResourcePath("plugins.js", IDR_PLUGINS_JS);
102 source->SetDefaultResource(IDR_PLUGINS_HTML); 102 source->SetDefaultResource(IDR_PLUGINS_HTML);
103 #if defined(OS_CHROMEOS) 103 #if defined(OS_CHROMEOS)
104 chromeos::AddAccountUITweaksLocalizedValues(source); 104 chromeos::AddAccountUITweaksLocalizedValues(source, profile);
105 #endif 105 #endif
106 return source; 106 return source;
107 } 107 }
108 108
109 base::string16 PluginTypeToString(int type) { 109 base::string16 PluginTypeToString(int type) {
110 // The type is stored as an |int|, but doing the switch on the right 110 // The type is stored as an |int|, but doing the switch on the right
111 // enumeration type gives us better build-time error checking (if someone adds 111 // enumeration type gives us better build-time error checking (if someone adds
112 // a new type). 112 // a new type).
113 switch (static_cast<WebPluginInfo::PluginType>(type)) { 113 switch (static_cast<WebPluginInfo::PluginType>(type)) {
114 case WebPluginInfo::PLUGIN_TYPE_NPAPI: 114 case WebPluginInfo::PLUGIN_TYPE_NPAPI:
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 // 478 //
479 // PluginsUI 479 // PluginsUI
480 // 480 //
481 /////////////////////////////////////////////////////////////////////////////// 481 ///////////////////////////////////////////////////////////////////////////////
482 482
483 PluginsUI::PluginsUI(content::WebUI* web_ui) : WebUIController(web_ui) { 483 PluginsUI::PluginsUI(content::WebUI* web_ui) : WebUIController(web_ui) {
484 web_ui->AddMessageHandler(new PluginsDOMHandler()); 484 web_ui->AddMessageHandler(new PluginsDOMHandler());
485 485
486 // Set up the chrome://plugins/ source. 486 // Set up the chrome://plugins/ source.
487 Profile* profile = Profile::FromWebUI(web_ui); 487 Profile* profile = Profile::FromWebUI(web_ui);
488 content::WebUIDataSource::Add(profile, CreatePluginsUIHTMLSource()); 488 content::WebUIDataSource::Add(profile, CreatePluginsUIHTMLSource(profile));
489 } 489 }
490 490
491 // static 491 // static
492 base::RefCountedMemory* PluginsUI::GetFaviconResourceBytes( 492 base::RefCountedMemory* PluginsUI::GetFaviconResourceBytes(
493 ui::ScaleFactor scale_factor) { 493 ui::ScaleFactor scale_factor) {
494 return ResourceBundle::GetSharedInstance(). 494 return ResourceBundle::GetSharedInstance().
495 LoadDataResourceBytesForScale(IDR_PLUGINS_FAVICON, scale_factor); 495 LoadDataResourceBytesForScale(IDR_PLUGINS_FAVICON, scale_factor);
496 } 496 }
497 497
498 // static 498 // static
499 void PluginsUI::RegisterProfilePrefs( 499 void PluginsUI::RegisterProfilePrefs(
500 user_prefs::PrefRegistrySyncable* registry) { 500 user_prefs::PrefRegistrySyncable* registry) {
501 registry->RegisterBooleanPref( 501 registry->RegisterBooleanPref(
502 prefs::kPluginsShowDetails, 502 prefs::kPluginsShowDetails,
503 false, 503 false,
504 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 504 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
505 registry->RegisterDictionaryPref( 505 registry->RegisterDictionaryPref(
506 prefs::kContentSettingsPluginWhitelist, 506 prefs::kContentSettingsPluginWhitelist,
507 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); 507 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
508 } 508 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698