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

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

Issue 8520016: Complete the rename from about:tracking2 --> about:profiler by changing the implementation code t... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: try synching again... Created 9 years, 1 month 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
« no previous file with comments | « chrome/browser/ui/webui/profiler_ui.h ('k') | chrome/browser/ui/webui/tracking_ui.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/profiler_ui.cc
===================================================================
--- chrome/browser/ui/webui/profiler_ui.cc (revision 110116)
+++ chrome/browser/ui/webui/profiler_ui.cc (working copy)
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/webui/tracking_ui.h"
+#include "chrome/browser/ui/webui/profiler_ui.h"
#include <string>
@@ -38,10 +38,10 @@
#ifdef USE_SOURCE_FILES_DIRECTLY
-class TrackingWebUIDataSource : public ChromeURLDataManager::DataSource {
+class ProfilerWebUIDataSource : public ChromeURLDataManager::DataSource {
public:
- TrackingWebUIDataSource()
- : DataSource(chrome::kChromeUITrackingHost2, MessageLoop::current()) {
+ ProfilerWebUIDataSource()
+ : DataSource(chrome::kChromeUIProfilerHost, MessageLoop::current()) {
}
protected:
@@ -61,8 +61,8 @@
base_path = base_path.AppendASCII("browser");
base_path = base_path.AppendASCII("resources");
- // If no resource was specified, default to tracking.html.
- std::string filename = path.empty() ? "tracking.html" : path;
+ // If no resource was specified, default to profiler.html.
+ std::string filename = path.empty() ? "profiler.html" : path;
FilePath file_path;
file_path = base_path.AppendASCII(filename);
@@ -79,24 +79,22 @@
}
private:
- DISALLOW_COPY_AND_ASSIGN(TrackingWebUIDataSource);
+ DISALLOW_COPY_AND_ASSIGN(ProfilerWebUIDataSource);
};
-ChromeURLDataManager::DataSource* CreateTrackingHTMLSource() {
- return new TrackingWebUIDataSource();
+ChromeURLDataManager::DataSource* CreateProfilerHTMLSource() {
+ return new ProfilerWebUIDataSource();
}
#else // USE_SOURCE_FILES_DIRECTLY
-ChromeWebUIDataSource* CreateTrackingHTMLSource() {
- // TODO(eroman): Use kChromeUITrackingHost instead of kChromeUITrackingHost2
- // once migration to webui is complete.
+ChromeWebUIDataSource* CreateProfilerHTMLSource() {
ChromeWebUIDataSource* source =
- new ChromeWebUIDataSource(chrome::kChromeUITrackingHost2);
+ new ChromeWebUIDataSource(chrome::kChromeUIProfilerHost);
source->set_json_path("strings.js");
- source->add_resource_path("tracking.js", IDR_TRACKING_JS);
- source->set_default_resource(IDR_TRACKING_HTML);
+ source->add_resource_path("profiler.js", IDR_PROFILER_JS);
+ source->set_default_resource(IDR_PROFILER_HTML);
return source;
}
@@ -105,9 +103,9 @@
// This class receives javascript messages from the renderer.
// Note that the WebUI infrastructure runs on the UI thread, therefore all of
// this class's methods are expected to run on the UI thread.
-class TrackingMessageHandler : public WebUIMessageHandler {
+class ProfilerMessageHandler : public WebUIMessageHandler {
public:
- TrackingMessageHandler() {}
+ ProfilerMessageHandler() {}
// WebUIMessageHandler implementation.
virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
@@ -118,55 +116,55 @@
void OnResetData(const ListValue* list);
private:
- DISALLOW_COPY_AND_ASSIGN(TrackingMessageHandler);
+ DISALLOW_COPY_AND_ASSIGN(ProfilerMessageHandler);
};
-WebUIMessageHandler* TrackingMessageHandler::Attach(WebUI* web_ui) {
+WebUIMessageHandler* ProfilerMessageHandler::Attach(WebUI* web_ui) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
WebUIMessageHandler* result = WebUIMessageHandler::Attach(web_ui);
return result;
}
-void TrackingMessageHandler::RegisterMessages() {
+void ProfilerMessageHandler::RegisterMessages() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
web_ui_->RegisterMessageCallback("getData",
- base::Bind(&TrackingMessageHandler::OnGetData,base::Unretained(this)));
+ base::Bind(&ProfilerMessageHandler::OnGetData,base::Unretained(this)));
web_ui_->RegisterMessageCallback("resetData",
- base::Bind(&TrackingMessageHandler::OnResetData,
+ base::Bind(&ProfilerMessageHandler::OnResetData,
base::Unretained(this)));
}
-void TrackingMessageHandler::OnGetData(const ListValue* list) {
- TrackingUI* tracking_ui = reinterpret_cast<TrackingUI*>(web_ui_);
- tracking_ui->GetData();
+void ProfilerMessageHandler::OnGetData(const ListValue* list) {
+ ProfilerUI* profiler_ui = reinterpret_cast<ProfilerUI*>(web_ui_);
+ profiler_ui->GetData();
}
-void TrackingMessageHandler::OnResetData(const ListValue* list) {
+void ProfilerMessageHandler::OnResetData(const ListValue* list) {
tracked_objects::ThreadData::ResetAllThreadData();
}
} // namespace
-TrackingUI::TrackingUI(TabContents* contents) : ChromeWebUI(contents) {
- ui_weak_ptr_factory_.reset(new base::WeakPtrFactory<TrackingUI>(this));
+ProfilerUI::ProfilerUI(TabContents* contents) : ChromeWebUI(contents) {
+ ui_weak_ptr_factory_.reset(new base::WeakPtrFactory<ProfilerUI>(this));
ui_weak_ptr_ = ui_weak_ptr_factory_->GetWeakPtr();
- AddMessageHandler((new TrackingMessageHandler())->Attach(this));
+ AddMessageHandler((new ProfilerMessageHandler())->Attach(this));
- // Set up the chrome://tracking2/ source.
+ // Set up the chrome://profiler/ source.
Profile::FromBrowserContext(contents->browser_context())->
- GetChromeURLDataManager()->AddDataSource(CreateTrackingHTMLSource());
+ GetChromeURLDataManager()->AddDataSource(CreateProfilerHTMLSource());
}
-TrackingUI::~TrackingUI() {
+ProfilerUI::~ProfilerUI() {
}
-void TrackingUI::GetData() {
+void ProfilerUI::GetData() {
TrackingSynchronizer::FetchTrackingDataAsynchronously(ui_weak_ptr_);
}
-void TrackingUI::ReceivedData(base::Value* value) {
+void ProfilerUI::ReceivedData(base::Value* value) {
// Send the data to the renderer.
scoped_ptr<Value> data_values(value);
CallJavascriptFunction("g_browserBridge.receivedData", *data_values.get());
« no previous file with comments | « chrome/browser/ui/webui/profiler_ui.h ('k') | chrome/browser/ui/webui/tracking_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698