| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/net_internals_ui.h" | 5 #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h" | 
| 6 | 6 | 
| 7 #include <stddef.h> | 7 #include <stddef.h> | 
| 8 | 8 | 
| 9 #include <algorithm> | 9 #include <algorithm> | 
| 10 #include <list> | 10 #include <list> | 
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 360   // Javascript functions after the Web UI is destroyed.  On refresh, the | 360   // Javascript functions after the Web UI is destroyed.  On refresh, the | 
| 361   // messages can end up being sent to the refreshed page, causing duplicate | 361   // messages can end up being sent to the refreshed page, causing duplicate | 
| 362   // or partial entries. | 362   // or partial entries. | 
| 363   // | 363   // | 
| 364   // This is only read and written to on the UI thread. | 364   // This is only read and written to on the UI thread. | 
| 365   bool was_webui_deleted_; | 365   bool was_webui_deleted_; | 
| 366 | 366 | 
| 367   // Log entries that have yet to be passed along to Javascript page.  Non-NULL | 367   // Log entries that have yet to be passed along to Javascript page.  Non-NULL | 
| 368   // when and only when there is a pending delayed task to call | 368   // when and only when there is a pending delayed task to call | 
| 369   // PostPendingEntries.  Read and written to exclusively on the IO Thread. | 369   // PostPendingEntries.  Read and written to exclusively on the IO Thread. | 
| 370   scoped_ptr<base::ListValue> pending_entries_; | 370   std::unique_ptr<base::ListValue> pending_entries_; | 
| 371 | 371 | 
| 372   // Used for getting current status of URLRequests when net-internals is | 372   // Used for getting current status of URLRequests when net-internals is | 
| 373   // opened.  |main_context_getter_| is automatically added on construction. | 373   // opened.  |main_context_getter_| is automatically added on construction. | 
| 374   // Duplicates are allowed. | 374   // Duplicates are allowed. | 
| 375   ContextGetterList context_getters_; | 375   ContextGetterList context_getters_; | 
| 376 | 376 | 
| 377   DISALLOW_COPY_AND_ASSIGN(IOThreadImpl); | 377   DISALLOW_COPY_AND_ASSIGN(IOThreadImpl); | 
| 378 }; | 378 }; | 
| 379 | 379 | 
| 380 //////////////////////////////////////////////////////////////////////////////// | 380 //////////////////////////////////////////////////////////////////////////////// | 
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 500   web_ui()->RegisterMessageCallback( | 500   web_ui()->RegisterMessageCallback( | 
| 501       "setNetworkDebugMode", | 501       "setNetworkDebugMode", | 
| 502       base::Bind(&NetInternalsMessageHandler::OnSetNetworkDebugMode, | 502       base::Bind(&NetInternalsMessageHandler::OnSetNetworkDebugMode, | 
| 503                  base::Unretained(this))); | 503                  base::Unretained(this))); | 
| 504 #endif | 504 #endif | 
| 505 } | 505 } | 
| 506 | 506 | 
| 507 void NetInternalsMessageHandler::SendJavascriptCommand( | 507 void NetInternalsMessageHandler::SendJavascriptCommand( | 
| 508     const std::string& command, | 508     const std::string& command, | 
| 509     base::Value* arg) { | 509     base::Value* arg) { | 
| 510   scoped_ptr<base::Value> command_value(new base::StringValue(command)); | 510   std::unique_ptr<base::Value> command_value(new base::StringValue(command)); | 
| 511   scoped_ptr<base::Value> value(arg); | 511   std::unique_ptr<base::Value> value(arg); | 
| 512   DCHECK_CURRENTLY_ON(BrowserThread::UI); | 512   DCHECK_CURRENTLY_ON(BrowserThread::UI); | 
| 513   if (value.get()) { | 513   if (value.get()) { | 
| 514     web_ui()->CallJavascriptFunction("g_browser.receive", | 514     web_ui()->CallJavascriptFunction("g_browser.receive", | 
| 515                                      *command_value.get(), | 515                                      *command_value.get(), | 
| 516                                      *value.get()); | 516                                      *value.get()); | 
| 517   } else { | 517   } else { | 
| 518     web_ui()->CallJavascriptFunction("g_browser.receive", | 518     web_ui()->CallJavascriptFunction("g_browser.receive", | 
| 519                                      *command_value.get()); | 519                                      *command_value.get()); | 
| 520   } | 520   } | 
| 521 } | 521 } | 
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 573     const base::ListValue* list) { | 573     const base::ListValue* list) { | 
| 574   DCHECK_CURRENTLY_ON(BrowserThread::UI); | 574   DCHECK_CURRENTLY_ON(BrowserThread::UI); | 
| 575   base::ListValue* extension_list = new base::ListValue(); | 575   base::ListValue* extension_list = new base::ListValue(); | 
| 576 #if defined(ENABLE_EXTENSIONS) | 576 #if defined(ENABLE_EXTENSIONS) | 
| 577   Profile* profile = Profile::FromWebUI(web_ui()); | 577   Profile* profile = Profile::FromWebUI(web_ui()); | 
| 578   extensions::ExtensionSystem* extension_system = | 578   extensions::ExtensionSystem* extension_system = | 
| 579       extensions::ExtensionSystem::Get(profile); | 579       extensions::ExtensionSystem::Get(profile); | 
| 580   if (extension_system) { | 580   if (extension_system) { | 
| 581     ExtensionService* extension_service = extension_system->extension_service(); | 581     ExtensionService* extension_service = extension_system->extension_service(); | 
| 582     if (extension_service) { | 582     if (extension_service) { | 
| 583       scoped_ptr<const extensions::ExtensionSet> extensions( | 583       std::unique_ptr<const extensions::ExtensionSet> extensions( | 
| 584           extensions::ExtensionRegistry::Get(profile) | 584           extensions::ExtensionRegistry::Get(profile) | 
| 585               ->GenerateInstalledExtensionsSet()); | 585               ->GenerateInstalledExtensionsSet()); | 
| 586       for (extensions::ExtensionSet::const_iterator it = extensions->begin(); | 586       for (extensions::ExtensionSet::const_iterator it = extensions->begin(); | 
| 587            it != extensions->end(); ++it) { | 587            it != extensions->end(); ++it) { | 
| 588         base::DictionaryValue* extension_info = new base::DictionaryValue(); | 588         base::DictionaryValue* extension_info = new base::DictionaryValue(); | 
| 589         bool enabled = extension_service->IsExtensionEnabled((*it)->id()); | 589         bool enabled = extension_service->IsExtensionEnabled((*it)->id()); | 
| 590         extensions::GetExtensionBasicInfo(it->get(), enabled, extension_info); | 590         extensions::GetExtensionBasicInfo(it->get(), enabled, extension_info); | 
| 591         extension_list->Append(extension_info); | 591         extension_list->Append(extension_info); | 
| 592       } | 592       } | 
| 593     } | 593     } | 
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1177 //////////////////////////////////////////////////////////////////////////////// | 1177 //////////////////////////////////////////////////////////////////////////////// | 
| 1178 | 1178 | 
| 1179 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1179 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 
| 1180     : WebUIController(web_ui) { | 1180     : WebUIController(web_ui) { | 
| 1181   web_ui->AddMessageHandler(new NetInternalsMessageHandler()); | 1181   web_ui->AddMessageHandler(new NetInternalsMessageHandler()); | 
| 1182 | 1182 | 
| 1183   // Set up the chrome://net-internals/ source. | 1183   // Set up the chrome://net-internals/ source. | 
| 1184   Profile* profile = Profile::FromWebUI(web_ui); | 1184   Profile* profile = Profile::FromWebUI(web_ui); | 
| 1185   content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); | 1185   content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); | 
| 1186 } | 1186 } | 
| OLD | NEW | 
|---|