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

Side by Side Diff: chrome/browser/ui/webui/options2/core_options_handler2.cc

Issue 10387161: Pepper Flash settings integration: add UI for "deauthorize content licenses". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 7 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
« no previous file with comments | « chrome/browser/ui/webui/options2/core_options_handler2.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/options2/core_options_handler2.h" 5 #include "chrome/browser/ui/webui/options2/core_options_handler2.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 22 matching lines...) Expand all
33 33
34 namespace options2 { 34 namespace options2 {
35 35
36 CoreOptionsHandler::CoreOptionsHandler() 36 CoreOptionsHandler::CoreOptionsHandler()
37 : handlers_host_(NULL) { 37 : handlers_host_(NULL) {
38 } 38 }
39 39
40 CoreOptionsHandler::~CoreOptionsHandler() {} 40 CoreOptionsHandler::~CoreOptionsHandler() {}
41 41
42 void CoreOptionsHandler::InitializeHandler() { 42 void CoreOptionsHandler::InitializeHandler() {
43 clear_plugin_lso_data_enabled_.Init(prefs::kClearPluginLSODataEnabled, 43 plugin_status_pref_setter_.Init(Profile::FromWebUI(web_ui()), this);
44 Profile::FromWebUI(web_ui()),
45 this);
46 } 44 }
47 45
48 void CoreOptionsHandler::InitializePage() { 46 void CoreOptionsHandler::InitializePage() {
49 UpdateClearPluginLSOData(); 47 UpdateClearPluginLSOData();
48 UpdatePepperFlashSettingsEnabled();
50 } 49 }
51 50
52 void CoreOptionsHandler::GetLocalizedValues( 51 void CoreOptionsHandler::GetLocalizedValues(
53 DictionaryValue* localized_strings) { 52 DictionaryValue* localized_strings) {
54 GetStaticLocalizedValues(localized_strings); 53 GetStaticLocalizedValues(localized_strings);
55 } 54 }
56 55
57 void CoreOptionsHandler::GetStaticLocalizedValues( 56 void CoreOptionsHandler::GetStaticLocalizedValues(
58 base::DictionaryValue* localized_strings) { 57 base::DictionaryValue* localized_strings) {
59 DCHECK(localized_strings); 58 DCHECK(localized_strings);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 void CoreOptionsHandler::Observe(int type, 119 void CoreOptionsHandler::Observe(int type,
121 const content::NotificationSource& source, 120 const content::NotificationSource& source,
122 const content::NotificationDetails& details) { 121 const content::NotificationDetails& details) {
123 if (type == chrome::NOTIFICATION_PREF_CHANGED) { 122 if (type == chrome::NOTIFICATION_PREF_CHANGED) {
124 std::string* pref_name = content::Details<std::string>(details).ptr(); 123 std::string* pref_name = content::Details<std::string>(details).ptr();
125 if (*pref_name == prefs::kClearPluginLSODataEnabled) { 124 if (*pref_name == prefs::kClearPluginLSODataEnabled) {
126 // This preference is stored in Local State, not in the user preferences. 125 // This preference is stored in Local State, not in the user preferences.
127 UpdateClearPluginLSOData(); 126 UpdateClearPluginLSOData();
128 return; 127 return;
129 } 128 }
129 if (*pref_name == prefs::kPepperFlashSettingsEnabled) {
130 UpdatePepperFlashSettingsEnabled();
131 return;
132 }
130 NotifyPrefChanged(*pref_name, std::string()); 133 NotifyPrefChanged(*pref_name, std::string());
131 } 134 }
132 } 135 }
133 136
134 void CoreOptionsHandler::RegisterMessages() { 137 void CoreOptionsHandler::RegisterMessages() {
135 registrar_.Init(Profile::FromWebUI(web_ui())->GetPrefs()); 138 registrar_.Init(Profile::FromWebUI(web_ui())->GetPrefs());
136 139
137 web_ui()->RegisterMessageCallback("coreOptionsInitialize", 140 web_ui()->RegisterMessageCallback("coreOptionsInitialize",
138 base::Bind(&CoreOptionsHandler::HandleInitialize, 141 base::Bind(&CoreOptionsHandler::HandleInitialize,
139 base::Unretained(this))); 142 base::Unretained(this)));
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 460
458 void CoreOptionsHandler::HandleUserMetricsAction(const ListValue* args) { 461 void CoreOptionsHandler::HandleUserMetricsAction(const ListValue* args) {
459 std::string metric = UTF16ToUTF8(ExtractStringValue(args)); 462 std::string metric = UTF16ToUTF8(ExtractStringValue(args));
460 if (!metric.empty()) 463 if (!metric.empty())
461 content::RecordComputedAction(metric); 464 content::RecordComputedAction(metric);
462 } 465 }
463 466
464 void CoreOptionsHandler::UpdateClearPluginLSOData() { 467 void CoreOptionsHandler::UpdateClearPluginLSOData() {
465 scoped_ptr<base::Value> enabled( 468 scoped_ptr<base::Value> enabled(
466 base::Value::CreateBooleanValue( 469 base::Value::CreateBooleanValue(
467 clear_plugin_lso_data_enabled_.GetValue())); 470 plugin_status_pref_setter_.IsClearPluginLSODataEnabled()));
468 web_ui()->CallJavascriptFunction( 471 web_ui()->CallJavascriptFunction(
469 "OptionsPage.setClearPluginLSODataEnabled", *enabled); 472 "OptionsPage.setClearPluginLSODataEnabled", *enabled);
470 } 473 }
471 474
475 void CoreOptionsHandler::UpdatePepperFlashSettingsEnabled() {
476 scoped_ptr<base::Value> enabled(
477 base::Value::CreateBooleanValue(
478 plugin_status_pref_setter_.IsPepperFlashSettingsEnabled()));
479 web_ui()->CallJavascriptFunction(
480 "OptionsPage.setPepperFlashSettingsEnabled", *enabled);
481 }
482
472 } // namespace options2 483 } // namespace options2
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options2/core_options_handler2.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698