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

Side by Side Diff: chrome/browser/dom_ui/net_internals_ui.cc

Issue 6480046: WebUI: Change more references to WebUI in dom_ui directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 10 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 | « no previous file | chrome/browser/dom_ui/settings_browsertest.cc » ('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/dom_ui/net_internals_ui.h" 5 #include "chrome/browser/dom_ui/net_internals_ui.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // This is the "real" message handler, which lives on the IO thread. 190 // This is the "real" message handler, which lives on the IO thread.
191 scoped_refptr<IOThreadImpl> proxy_; 191 scoped_refptr<IOThreadImpl> proxy_;
192 192
193 // Used for loading log files. 193 // Used for loading log files.
194 scoped_refptr<SelectFileDialog> select_log_file_dialog_; 194 scoped_refptr<SelectFileDialog> select_log_file_dialog_;
195 195
196 DISALLOW_COPY_AND_ASSIGN(NetInternalsMessageHandler); 196 DISALLOW_COPY_AND_ASSIGN(NetInternalsMessageHandler);
197 }; 197 };
198 198
199 // This class is the "real" message handler. It is allocated and destroyed on 199 // This class is the "real" message handler. It is allocated and destroyed on
200 // the UI thread. With the exception of OnAddEntry, OnDOMUIDeleted, and 200 // the UI thread. With the exception of OnAddEntry, OnWebUIDeleted, and
201 // CallJavascriptFunction, its methods are all expected to be called from the IO 201 // CallJavascriptFunction, its methods are all expected to be called from the IO
202 // thread. OnAddEntry and CallJavascriptFunction can be called from any thread, 202 // thread. OnAddEntry and CallJavascriptFunction can be called from any thread,
203 // and OnDOMUIDeleted can only be called from the UI thread. 203 // and OnWebUIDeleted can only be called from the UI thread.
204 class NetInternalsMessageHandler::IOThreadImpl 204 class NetInternalsMessageHandler::IOThreadImpl
205 : public base::RefCountedThreadSafe< 205 : public base::RefCountedThreadSafe<
206 NetInternalsMessageHandler::IOThreadImpl, 206 NetInternalsMessageHandler::IOThreadImpl,
207 BrowserThread::DeleteOnUIThread>, 207 BrowserThread::DeleteOnUIThread>,
208 public ChromeNetLog::ThreadSafeObserver, 208 public ChromeNetLog::ThreadSafeObserver,
209 public ConnectionTester::Delegate { 209 public ConnectionTester::Delegate {
210 public: 210 public:
211 // Type for methods that can be used as MessageHandler callbacks. 211 // Type for methods that can be used as MessageHandler callbacks.
212 typedef void (IOThreadImpl::*MessageHandler)(const ListValue*); 212 typedef void (IOThreadImpl::*MessageHandler)(const ListValue*);
213 213
(...skipping 18 matching lines...) Expand all
232 // Called once the WebUI has been deleted (i.e. renderer went away), on the 232 // Called once the WebUI has been deleted (i.e. renderer went away), on the
233 // IO thread. 233 // IO thread.
234 void Detach(); 234 void Detach();
235 235
236 // Sends all passive log entries in |passive_entries| to the Javascript 236 // Sends all passive log entries in |passive_entries| to the Javascript
237 // handler, called on the IO thread. 237 // handler, called on the IO thread.
238 void SendPassiveLogEntries(const ChromeNetLog::EntryList& passive_entries); 238 void SendPassiveLogEntries(const ChromeNetLog::EntryList& passive_entries);
239 239
240 // Called when the WebUI is deleted. Prevents calling Javascript functions 240 // Called when the WebUI is deleted. Prevents calling Javascript functions
241 // afterwards. Called on UI thread. 241 // afterwards. Called on UI thread.
242 void OnDOMUIDeleted(); 242 void OnWebUIDeleted();
243 243
244 //-------------------------------- 244 //--------------------------------
245 // Javascript message handlers: 245 // Javascript message handlers:
246 //-------------------------------- 246 //--------------------------------
247 247
248 void OnRendererReady(const ListValue* list); 248 void OnRendererReady(const ListValue* list);
249 249
250 void OnGetProxySettings(const ListValue* list); 250 void OnGetProxySettings(const ListValue* list);
251 void OnReloadProxySettings(const ListValue* list); 251 void OnReloadProxySettings(const ListValue* list);
252 void OnGetBadProxies(const ListValue* list); 252 void OnGetBadProxies(const ListValue* list);
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 //////////////////////////////////////////////////////////////////////////////// 425 ////////////////////////////////////////////////////////////////////////////////
426 // 426 //
427 // NetInternalsMessageHandler 427 // NetInternalsMessageHandler
428 // 428 //
429 //////////////////////////////////////////////////////////////////////////////// 429 ////////////////////////////////////////////////////////////////////////////////
430 430
431 NetInternalsMessageHandler::NetInternalsMessageHandler() {} 431 NetInternalsMessageHandler::NetInternalsMessageHandler() {}
432 432
433 NetInternalsMessageHandler::~NetInternalsMessageHandler() { 433 NetInternalsMessageHandler::~NetInternalsMessageHandler() {
434 if (proxy_) { 434 if (proxy_) {
435 proxy_.get()->OnDOMUIDeleted(); 435 proxy_.get()->OnWebUIDeleted();
436 // Notify the handler on the IO thread that the renderer is gone. 436 // Notify the handler on the IO thread that the renderer is gone.
437 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 437 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
438 NewRunnableMethod(proxy_.get(), &IOThreadImpl::Detach)); 438 NewRunnableMethod(proxy_.get(), &IOThreadImpl::Detach));
439 } 439 }
440 if (select_log_file_dialog_) 440 if (select_log_file_dialog_)
441 select_log_file_dialog_->ListenerDestroyed(); 441 select_log_file_dialog_->ListenerDestroyed();
442 } 442 }
443 443
444 WebUIMessageHandler* NetInternalsMessageHandler::Attach(WebUI* web_ui) { 444 WebUIMessageHandler* NetInternalsMessageHandler::Attach(WebUI* web_ui) {
445 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 445 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 e.time, 613 e.time,
614 e.source, 614 e.source,
615 e.phase, 615 e.phase,
616 e.params, 616 e.params,
617 false)); 617 false));
618 } 618 }
619 619
620 CallJavascriptFunction(L"g_browser.receivedPassiveLogEntries", dict_list); 620 CallJavascriptFunction(L"g_browser.receivedPassiveLogEntries", dict_list);
621 } 621 }
622 622
623 void NetInternalsMessageHandler::IOThreadImpl::OnDOMUIDeleted() { 623 void NetInternalsMessageHandler::IOThreadImpl::OnWebUIDeleted() {
624 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 624 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
625 was_domui_deleted_ = true; 625 was_domui_deleted_ = true;
626 } 626 }
627 627
628 void NetInternalsMessageHandler::IOThreadImpl::OnRendererReady( 628 void NetInternalsMessageHandler::IOThreadImpl::OnRendererReady(
629 const ListValue* list) { 629 const ListValue* list) {
630 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 630 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
631 DCHECK(!is_observing_log_) << "notifyReady called twice"; 631 DCHECK(!is_observing_log_) << "notifyReady called twice";
632 632
633 // Tell the javascript about the relationship between event type enums and 633 // Tell the javascript about the relationship between event type enums and
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 //////////////////////////////////////////////////////////////////////////////// 1219 ////////////////////////////////////////////////////////////////////////////////
1220 1220
1221 NetInternalsUI::NetInternalsUI(TabContents* contents) : WebUI(contents) { 1221 NetInternalsUI::NetInternalsUI(TabContents* contents) : WebUI(contents) {
1222 AddMessageHandler((new NetInternalsMessageHandler())->Attach(this)); 1222 AddMessageHandler((new NetInternalsMessageHandler())->Attach(this));
1223 1223
1224 NetInternalsHTMLSource* html_source = new NetInternalsHTMLSource(); 1224 NetInternalsHTMLSource* html_source = new NetInternalsHTMLSource();
1225 1225
1226 // Set up the chrome://net-internals/ source. 1226 // Set up the chrome://net-internals/ source.
1227 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); 1227 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source);
1228 } 1228 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/dom_ui/settings_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698