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

Unified Diff: chrome/browser/ui/webui/options/options_ui.cc

Issue 11881055: Simplify WebUI data sources. Currently WebUI data sources implement a URLDataSourceDelegate interfa… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix issue in about_ui exposed by cros tests Created 7 years, 11 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/options/options_ui.cc
===================================================================
--- chrome/browser/ui/webui/options/options_ui.cc (revision 176942)
+++ chrome/browser/ui/webui/options/options_ui.cc (working copy)
@@ -22,7 +22,6 @@
#include "chrome/browser/browser_about_handler.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
#include "chrome/browser/ui/webui/options/autofill_options_handler.h"
#include "chrome/browser/ui/webui/options/browser_options_handler.h"
#include "chrome/browser/ui/webui/options/clear_browser_data_handler.h"
@@ -44,12 +43,13 @@
#include "chrome/browser/ui/webui/options/search_engine_manager_handler.h"
#include "chrome/browser/ui/webui/options/startup_pages_handler.h"
#include "chrome/browser/ui/webui/theme_source.h"
+#include "chrome/browser/ui/webui/web_ui_util.h"
#include "chrome/common/jstemplate_builder.h"
#include "chrome/common/time_format.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/notification_types.h"
#include "content/public/browser/render_view_host.h"
-#include "content/public/browser/url_data_source_delegate.h"
+#include "content/public/browser/url_data_source.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_ui.h"
@@ -102,16 +102,17 @@
//
////////////////////////////////////////////////////////////////////////////////
-class OptionsUIHTMLSource : public content::URLDataSourceDelegate {
+class OptionsUIHTMLSource : public content::URLDataSource {
public:
// The constructor takes over ownership of |localized_strings|.
explicit OptionsUIHTMLSource(DictionaryValue* localized_strings);
- // content::URLDataSourceDelegate implementation.
+ // content::URLDataSource implementation.
virtual std::string GetSource() OVERRIDE;
- virtual void StartDataRequest(const std::string& path,
- bool is_incognito,
- int request_id);
+ virtual void StartDataRequest(
+ const std::string& path,
+ bool is_incognito,
+ const content::URLDataSource::GotDataCallback& callback);
virtual std::string GetMimeType(const std::string&) const;
private:
@@ -132,11 +133,12 @@
return chrome::kChromeUISettingsFrameHost;
}
-void OptionsUIHTMLSource::StartDataRequest(const std::string& path,
- bool is_incognito,
- int request_id) {
+void OptionsUIHTMLSource::StartDataRequest(
+ const std::string& path,
+ bool is_incognito,
+ const content::URLDataSource::GotDataCallback& callback) {
scoped_refptr<base::RefCountedMemory> response_bytes;
- URLDataSource::SetFontAndTextDirection(localized_strings_.get());
+ web_ui_util::SetFontAndTextDirection(localized_strings_.get());
if (path == kLocalizedStringsFile) {
// Return dynamically-generated strings from memory.
@@ -154,7 +156,7 @@
LoadDataResourceBytes(IDR_OPTIONS_HTML);
}
- url_data_source()->SendResponse(request_id, response_bytes);
+ callback.Run(response_bytes);
}
std::string OptionsUIHTMLSource::GetMimeType(const std::string& path) const {

Powered by Google App Engine
This is Rietveld 408576698