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

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

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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
OLDNEW
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
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
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/net_export_ui.cc ('k') | chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698