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

Unified Diff: chrome/browser/ui/webui/webapks_handler.cc

Issue 2714633003: Adds more metadata to the about:webapks page (Closed)
Patch Set: Adds more metadata to the about:webapks page Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/ntp/ntp_resource_cache.cc ('k') | ui/gfx/color_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/webapks_handler.cc
diff --git a/chrome/browser/ui/webui/webapks_handler.cc b/chrome/browser/ui/webui/webapks_handler.cc
index 69d98c8cafda9393b7085fddbb48472075d876d6..264fe0e41be71089610900e9456b4d9b0b52256c 100644
--- a/chrome/browser/ui/webui/webapks_handler.cc
+++ b/chrome/browser/ui/webui/webapks_handler.cc
@@ -4,10 +4,25 @@
#include "chrome/browser/ui/webui/webapks_handler.h"
+#include <string>
+
#include "base/callback_forward.h"
+#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "chrome/browser/android/shortcut_helper.h"
#include "content/public/browser/web_ui.h"
+#include "content/public/common/manifest_util.h"
+#include "ui/gfx/color_utils.h"
+
+namespace {
+// Converts a color from the format documented in content::Manifest to a
+// rgba() CSS string.
+std::string ColorToString(int64_t color) {
+ if (color == content::Manifest::kInvalidOrMissingColor)
+ return std::string();
+ return color_utils::SkColorToRgbaString(reinterpret_cast<uint32_t&>(color));
+}
+} // namespace
WebApksHandler::WebApksHandler() : weak_ptr_factory_(this) {}
@@ -33,10 +48,23 @@ void WebApksHandler::OnWebApkInfoRetrieved(
base::ListValue list;
for (const auto& webapk_info : webapks_list) {
std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue());
+ result->SetString("name", webapk_info.name);
result->SetString("shortName", webapk_info.short_name);
result->SetString("packageName", webapk_info.package_name);
result->SetInteger("shellApkVersion", webapk_info.shell_apk_version);
result->SetInteger("versionCode", webapk_info.version_code);
+ result->SetString("uri", webapk_info.uri);
+ result->SetString("scope", webapk_info.scope);
+ result->SetString("manifestUrl", webapk_info.manifest_url);
+ result->SetString("manifestStartUrl", webapk_info.manifest_start_url);
+ result->SetString("displayMode",
+ content::WebDisplayModeToString(webapk_info.display));
+ result->SetString(
+ "orientation",
+ content::WebScreenOrientationLockTypeToString(webapk_info.orientation));
+ result->SetString("themeColor", ColorToString(webapk_info.theme_color));
+ result->SetString("backgroundColor",
+ ColorToString(webapk_info.background_color));
list.Append(std::move(result));
}
« no previous file with comments | « chrome/browser/ui/webui/ntp/ntp_resource_cache.cc ('k') | ui/gfx/color_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698