Commit 423d0dfa authored by Callistus's avatar Callistus Committed by Commit Bot

Set default and minimum window size for the Help app.

Carbon specs: https://carbon.googleplex.com/cros-ux/pages/show-off/app-structure#3e13a03d-5684-488c-b935-4129aedd6a68
Demo: https://screencast.googleplex.com/cast/NTE1NzAyMzQ5Njc5ODIwOHxjY2U4OGY5Ni1iYw

Bug: b/154777087
Change-Id: Ibd79be825751334be65025155d0a1b17a807dbeb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2198058Reviewed-by: default avatarGiovanni Ortuño Urquidi <ortuno@chromium.org>
Reviewed-by: default avatarRachel Carpenter <carpenterr@chromium.org>
Commit-Queue: Callistus Tan <callistus@google.com>
Cr-Commit-Position: refs/heads/master@{#768554}
parent 29ed15ef
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
#include "chrome/browser/apps/app_service/app_service_proxy.h" #include "chrome/browser/apps/app_service/app_service_proxy.h"
#include "chrome/browser/apps/app_service/app_service_proxy_factory.h" #include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
#include "chrome/browser/chromeos/web_applications/system_web_app_integration_test.h" #include "chrome/browser/chromeos/web_applications/system_web_app_integration_test.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/web_applications/system_web_app_manager.h" #include "chrome/browser/web_applications/system_web_app_manager.h"
#include "chrome/browser/web_applications/system_web_app_manager_browsertest.h" #include "chrome/browser/web_applications/system_web_app_manager_browsertest.h"
#include "chromeos/components/help_app_ui/url_constants.h" #include "chromeos/components/help_app_ui/url_constants.h"
...@@ -19,7 +21,10 @@ ...@@ -19,7 +21,10 @@
#include "chromeos/constants/chromeos_features.h" #include "chromeos/constants/chromeos_features.h"
#include "content/public/test/browser_test.h" #include "content/public/test/browser_test.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/display/screen.h"
#include "ui/display/types/display_constants.h" #include "ui/display/types/display_constants.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
class HelpAppIntegrationTest : public SystemWebAppIntegrationTest { class HelpAppIntegrationTest : public SystemWebAppIntegrationTest {
public: public:
...@@ -47,6 +52,25 @@ IN_PROC_BROWSER_TEST_P(HelpAppIntegrationTest, HelpAppV2SearchInLauncher) { ...@@ -47,6 +52,25 @@ IN_PROC_BROWSER_TEST_P(HelpAppIntegrationTest, HelpAppV2SearchInLauncher) {
GetManager().GetAdditionalSearchTerms(web_app::SystemAppType::HELP)); GetManager().GetAdditionalSearchTerms(web_app::SystemAppType::HELP));
} }
// Test that the Help App has a minimum window size of 600x320.
IN_PROC_BROWSER_TEST_P(HelpAppIntegrationTest, HelpAppV2MinWindowSize) {
WaitForSystemAppInstallAndLaunch(web_app::SystemAppType::HELP);
auto app_id = LaunchParamsForApp(web_app::SystemAppType::HELP).app_id;
EXPECT_EQ(GetManager().GetMinimumWindowSize(app_id), gfx::Size(600, 320));
}
// Test that the Help App has a default size of 960x600 and is in the center of
// the screen.
IN_PROC_BROWSER_TEST_P(HelpAppIntegrationTest, HelpAppV2DefaultWindowBounds) {
auto* browser =
WaitForSystemAppInstallAndLaunch(web_app::SystemAppType::HELP);
gfx::Rect work_area =
display::Screen::GetScreen()->GetDisplayForNewWindows().work_area();
int x = (work_area.width() - 960) / 2;
int y = (work_area.height() - 600) / 2;
EXPECT_EQ(browser->window()->GetBounds(), gfx::Rect(x, y, 960, 600));
}
// Test that the Help App logs metric when launching the app using the // Test that the Help App logs metric when launching the app using the
// AppServiceProxy. // AppServiceProxy.
IN_PROC_BROWSER_TEST_P(HelpAppIntegrationTest, HelpAppV2AppServiceMetrics) { IN_PROC_BROWSER_TEST_P(HelpAppIntegrationTest, HelpAppV2AppServiceMetrics) {
......
...@@ -89,6 +89,7 @@ namespace { ...@@ -89,6 +89,7 @@ namespace {
constexpr gfx::Rect TERMINAL_DEFAULT_BOUNDS(gfx::Point(64, 64), constexpr gfx::Rect TERMINAL_DEFAULT_BOUNDS(gfx::Point(64, 64),
gfx::Size(652, 484)); gfx::Size(652, 484));
constexpr gfx::Size TERMINAL_SETTINGS_DEFAULT_SIZE(768, 512); constexpr gfx::Size TERMINAL_SETTINGS_DEFAULT_SIZE(768, 512);
constexpr gfx::Size HELP_DEFAULT_SIZE(960, 600);
} // namespace } // namespace
// static // static
...@@ -317,6 +318,12 @@ gfx::Rect AppBrowserController::GetDefaultBounds() const { ...@@ -317,6 +318,12 @@ gfx::Rect AppBrowserController::GetDefaultBounds() const {
return bounds; return bounds;
} }
return TERMINAL_DEFAULT_BOUNDS; return TERMINAL_DEFAULT_BOUNDS;
} else if (system_app_type_ == SystemAppType::HELP) {
// Help app is centered.
gfx::Rect bounds =
display::Screen::GetScreen()->GetDisplayForNewWindows().work_area();
bounds.ClampToCenteredSize(HELP_DEFAULT_SIZE);
return bounds;
} }
return gfx::Rect(); return gfx::Rect();
} }
......
...@@ -121,6 +121,7 @@ base::flat_map<SystemAppType, SystemAppInfo> CreateSystemWebApps() { ...@@ -121,6 +121,7 @@ base::flat_map<SystemAppType, SystemAppInfo> CreateSystemWebApps() {
SystemAppInfo("Help", GURL("chrome://help-app/pwa.html"))); SystemAppInfo("Help", GURL("chrome://help-app/pwa.html")));
infos.at(SystemAppType::HELP).additional_search_terms = { infos.at(SystemAppType::HELP).additional_search_terms = {
IDS_GENIUS_APP_NAME, IDS_HELP_APP_PERKS, IDS_HELP_APP_OFFERS}; IDS_GENIUS_APP_NAME, IDS_HELP_APP_PERKS, IDS_HELP_APP_OFFERS};
infos.at(SystemAppType::HELP).minimum_window_size = {600, 320};
} }
if (SystemWebAppManager::IsAppEnabled(SystemAppType::MEDIA)) { if (SystemWebAppManager::IsAppEnabled(SystemAppType::MEDIA)) {
......
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