Ignore updatePipBounds before initial bounds is set

When PIP enter/exit transition happens, window state change and
initial bounds change are committed in the same commit. However,
as state change is applied first in OnPreWidgetCommit and the
bounds is update later, if updatePipBounds is called between the
gap, it ends up returning a wrong bounds based on the previous
bounds.

Currently, there are two callstacks that end up triggering
updatePipBounds between the gap: (i) The state change causes
OnWindowAddedToLayout and updatePipBounds is called in OnWMEvent,
(ii) updatePipBounds is called in UpdatePipState to prevent it
from being placed under some system ui.

As it doesn't make sense to call updatePipBounds before the first
bounds is not set, this CL adds a boolean to defer updatePipBounds.

position.

Bug: b130782006
Test: Got VLC into PIP and confirmed it was placed at the correct
Change-Id: I5b9f3644bfb2533fd3f905bc09d49708a5d08a90
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1578719
Commit-Queue: Kazuki Takise <takise@chromium.org>
Auto-Submit: Kazuki Takise <takise@chromium.org>
Reviewed-by: Mitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#668724}
  void OnBoundsChangeEvent(ClientControlledShellSurface* shell_surface,
                           ash::WindowStateType current_state,
                           ash::WindowStateType requested_state,
                           int64_t display_id,
                           const gfx::Rect& bounds_in_screen,
                           bool is_resize,
                           int bounds_change) {
    bounds_change_count_++;

    display::Display target_display;
    const display::Screen* screen = display::Screen::GetScreen();

    ASSERT_TRUE(screen->GetDisplayWithDisplayId(display_id, &target_display));
    gfx::Rect bounds_in_display(bounds_in_screen);
    bounds_in_display.Offset(-target_display.bounds().OffsetFromOrigin());

    requested_bounds_.push_back(bounds_in_display);
    requested_display_ids_.push_back(display_id);
  }

  void OnBoundsChangeEvent(ClientControlledShellSurface* shell_surface,
                           ash::WindowStateType current_state,
                           ash::WindowStateType requested_state,
                           int64_t display_id,
                           const gfx::Rect& bounds_in_screen,
                           bool is_resize,
                           int bounds_change) {
    bounds_change_count_++;

    display::Display target_display;
    const display::Screen* screen = display::Screen::GetScreen();

    ASSERT_TRUE(screen->GetDisplayWithDisplayId(display_id, &target_display));
    gfx::Rect bounds_in_display(bounds_in_screen);
    bounds_in_display.Offset(-target_display.bounds().OffsetFromOrigin());

    requested_bounds_.push_back(bounds_in_display);
    requested_display_ids_.push_back(display_id);
  }
