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

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

Issue 2085005: Removed the "Reload" button from the HTTP cache tab of the net-internals page... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 7 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/resources/net_internals/dataview.js » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <sstream> 8 #include <sstream>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 // Pass it as a string, since it may be too large to fit in an integer. 549 // Pass it as a string, since it may be too large to fit in an integer.
550 CallJavascriptFunction(L"g_browser.receivedTimeTickOffset", 550 CallJavascriptFunction(L"g_browser.receivedTimeTickOffset",
551 Value::CreateStringValue( 551 Value::CreateStringValue(
552 Int64ToString(tick_to_unix_time_ms))); 552 Int64ToString(tick_to_unix_time_ms)));
553 } 553 }
554 554
555 OnGetPassiveLogEntries(NULL); 555 OnGetPassiveLogEntries(NULL);
556 OnGetProxySettings(NULL); 556 OnGetProxySettings(NULL);
557 OnGetBadProxies(NULL); 557 OnGetBadProxies(NULL);
558 OnGetHostResolverCache(NULL); 558 OnGetHostResolverCache(NULL);
559 OnGetHttpCacheInfo(NULL);
559 } 560 }
560 561
561 void NetInternalsMessageHandler::IOThreadImpl::OnGetProxySettings( 562 void NetInternalsMessageHandler::IOThreadImpl::OnGetProxySettings(
562 const Value* value) { 563 const Value* value) {
563 URLRequestContext* context = context_getter_->GetURLRequestContext(); 564 URLRequestContext* context = context_getter_->GetURLRequestContext();
564 net::ProxyService* proxy_service = context->proxy_service(); 565 net::ProxyService* proxy_service = context->proxy_service();
565 566
566 // TODO(eroman): send a dictionary rather than a flat string, so client can do 567 // TODO(eroman): send a dictionary rather than a flat string, so client can do
567 // its own presentation. 568 // its own presentation.
568 std::string settings_string; 569 std::string settings_string;
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 // For example, turn "www.google.com" into "http://www.google.com". 725 // For example, turn "www.google.com" into "http://www.google.com".
725 GURL url(URLFixerUpper::FixupURL(UTF16ToUTF8(url_str), std::string())); 726 GURL url(URLFixerUpper::FixupURL(UTF16ToUTF8(url_str), std::string()));
726 727
727 connection_tester_.reset(new ConnectionTester(this)); 728 connection_tester_.reset(new ConnectionTester(this));
728 connection_tester_->RunAllTests(url); 729 connection_tester_->RunAllTests(url);
729 } 730 }
730 731
731 void NetInternalsMessageHandler::IOThreadImpl::OnGetHttpCacheInfo( 732 void NetInternalsMessageHandler::IOThreadImpl::OnGetHttpCacheInfo(
732 const Value* value) { 733 const Value* value) {
733 DictionaryValue* info_dict = new DictionaryValue(); 734 DictionaryValue* info_dict = new DictionaryValue();
734 ListValue* entry_keys = new ListValue();
735 DictionaryValue* stats_dict = new DictionaryValue(); 735 DictionaryValue* stats_dict = new DictionaryValue();
736 736
737 disk_cache::Backend* disk_cache = GetDiskCacheBackend( 737 disk_cache::Backend* disk_cache = GetDiskCacheBackend(
738 context_getter_->GetURLRequestContext()); 738 context_getter_->GetURLRequestContext());
739 739
740 if (disk_cache) { 740 if (disk_cache) {
741 // Iterate over all the entries in the cache, to discover the keys.
742 // WARNING: this can be slow! (and will block the IO thread).
743 void* iter = NULL;
744 disk_cache::Entry* entry;
745 while (disk_cache->OpenNextEntry(&iter, &entry)) {
746 entry_keys->Append(Value::CreateStringValue(entry->GetKey()));
747 entry->Close();
748 }
749
750 // Extract the statistics key/value pairs from the backend. 741 // Extract the statistics key/value pairs from the backend.
751 std::vector<std::pair<std::string, std::string> > stats; 742 std::vector<std::pair<std::string, std::string> > stats;
752 disk_cache->GetStats(&stats); 743 disk_cache->GetStats(&stats);
753 for (size_t i = 0; i < stats.size(); ++i) { 744 for (size_t i = 0; i < stats.size(); ++i) {
754 stats_dict->Set(ASCIIToWide(stats[i].first), 745 stats_dict->Set(ASCIIToWide(stats[i].first),
755 Value::CreateStringValue(stats[i].second)); 746 Value::CreateStringValue(stats[i].second));
756 } 747 }
757 } 748 }
758 749
759 info_dict->Set(L"keys", entry_keys);
760 info_dict->Set(L"stats", stats_dict); 750 info_dict->Set(L"stats", stats_dict);
761 751
762 CallJavascriptFunction(L"g_browser.receivedHttpCacheInfo", info_dict); 752 CallJavascriptFunction(L"g_browser.receivedHttpCacheInfo", info_dict);
763 } 753 }
764 754
765 void NetInternalsMessageHandler::IOThreadImpl::OnAddEntry( 755 void NetInternalsMessageHandler::IOThreadImpl::OnAddEntry(
766 net::NetLog::EventType type, 756 net::NetLog::EventType type,
767 const base::TimeTicks& time, 757 const base::TimeTicks& time,
768 const net::NetLog::Source& source, 758 const net::NetLog::Source& source,
769 net::NetLog::EventPhase phase, 759 net::NetLog::EventPhase phase,
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 NetInternalsHTMLSource* html_source = new NetInternalsHTMLSource(); 847 NetInternalsHTMLSource* html_source = new NetInternalsHTMLSource();
858 848
859 // Set up the chrome://net-internals/ source. 849 // Set up the chrome://net-internals/ source.
860 ChromeThread::PostTask( 850 ChromeThread::PostTask(
861 ChromeThread::IO, FROM_HERE, 851 ChromeThread::IO, FROM_HERE,
862 NewRunnableMethod( 852 NewRunnableMethod(
863 Singleton<ChromeURLDataManager>::get(), 853 Singleton<ChromeURLDataManager>::get(),
864 &ChromeURLDataManager::AddDataSource, 854 &ChromeURLDataManager::AddDataSource,
865 make_scoped_refptr(html_source))); 855 make_scoped_refptr(html_source)));
866 } 856 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/net_internals/dataview.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698