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

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

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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
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/net_internals_ui.h" 5 #include "chrome/browser/ui/webui/net_internals_ui.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 14 matching lines...) Expand all
25 #include "chrome/browser/browser_process.h" 25 #include "chrome/browser/browser_process.h"
26 #include "chrome/browser/io_thread.h" 26 #include "chrome/browser/io_thread.h"
27 #include "chrome/browser/net/chrome_net_log.h" 27 #include "chrome/browser/net/chrome_net_log.h"
28 #include "chrome/browser/net/connection_tester.h" 28 #include "chrome/browser/net/connection_tester.h"
29 #include "chrome/browser/net/passive_log_collector.h" 29 #include "chrome/browser/net/passive_log_collector.h"
30 #include "chrome/browser/net/url_fixer_upper.h" 30 #include "chrome/browser/net/url_fixer_upper.h"
31 #include "chrome/browser/prefs/pref_member.h" 31 #include "chrome/browser/prefs/pref_member.h"
32 #include "chrome/browser/prerender/prerender_manager.h" 32 #include "chrome/browser/prerender/prerender_manager.h"
33 #include "chrome/browser/profiles/profile.h" 33 #include "chrome/browser/profiles/profile.h"
34 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 34 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
35 #include "chrome/common/chrome_notification_types.h"
35 #include "chrome/common/chrome_paths.h" 36 #include "chrome/common/chrome_paths.h"
36 #include "chrome/common/chrome_version_info.h" 37 #include "chrome/common/chrome_version_info.h"
37 #include "chrome/common/jstemplate_builder.h" 38 #include "chrome/common/jstemplate_builder.h"
38 #include "chrome/common/pref_names.h" 39 #include "chrome/common/pref_names.h"
39 #include "chrome/common/url_constants.h" 40 #include "chrome/common/url_constants.h"
40 #include "content/browser/browser_thread.h" 41 #include "content/browser/browser_thread.h"
41 #include "content/common/notification_details.h" 42 #include "content/common/notification_details.h"
42 #include "content/common/notification_type.h"
43 #include "grit/generated_resources.h" 43 #include "grit/generated_resources.h"
44 #include "grit/net_internals_resources.h" 44 #include "grit/net_internals_resources.h"
45 #include "net/base/escape.h" 45 #include "net/base/escape.h"
46 #include "net/base/host_resolver_impl.h" 46 #include "net/base/host_resolver_impl.h"
47 #include "net/base/net_errors.h" 47 #include "net/base/net_errors.h"
48 #include "net/base/net_util.h" 48 #include "net/base/net_util.h"
49 #include "net/base/sys_addrinfo.h" 49 #include "net/base/sys_addrinfo.h"
50 #include "net/base/x509_cert_types.h" 50 #include "net/base/x509_cert_types.h"
51 #include "net/disk_cache/disk_cache.h" 51 #include "net/disk_cache/disk_cache.h"
52 #include "net/http/http_alternate_protocols.h" 52 #include "net/http/http_alternate_protocols.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 159
160 // WebUIMessageHandler implementation. 160 // WebUIMessageHandler implementation.
161 virtual WebUIMessageHandler* Attach(WebUI* web_ui); 161 virtual WebUIMessageHandler* Attach(WebUI* web_ui);
162 virtual void RegisterMessages(); 162 virtual void RegisterMessages();
163 163
164 // Executes the javascript function |function_name| in the renderer, passing 164 // Executes the javascript function |function_name| in the renderer, passing
165 // it the argument |arg|. Takes ownership of |arg|. 165 // it the argument |arg|. Takes ownership of |arg|.
166 void CallJavascriptFunction(const std::wstring& function_name, Value* arg); 166 void CallJavascriptFunction(const std::wstring& function_name, Value* arg);
167 167
168 // NotificationObserver implementation. 168 // NotificationObserver implementation.
169 virtual void Observe(NotificationType type, 169 virtual void Observe(int type,
170 const NotificationSource& source, 170 const NotificationSource& source,
171 const NotificationDetails& details); 171 const NotificationDetails& details);
172 172
173 // Javascript message handlers. 173 // Javascript message handlers.
174 void OnRendererReady(const ListValue* list); 174 void OnRendererReady(const ListValue* list);
175 void OnEnableHttpThrottling(const ListValue* list); 175 void OnEnableHttpThrottling(const ListValue* list);
176 #ifdef OS_CHROMEOS 176 #ifdef OS_CHROMEOS
177 void OnRefreshSystemLogs(const ListValue* list); 177 void OnRefreshSystemLogs(const ListValue* list);
178 void OnGetSystemLog(const ListValue* list); 178 void OnGetSystemLog(const ListValue* list);
179 #endif 179 #endif
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 Value* arg) { 631 Value* arg) {
632 scoped_ptr<Value> value(arg); 632 scoped_ptr<Value> value(arg);
633 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 633 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
634 if (value.get()) { 634 if (value.get()) {
635 web_ui_->CallJavascriptFunction(WideToASCII(function_name), *value.get()); 635 web_ui_->CallJavascriptFunction(WideToASCII(function_name), *value.get());
636 } else { 636 } else {
637 web_ui_->CallJavascriptFunction(WideToASCII(function_name)); 637 web_ui_->CallJavascriptFunction(WideToASCII(function_name));
638 } 638 }
639 } 639 }
640 640
641 void NetInternalsMessageHandler::Observe(NotificationType type, 641 void NetInternalsMessageHandler::Observe(int type,
642 const NotificationSource& source, 642 const NotificationSource& source,
643 const NotificationDetails& details) { 643 const NotificationDetails& details) {
644 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 644 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
645 DCHECK_EQ(type.value, NotificationType::PREF_CHANGED); 645 DCHECK_EQ(type, chrome::NOTIFICATION_PREF_CHANGED);
646 646
647 std::string* pref_name = Details<std::string>(details).ptr(); 647 std::string* pref_name = Details<std::string>(details).ptr();
648 if (*pref_name == prefs::kHttpThrottlingEnabled) { 648 if (*pref_name == prefs::kHttpThrottlingEnabled) {
649 CallJavascriptFunction( 649 CallJavascriptFunction(
650 L"g_browser.receivedHttpThrottlingEnabledPrefChanged", 650 L"g_browser.receivedHttpThrottlingEnabledPrefChanged",
651 Value::CreateBooleanValue(*http_throttling_enabled_)); 651 Value::CreateBooleanValue(*http_throttling_enabled_));
652 } 652 }
653 } 653 }
654 654
655 void NetInternalsMessageHandler::OnRendererReady(const ListValue* list) { 655 void NetInternalsMessageHandler::OnRendererReady(const ListValue* list) {
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
1594 //////////////////////////////////////////////////////////////////////////////// 1594 ////////////////////////////////////////////////////////////////////////////////
1595 1595
1596 NetInternalsUI::NetInternalsUI(TabContents* contents) : ChromeWebUI(contents) { 1596 NetInternalsUI::NetInternalsUI(TabContents* contents) : ChromeWebUI(contents) {
1597 AddMessageHandler((new NetInternalsMessageHandler())->Attach(this)); 1597 AddMessageHandler((new NetInternalsMessageHandler())->Attach(this));
1598 1598
1599 NetInternalsHTMLSource* html_source = new NetInternalsHTMLSource(); 1599 NetInternalsHTMLSource* html_source = new NetInternalsHTMLSource();
1600 1600
1601 // Set up the chrome://net-internals/ source. 1601 // Set up the chrome://net-internals/ source.
1602 GetProfile()->GetChromeURLDataManager()->AddDataSource(html_source); 1602 GetProfile()->GetChromeURLDataManager()->AddDataSource(html_source);
1603 } 1603 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/history_ui.cc ('k') | chrome/browser/ui/webui/ntp/app_launcher_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698