Commit 50efb070 authored by James Cook's avatar James Cook Committed by Commit Bot

Create lock screen app widgets maximized by default

Ash will end up maximizing the windows when they are added to the
lock screen container. Creating the widget maximized avoids some
back-and-forth with the window manager under mash. It also simplifies
testing.

Bug: 899055
Test: browser_tests
Change-Id: I168ba67c1cc7c680cd0c9a4b4a1b22c3c40bd500
Reviewed-on: https://chromium-review.googlesource.com/c/1316438
Commit-Queue: James Cook <jamescook@chromium.org>
Reviewed-by: default avatarToni Baržić <tbarzic@chromium.org>
Reviewed-by: default avatarMichael Wasserman <msw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606577}
parent 2b9f495b
......@@ -23,7 +23,6 @@
#include "extensions/common/switches.h"
#include "extensions/test/extension_test_message_listener.h"
#include "extensions/test/result_catcher.h"
#include "ui/aura/test/mus/change_completion_waiter.h"
namespace {
......@@ -168,20 +167,6 @@ class LockScreenNoteTakingTest : public extensions::ExtensionBrowserTest {
return false;
}
// By this point the app window is created on the lock screen. Ensure the
// asynchronous window maximize from ash completes.
aura::test::WaitForAllChangesToComplete();
extensions::AppWindow* app_window =
lock_screen_apps::StateController::Get()->note_app_window_for_test();
if (!app_window) {
*error = "No app window";
return false;
}
if (!app_window->GetBaseWindow()->IsMaximized()) {
*error = "App window not maximized";
return false;
}
// Close the app window created by the API test.
ready_to_close.Reply("close");
......
......@@ -108,7 +108,6 @@ class StateController : public ash::mojom::TrayActionClient,
// |SetPrimaryProfile|
void SetLockScreenLockScreenProfileCreatorForTesting(
std::unique_ptr<LockScreenProfileCreator> profile_creator);
extensions::AppWindow* note_app_window_for_test() { return note_app_window_; }
// Initializes mojo bindings for the StateController - it creates binding to
// ash's tray action interface and sets this object as the interface's client.
......
......@@ -140,6 +140,14 @@ void ChromeNativeAppWindowViewsAuraAsh::OnBeforeWidgetInit(
if (container_id.has_value())
ash_util::SetupWidgetInitParamsForContainer(init_params, *container_id);
// Resizable lock screen apps will end up maximized by ash. Do it now to
// save back-and-forth communication with the window manager. Right now all
// lock screen apps either end up maximized (e.g. Keep) or are not resizable.
if (create_params.show_on_lock_screen && create_params.resizable) {
DCHECK_EQ(ui::SHOW_STATE_DEFAULT, init_params->show_state);
init_params->show_state = ui::SHOW_STATE_MAXIMIZED;
}
if (HasFrameColor()) {
init_params
->mus_properties[ws::mojom::WindowManager::kFrameActiveColor_Property] =
......
......@@ -11,6 +11,7 @@ chrome.test.runTests([
function hasAccessToCurrentWindow() {
chrome.test.assertTrue(!!chrome.app.window.current);
chrome.test.assertTrue(!!chrome.app.window.current());
chrome.test.assertTrue(chrome.app.window.current().isMaximized());
chrome.test.succeed();
},
......
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