Chromium Code Reviews| 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..4ebee9f5b99c8636e8a1664adb84e7d493a5f287 100644 |
| --- a/chrome/browser/ui/webui/webapks_handler.cc |
| +++ b/chrome/browser/ui/webui/webapks_handler.cc |
| @@ -4,10 +4,15 @@ |
| #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" |
| WebApksHandler::WebApksHandler() : weak_ptr_factory_(this) {} |
| @@ -26,6 +31,13 @@ void WebApksHandler::HandleRequestWebApksInfo(const base::ListValue* args) { |
| &WebApksHandler::OnWebApkInfoRetrieved, weak_ptr_factory_.GetWeakPtr())); |
| } |
| +std::string ColorToString(int64_t color) { |
|
pkotwicz
2017/02/27 23:39:39
This function should be in the anonymous namespace
gonzalon
2017/02/28 14:59:32
Done.
|
| + if (color == content::Manifest::kInvalidOrMissingColor) { |
| + return ""; |
| + } |
| + return color_utils::SkColorToRGBAString(reinterpret_cast<uint32_t&>(color)); |
| +} |
| + |
| void WebApksHandler::OnWebApkInfoRetrieved( |
| const std::vector<WebApkInfo>& webapks_list) { |
| if (!IsJavascriptAllowed()) |
| @@ -33,10 +45,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)); |
| } |