Commit 532819bd authored by John Lee's avatar John Lee Committed by Commit Bot

WebUI Tab Strip: Update handler to use newer base::ListValue APIs

Change-Id: If7dcc1d250162ac5bd315d163b4f49fc0aa16b61
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2016352Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Commit-Queue: John Lee <johntlee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#734706}
parent bc68a32a
...@@ -578,10 +578,8 @@ void TabStripUIHandler::HandleShowBackgroundContextMenu( ...@@ -578,10 +578,8 @@ void TabStripUIHandler::HandleShowBackgroundContextMenu(
const base::ListValue* args) { const base::ListValue* args) {
gfx::PointF point; gfx::PointF point;
{ {
double x = 0; double x = args->GetList()[0].GetDouble();
args->GetDouble(0, &x); double y = args->GetList()[1].GetDouble();
double y = 0;
args->GetDouble(1, &y);
point = gfx::PointF(x, y); point = gfx::PointF(x, y);
} }
...@@ -593,15 +591,12 @@ void TabStripUIHandler::HandleShowBackgroundContextMenu( ...@@ -593,15 +591,12 @@ void TabStripUIHandler::HandleShowBackgroundContextMenu(
} }
void TabStripUIHandler::HandleShowTabContextMenu(const base::ListValue* args) { void TabStripUIHandler::HandleShowTabContextMenu(const base::ListValue* args) {
int tab_id = 0; int tab_id = args->GetList()[0].GetInt();
args->GetInteger(0, &tab_id);
gfx::PointF point; gfx::PointF point;
{ {
double x = 0; double x = args->GetList()[1].GetDouble();
args->GetDouble(1, &x); double y = args->GetList()[2].GetDouble();
double y = 0;
args->GetDouble(2, &y);
point = gfx::PointF(x, y); point = gfx::PointF(x, y);
} }
...@@ -631,10 +626,7 @@ void TabStripUIHandler::HandleGetLayout(const base::ListValue* args) { ...@@ -631,10 +626,7 @@ void TabStripUIHandler::HandleGetLayout(const base::ListValue* args) {
void TabStripUIHandler::HandleSetThumbnailTracked(const base::ListValue* args) { void TabStripUIHandler::HandleSetThumbnailTracked(const base::ListValue* args) {
AllowJavascript(); AllowJavascript();
int tab_id = 0; int tab_id = args->GetList()[0].GetInt();
if (!args->GetInteger(0, &tab_id))
return;
const bool thumbnail_tracked = args->GetList()[1].GetBool(); const bool thumbnail_tracked = args->GetList()[1].GetBool();
content::WebContents* tab = nullptr; content::WebContents* tab = nullptr;
...@@ -653,28 +645,23 @@ void TabStripUIHandler::HandleSetThumbnailTracked(const base::ListValue* args) { ...@@ -653,28 +645,23 @@ void TabStripUIHandler::HandleSetThumbnailTracked(const base::ListValue* args) {
void TabStripUIHandler::HandleReportTabActivationDuration( void TabStripUIHandler::HandleReportTabActivationDuration(
const base::ListValue* args) { const base::ListValue* args) {
int duration_ms = 0; int duration_ms = args->GetList()[0].GetInt();
args->GetInteger(0, &duration_ms);
UMA_HISTOGRAM_TIMES("WebUITabStrip.TabActivation", UMA_HISTOGRAM_TIMES("WebUITabStrip.TabActivation",
base::TimeDelta::FromMilliseconds(duration_ms)); base::TimeDelta::FromMilliseconds(duration_ms));
} }
void TabStripUIHandler::HandleReportTabDataReceivedDuration( void TabStripUIHandler::HandleReportTabDataReceivedDuration(
const base::ListValue* args) { const base::ListValue* args) {
int tab_count = 0; int tab_count = args->GetList()[0].GetInt();
args->GetInteger(0, &tab_count); int duration_ms = args->GetList()[1].GetInt();
int duration_ms = 0;
args->GetInteger(1, &duration_ms);
ReportTabDurationHistogram("TabDataReceived", tab_count, ReportTabDurationHistogram("TabDataReceived", tab_count,
base::TimeDelta::FromMilliseconds(duration_ms)); base::TimeDelta::FromMilliseconds(duration_ms));
} }
void TabStripUIHandler::HandleReportTabCreationDuration( void TabStripUIHandler::HandleReportTabCreationDuration(
const base::ListValue* args) { const base::ListValue* args) {
int tab_count = 0; int tab_count = args->GetList()[0].GetInt();
args->GetInteger(0, &tab_count); int duration_ms = args->GetList()[1].GetInt();
int duration_ms = 0;
args->GetInteger(1, &duration_ms);
ReportTabDurationHistogram("TabCreation", tab_count, ReportTabDurationHistogram("TabCreation", tab_count,
base::TimeDelta::FromMilliseconds(duration_ms)); base::TimeDelta::FromMilliseconds(duration_ms));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment