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

Side by Side Diff: chrome/browser/ui/webui/task_scheduler_internals/task_scheduler_internals_ui.cc

Issue 2484043004: Apply Delayed Code Review Comments to Task Scheduler Internals (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « chrome/browser/resources/task_scheduler_internals/index.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/task_scheduler_internals/task_scheduler_intern als_ui.h" 5 #include "chrome/browser/ui/webui/task_scheduler_internals/task_scheduler_intern als_ui.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 std::unique_ptr<base::DictionaryValue> buckets = 75 std::unique_ptr<base::DictionaryValue> buckets =
76 base::MakeUnique<base::DictionaryValue>(); 76 base::MakeUnique<base::DictionaryValue>();
77 buckets->SetString("name", histogram->histogram_name()); 77 buckets->SetString("name", histogram->histogram_name());
78 buckets->Set("buckets", SnapshotHistogramToValue(histogram)); 78 buckets->Set("buckets", SnapshotHistogramToValue(histogram));
79 histogram_value->Append(std::move(buckets)); 79 histogram_value->Append(std::move(buckets));
80 } 80 }
81 81
82 data.Set("histograms", std::move(histogram_value)); 82 data.Set("histograms", std::move(histogram_value));
83 } 83 }
84 84
85 web_ui()->CallJavascriptFunctionUnsafe( 85 AllowJavascript();
86 CallJavascriptFunction(
86 "TaskSchedulerInternals.onGetTaskSchedulerData", data); 87 "TaskSchedulerInternals.onGetTaskSchedulerData", data);
87 } 88 }
88 89
89 DISALLOW_COPY_AND_ASSIGN(TaskSchedulerDataHandler); 90 DISALLOW_COPY_AND_ASSIGN(TaskSchedulerDataHandler);
90 }; 91 };
91 92
92 } // namespace 93 } // namespace
93 94
94 TaskSchedulerInternalsUI::TaskSchedulerInternalsUI(content::WebUI* web_ui) 95 TaskSchedulerInternalsUI::TaskSchedulerInternalsUI(content::WebUI* web_ui)
95 : content::WebUIController(web_ui) { 96 : content::WebUIController(web_ui) {
96 web_ui->AddMessageHandler(new TaskSchedulerDataHandler()); 97 web_ui->AddMessageHandler(new TaskSchedulerDataHandler());
97 98
98 content::WebUIDataSource* html_source = 99 content::WebUIDataSource* html_source =
99 content::WebUIDataSource::Create( 100 content::WebUIDataSource::Create(
100 chrome::kChromeUITaskSchedulerInternalsHost); 101 chrome::kChromeUITaskSchedulerInternalsHost);
101 html_source->AddResourcePath( 102 html_source->AddResourcePath(
102 "index.css", IDR_TASK_SCHEDULER_INTERNALS_RESOURCES_INDEX_CSS); 103 "index.css", IDR_TASK_SCHEDULER_INTERNALS_RESOURCES_INDEX_CSS);
103 html_source->AddResourcePath( 104 html_source->AddResourcePath(
104 "index.js", IDR_TASK_SCHEDULER_INTERNALS_RESOURCES_INDEX_JS); 105 "index.js", IDR_TASK_SCHEDULER_INTERNALS_RESOURCES_INDEX_JS);
105 html_source->SetDefaultResource( 106 html_source->SetDefaultResource(
106 IDR_TASK_SCHEDULER_INTERNALS_RESOURCES_INDEX_HTML); 107 IDR_TASK_SCHEDULER_INTERNALS_RESOURCES_INDEX_HTML);
107 108
108 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), html_source); 109 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), html_source);
109 } 110 }
110 111
111 TaskSchedulerInternalsUI::~TaskSchedulerInternalsUI() = default; 112 TaskSchedulerInternalsUI::~TaskSchedulerInternalsUI() = default;
OLDNEW
« no previous file with comments | « chrome/browser/resources/task_scheduler_internals/index.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698