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

Side by Side Diff: chrome/browser/ui/webui/profiler_ui.cc

Issue 9188056: Start splitting out WebUI into an implementation class and an interface that each page implements... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/webui/profiler_ui.h ('k') | chrome/browser/ui/webui/quota_internals_ui.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/profiler_ui.h" 5 #include "chrome/browser/ui/webui/profiler_ui.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 // When testing the javacript code, it is cumbersome to have to keep 9 // When testing the javacript code, it is cumbersome to have to keep
10 // re-building the resouces package and reloading the browser. To solve 10 // re-building the resouces package and reloading the browser. To solve
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 ProfilerUI* profiler_ui = reinterpret_cast<ProfilerUI*>(web_ui()); 137 ProfilerUI* profiler_ui = reinterpret_cast<ProfilerUI*>(web_ui());
138 profiler_ui->GetData(); 138 profiler_ui->GetData();
139 } 139 }
140 140
141 void ProfilerMessageHandler::OnResetData(const ListValue* list) { 141 void ProfilerMessageHandler::OnResetData(const ListValue* list) {
142 tracked_objects::ThreadData::ResetAllThreadData(); 142 tracked_objects::ThreadData::ResetAllThreadData();
143 } 143 }
144 144
145 } // namespace 145 } // namespace
146 146
147 ProfilerUI::ProfilerUI(WebContents* contents) : WebUI(contents) { 147 ProfilerUI::ProfilerUI(WebContents* contents) : WebUI(contents, this) {
148 ui_weak_ptr_factory_.reset(new base::WeakPtrFactory<ProfilerUI>(this)); 148 ui_weak_ptr_factory_.reset(new base::WeakPtrFactory<ProfilerUI>(this));
149 ui_weak_ptr_ = ui_weak_ptr_factory_->GetWeakPtr(); 149 ui_weak_ptr_ = ui_weak_ptr_factory_->GetWeakPtr();
150 150
151 AddMessageHandler(new ProfilerMessageHandler()); 151 AddMessageHandler(new ProfilerMessageHandler());
152 152
153 // Set up the chrome://profiler/ source. 153 // Set up the chrome://profiler/ source.
154 Profile::FromBrowserContext(contents->GetBrowserContext())-> 154 Profile::FromBrowserContext(contents->GetBrowserContext())->
155 GetChromeURLDataManager()->AddDataSource(CreateProfilerHTMLSource()); 155 GetChromeURLDataManager()->AddDataSource(CreateProfilerHTMLSource());
156 } 156 }
157 157
158 ProfilerUI::~ProfilerUI() { 158 ProfilerUI::~ProfilerUI() {
159 } 159 }
160 160
161 void ProfilerUI::GetData() { 161 void ProfilerUI::GetData() {
162 TrackingSynchronizer::FetchProfilerDataAsynchronously(ui_weak_ptr_); 162 TrackingSynchronizer::FetchProfilerDataAsynchronously(ui_weak_ptr_);
163 } 163 }
164 164
165 void ProfilerUI::ReceivedData(base::Value* value) { 165 void ProfilerUI::ReceivedData(base::Value* value) {
166 // Send the data to the renderer. 166 // Send the data to the renderer.
167 scoped_ptr<Value> data_values(value); 167 scoped_ptr<Value> data_values(value);
168 CallJavascriptFunction("g_browserBridge.receivedData", *data_values.get()); 168 CallJavascriptFunction("g_browserBridge.receivedData", *data_values.get());
169 } 169 }
170 170
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/profiler_ui.h ('k') | chrome/browser/ui/webui/quota_internals_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698