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

Unified Diff: chrome/browser/ui/webui/md_settings_ui.cc

Issue 1019403002: Fetch and actually set prefs (using chrome.send for now). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: One more round of michael comments. Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/md_settings_ui.cc
diff --git a/chrome/browser/ui/webui/md_settings_ui.cc b/chrome/browser/ui/webui/md_settings_ui.cc
index 4c24d7f1a275d82fb57f36fbeabfc4585cb0bd25..2f7e40ac873a85e5d3e560a146e2c49377309931 100644
--- a/chrome/browser/ui/webui/md_settings_ui.cc
+++ b/chrome/browser/ui/webui/md_settings_ui.cc
@@ -7,6 +7,8 @@
#include <string>
#include "base/values.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/webui/options/core_options_handler.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/generated_resources.h"
#include "content/public/browser/web_contents.h"
@@ -16,8 +18,24 @@
#include "grit/settings_resources.h"
#include "grit/settings_resources_map.h"
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.h"
+#endif
+
MdSettingsUI::MdSettingsUI(content::WebUI* web_ui)
: content::WebUIController(web_ui) {
+ // TODO(jlklein): Remove handler logic once settingsPrivate is ready.
+#if defined(OS_CHROMEOS)
+ core_handler_ = new chromeos::options::CoreChromeOSOptionsHandler();
+#else
+ core_handler_ = new options::CoreOptionsHandler();
+#endif
+
+ core_handler_->set_handlers_host(this);
+ scoped_ptr<options::OptionsPageUIHandler> handler(core_handler_);
+ if (handler->IsEnabled())
+ web_ui->AddMessageHandler(handler.release());
+
content::WebUIDataSource* html_source =
content::WebUIDataSource::Create(chrome::kChromeUIMdSettingsHost);
@@ -36,3 +54,11 @@ MdSettingsUI::MdSettingsUI(content::WebUI* web_ui)
MdSettingsUI::~MdSettingsUI() {
}
+
+void MdSettingsUI::InitializeHandlers() {
+ Profile* profile = Profile::FromWebUI(web_ui());
+ DCHECK(!profile->IsOffTheRecord() || profile->IsGuestSession());
Oren Blasberg 2015/03/20 01:06:53 should this be !profile->IsGuestSession() ?
Jeremy Klein 2015/03/20 01:11:05 Nah guest sessions are ok for settings.
michaelpg 2015/03/20 02:34:28 Yep. Incognito profiles are OK if you're in guest
+
+ core_handler_->InitializeHandler();
+ core_handler_->InitializePage();
+}

Powered by Google App Engine
This is Rietveld 408576698