Commit ba93610c authored by Dominic Battre's avatar Dominic Battre Committed by Commit Bot

Show version info in chrome://{password-manager,autofill}-internals

To simplify debugging of client problems, we now log version info, including
variations in our internals pages.

Bug: 928595
Change-Id: I25d1e59ed373c5c320372af73f32756013374c57
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1710656
Commit-Queue: Dominic Battré <battre@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Reviewed-by: default avatarVadym Doroshenko <dvadym@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681442}
parent b59fea4a
......@@ -5,9 +5,14 @@
#include "chrome/browser/ui/webui/autofill_and_password_manager_internals/internals_ui_handler.h"
#include "base/values.h"
#include "chrome/browser/chrome_content_browser_client.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/channel_info.h"
#include "components/autofill/core/browser/logging/log_router.h"
#include "components/grit/components_resources.h"
#include "components/version_info/version_info.h"
#include "components/version_ui/version_handler_helper.h"
#include "components/version_ui/version_ui_constants.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
......@@ -24,6 +29,14 @@ content::WebUIDataSource* CreateInternalsHTMLSource(
source->AddResourcePath("autofill_and_password_manager_internals.css",
IDR_AUTOFILL_AND_PASSWORD_MANAGER_INTERNALS_CSS);
source->SetDefaultResource(IDR_AUTOFILL_AND_PASSWORD_MANAGER_INTERNALS_HTML);
// Data strings:
source->AddString(version_ui::kVersion, version_info::GetVersionNumber());
source->AddString(version_ui::kOfficial, version_info::IsOfficialBuild()
? "official"
: "Developer build");
source->AddString(version_ui::kVersionModifier, chrome::GetChannelName());
source->AddString(version_ui::kCL, version_info::GetLastChange());
source->AddString(version_ui::kUserAgent, GetUserAgent());
return source;
}
......@@ -57,6 +70,8 @@ void InternalsUIHandler::OnLoaded(const base::ListValue* args) {
CallJavascriptFunction(
"notifyAboutIncognito",
base::Value(Profile::FromWebUI(web_ui())->IsIncognitoProfile()));
CallJavascriptFunction("notifyAboutVariations",
*version_ui::GetVariationsList());
}
void InternalsUIHandler::StartSubscription() {
......
......@@ -29,6 +29,25 @@
display: block;
}
#version-info {
padding: 3px;
margin: 3px;
}
.version {
font-family: monospace;
max-width: 430px;
padding-left: 5px;
word-break: break-word;
vertical-align: top;
}
.label {
font-family: monospace;
vertical-align: top;
font-weight: 200;
}
/*
* Colors can be taken from
* https://material.io/design/color/#tools-for-picking-colors
......
......@@ -14,6 +14,28 @@
<h1 id="h1-title"></h1>
<div id="logging-note"></div>
<div id="logging-note-incognito"></div>
<div id="version-info">
<table>
<tr>
<td class="label">Version:</td>
<td class="version"><span>$i18n{version}</span>
(<span>$i18n{official}</span>)
<span>$i18n{version_modifier}</span></td>
</tr>
<tr>
<td class="label">Revision:</td>
<td class="version"><span>$i18n{cl}</span></td>
</tr>
<tr>
<td class="label">User Agent:</td>
<td class="version"><span>$i18n{useragent}</span></td>
</tr>
<tr>
<td class="label">Variations:</td>
<td class="version" id="variations-list"></td>
</tr>
</table>
</div>
<div id="log-entries">
</div>
</body>
......
......@@ -75,6 +75,16 @@ function notifyAboutIncognito(isIncognito) {
document.body.dataset.incognito = isIncognito;
}
function notifyAboutVariations(variations) {
var list = document.createElement("div");
for (let item of variations) {
list.appendChild(document.createTextNode(item));
list.appendChild(document.createElement("br"));
}
var variationsList = document.getElementById("variations-list");
variationsList.appendChild(list);
}
document.addEventListener("DOMContentLoaded", function(event) {
chrome.send('loaded');
});
......@@ -7,12 +7,17 @@
#include "base/hash/hash.h"
#include "components/autofill/core/browser/logging/log_router.h"
#include "components/grit/components_resources.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/chrome_url_constants.h"
#include "ios/chrome/browser/passwords/password_manager_log_router_factory.h"
#include "components/version_info/version_info.h"
#include "components/version_ui/version_handler_helper.h"
#include "components/version_ui/version_ui_constants.h"
#import "ios/chrome/browser/browser_state/chrome_browser_state.h"
#import "ios/chrome/browser/chrome_url_constants.h"
#import "ios/chrome/browser/passwords/password_manager_log_router_factory.h"
#import "ios/chrome/common/channel_info.h"
#import "ios/web/public/web_client.h"
#import "ios/web/public/web_state/web_state.h"
#include "ios/web/public/webui/web_ui_ios.h"
#include "ios/web/public/webui/web_ui_ios_data_source.h"
#import "ios/web/public/webui/web_ui_ios.h"
#import "ios/web/public/webui/web_ui_ios_data_source.h"
#include "net/base/escape.h"
using autofill::LogRouter;
......@@ -28,6 +33,16 @@ web::WebUIIOSDataSource* CreatePasswordManagerInternalsHTMLSource() {
source->AddResourcePath("autofill_and_password_manager_internals.css",
IDR_AUTOFILL_AND_PASSWORD_MANAGER_INTERNALS_CSS);
source->SetDefaultResource(IDR_AUTOFILL_AND_PASSWORD_MANAGER_INTERNALS_HTML);
// Data strings:
source->AddString(version_ui::kVersion, version_info::GetVersionNumber());
source->AddString(version_ui::kOfficial, version_info::IsOfficialBuild()
? "official"
: "Developer build");
source->AddString(version_ui::kVersionModifier,
GetChannelString(GetChannel()));
source->AddString(version_ui::kCL, version_info::GetLastChange());
source->AddString(version_ui::kUserAgent, web::GetWebClient()->GetUserAgent(
web::UserAgentType::MOBILE));
return source;
}
......
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