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

Unified Diff: chrome/browser/ui/webui/chromeos/mobile_setup_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/chromeos/mobile_setup_ui.cc
===================================================================
--- chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc (revision 176942)
+++ chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc (working copy)
@@ -25,14 +25,14 @@
#include "chrome/browser/chromeos/mobile/mobile_activator.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_list.h"
-#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
+#include "chrome/browser/ui/webui/web_ui_util.h"
#include "chrome/common/jstemplate_builder.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_view_host_observer.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_ui.h"
#include "content/public/browser/web_ui_message_handler.h"
@@ -114,15 +114,16 @@
DISALLOW_COPY_AND_ASSIGN(PortalFrameLoadObserver);
};
-class MobileSetupUIHTMLSource : public content::URLDataSourceDelegate {
+class MobileSetupUIHTMLSource : public content::URLDataSource {
public:
MobileSetupUIHTMLSource();
- // 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 {
return "text/html";
}
@@ -179,16 +180,17 @@
return chrome::kChromeUIMobileSetupHost;
}
-void MobileSetupUIHTMLSource::StartDataRequest(const std::string& path,
- bool is_incognito,
- int request_id) {
+void MobileSetupUIHTMLSource::StartDataRequest(
+ const std::string& path,
+ bool is_incognito,
+ const content::URLDataSource::GotDataCallback& callback) {
CellularNetwork* network = !path.size() ? NULL :
CrosLibrary::Get()->
GetNetworkLibrary()->FindCellularNetworkByPath(path);
if (!network || !network->SupportsActivation()) {
LOG(WARNING) << "Can't find device to activate for service path " << path;
scoped_refptr<base::RefCountedBytes> html_bytes(new base::RefCountedBytes);
- url_data_source()->SendResponse(request_id, html_bytes);
+ callback.Run(html_bytes);
return;
}
@@ -214,7 +216,7 @@
l10n_util::GetStringUTF16(IDS_CANCEL));
strings.SetString("ok_button",
l10n_util::GetStringUTF16(IDS_OK));
- URLDataSource::SetFontAndTextDirection(&strings);
+ web_ui_util::SetFontAndTextDirection(&strings);
static const base::StringPiece html(
ResourceBundle::GetSharedInstance().GetRawDataResource(
@@ -223,8 +225,7 @@
std::string full_html = jstemplate_builder::GetI18nTemplateHtml(html,
&strings);
- url_data_source()->SendResponse(
- request_id, base::RefCountedString::TakeString(&full_html));
+ callback.Run(base::RefCountedString::TakeString(&full_html));
}
////////////////////////////////////////////////////////////////////////////////

Powered by Google App Engine
This is Rietveld 408576698