Commit 578483a2 authored by James Cook's avatar James Cook Committed by Commit Bot

lacros: Rename window_sizer_ash.cc to window_sizer_chromeos.cc

Naming conventions for lacros are:
* foo_ash runs in ash-chrome
* foo_lacros runs in lacros-chrome
* foo_chromeos runs in both

We're going to use this positioning code in both, so rename to use
_chromeos.

WindowSizer itself has methods with Ash in their names, for historical
reasons. Rename those as well. Fixing those methods is out of scope for
this CL -- crbug.com/846736 tracks the cleanup work.

Bug: 1109050
Change-Id: I263df5f0f2740b4560a78c08b2bcc56e1abefcf8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2321242
Commit-Queue: James Cook <jamescook@chromium.org>
Reviewed-by: default avatarMichael Wasserman <msw@chromium.org>
Auto-Submit: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792397}
parent 75a59538
......@@ -2418,7 +2418,7 @@ static_library("ui") {
"webui/signin/inline_login_handler_modal_delegate.h",
"webui/version_handler_chromeos.cc",
"webui/version_handler_chromeos.h",
"window_sizer/window_sizer_ash.cc",
"window_sizer/window_sizer_chromeos.cc",
]
deps += [
......
......@@ -243,7 +243,7 @@ class Browser : public TabStripModelObserver,
private:
friend class Browser;
friend class WindowSizerAshTest;
friend class WindowSizerChromeOSTest;
static CreateParams CreateForAppBase(bool is_popup,
const std::string& app_name,
......
per-file *ash*=estade@chromium.org
per-file *ash*=jamescook@chromium.org
per-file *chromeos*=estade@chromium.org
per-file *chromeos*=jamescook@chromium.org
# COMPONENT: UI>Browser
......@@ -169,8 +169,8 @@ void WindowSizer::DetermineWindowBoundsAndShowState(
*bounds = specified_bounds;
#if defined(OS_CHROMEOS)
// See if ash should decide the window placement.
if (GetBrowserBoundsAsh(bounds, show_state))
// Check for custom window placement for Chrome OS.
if (GetBrowserBoundsChromeOS(bounds, show_state))
return;
#endif
......@@ -234,7 +234,7 @@ void WindowSizer::GetDefaultWindowBounds(const display::Display& display,
gfx::Rect* default_bounds) const {
DCHECK(default_bounds);
#if defined(OS_CHROMEOS)
*default_bounds = GetDefaultWindowBoundsAsh(browser_, display);
*default_bounds = GetDefaultWindowBoundsChromeOS(browser_, display);
#else
gfx::Rect work_area = display.work_area();
......
......@@ -103,7 +103,7 @@ class WindowSizer {
const StateProvider* state_provider() const { return state_provider_.get(); }
private:
friend class WindowSizerAshTest;
friend class WindowSizerChromeOSTest;
friend class WindowSizerTestUtil;
// WindowSizer will use the platforms's display::Screen.
......@@ -147,25 +147,26 @@ class WindowSizer {
gfx::Rect* bounds) const;
#if defined(OS_CHROMEOS)
// Ash specific logic for window placement. Returns true if |bounds| and
// Chrome OS specific logic for window placement. Returns true if |bounds| and
// |show_state| have been fully determined, otherwise returns false (but
// may still affect |show_state|).
// If the window is too big to fit in the display work area then the |bounds|
// are adjusted to default bounds and the |show_state| is adjusted to
// SHOW_STATE_MAXIMIZED.
bool GetBrowserBoundsAsh(gfx::Rect* bounds,
ui::WindowShowState* show_state) const;
bool GetBrowserBoundsChromeOS(gfx::Rect* bounds,
ui::WindowShowState* show_state) const;
// Determines the position and size for a tabbed browser window in
// ash as it gets created. This will be called before other standard
// placement logic. |show_state| will only be changed
// if it was set to SHOW_STATE_DEFAULT.
void GetTabbedBrowserBoundsAsh(gfx::Rect* bounds,
ui::WindowShowState* show_state) const;
void GetTabbedBrowserBoundsChromeOS(gfx::Rect* bounds,
ui::WindowShowState* show_state) const;
// Returns the default bounds for a |browser| window on |display|.
static gfx::Rect GetDefaultWindowBoundsAsh(const Browser* browser,
const display::Display& display);
static gfx::Rect GetDefaultWindowBoundsChromeOS(
const Browser* browser,
const display::Display& display);
#endif
// Determine the default show state for the window - not looking at other
......
......@@ -37,8 +37,9 @@ bool ShouldForceMaximizeOnFirstRun() {
} // namespace
bool WindowSizer::GetBrowserBoundsAsh(gfx::Rect* bounds,
ui::WindowShowState* show_state) const {
bool WindowSizer::GetBrowserBoundsChromeOS(
gfx::Rect* bounds,
ui::WindowShowState* show_state) const {
if (!browser_)
return false;
......@@ -48,16 +49,18 @@ bool WindowSizer::GetBrowserBoundsAsh(gfx::Rect* bounds,
bool determined = false;
if (bounds->IsEmpty()) {
if (browser_->is_type_normal()) {
GetTabbedBrowserBoundsAsh(bounds, show_state);
GetTabbedBrowserBoundsChromeOS(bounds, show_state);
determined = true;
} else if (browser_->is_trusted_source()) {
// For trusted popups (v1 apps and system windows), do not use the last
// active window bounds, only use saved or default bounds.
if (!GetSavedWindowBounds(bounds, show_state))
*bounds = GetDefaultWindowBoundsAsh(browser_, GetDisplayForNewWindow());
if (!GetSavedWindowBounds(bounds, show_state)) {
*bounds =
GetDefaultWindowBoundsChromeOS(browser_, GetDisplayForNewWindow());
}
determined = true;
} else if (state_provider_) {
// In Ash, prioritize the last saved |show_state|. If you have questions
// Finally, prioritize the last saved |show_state|. If you have questions
// or comments about this behavior please contact oshima@chromium.org.
gfx::Rect ignored_bounds, ignored_work_area;
state_provider_->GetPersistentState(&ignored_bounds, &ignored_work_area,
......@@ -76,14 +79,14 @@ bool WindowSizer::GetBrowserBoundsAsh(gfx::Rect* bounds,
// gets maximized after this method returns. Return a sensible default
// in order to make restored state visibly different from maximized.
*show_state = ui::SHOW_STATE_MAXIMIZED;
*bounds = GetDefaultWindowBoundsAsh(browser_, display);
*bounds = GetDefaultWindowBoundsChromeOS(browser_, display);
determined = true;
}
}
return determined;
}
void WindowSizer::GetTabbedBrowserBoundsAsh(
void WindowSizer::GetTabbedBrowserBoundsChromeOS(
gfx::Rect* bounds_in_screen,
ui::WindowShowState* show_state) const {
DCHECK(show_state);
......@@ -96,7 +99,7 @@ void WindowSizer::GetTabbedBrowserBoundsAsh(
bool is_saved_bounds = GetSavedWindowBounds(bounds_in_screen, show_state);
display::Display display = GetDisplayForNewWindow(*bounds_in_screen);
if (!is_saved_bounds)
*bounds_in_screen = GetDefaultWindowBoundsAsh(browser_, display);
*bounds_in_screen = GetDefaultWindowBoundsChromeOS(browser_, display);
if (browser_->is_session_restore()) {
// Respect display for saved bounds during session restore.
......@@ -126,7 +129,8 @@ void WindowSizer::GetTabbedBrowserBoundsAsh(
bounds_in_screen->AdjustToFit(display.work_area());
}
gfx::Rect WindowSizer::GetDefaultWindowBoundsAsh(
// static
gfx::Rect WindowSizer::GetDefaultWindowBoundsChromeOS(
const Browser* browser,
const display::Display& display) {
// Let apps set their own default.
......
......@@ -2554,7 +2554,7 @@ if (!is_android) {
"../browser/ui/webui/chromeos/system_web_dialog_browsertest.cc",
"../browser/ui/webui/settings/chromeos/account_manager_handler_browsertest.cc",
"../browser/ui/webui/settings/chromeos/device_power_handler_browsertest.cc",
"../browser/ui/window_sizer/window_sizer_ash_uitest.cc",
"../browser/ui/window_sizer/window_sizer_chromeos_uitest.cc",
"base/interactive_test_utils.cc",
"base/interactive_test_utils.h",
"base/interactive_test_utils_aura.cc",
......@@ -4537,7 +4537,7 @@ test("unit_tests") {
"../browser/ui/passwords/account_storage_auth_helper_unittest.cc",
"../browser/ui/webui/settings/settings_manage_profile_handler_unittest.cc",
# Chrome OS uses window_sizer_ash_unittest.cc
# Chrome OS uses window_sizer_chromeos_unittest.cc
"../browser/ui/window_sizer/window_sizer_unittest.cc",
]
sources += [
......@@ -4637,7 +4637,7 @@ test("unit_tests") {
"../browser/ui/webui/chromeos/login/fake_update_required_screen_handler.cc",
"../browser/ui/webui/chromeos/login/fake_update_required_screen_handler.h",
"../browser/ui/webui/chromeos/sync/os_sync_handler_unittest.cc",
"../browser/ui/window_sizer/window_sizer_ash_unittest.cc",
"../browser/ui/window_sizer/window_sizer_chromeos_unittest.cc",
]
deps += [
"//ash:test_support",
......
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