Commit 5d7e5bfc authored by Evan Stade's avatar Evan Stade Committed by Commit Bot

Mash: miscellaneous window related cleanups

- remove some window properties that had been used for theming
- remove dead member variable
- update comments
- use remove_standard_frame / kRemoveStandardFrame_InitProperty instead
  of kDisableImmersive_InitProperty for Mash browser windows

Bug: 887051
Change-Id: Ia7d64acebca600354162be9560bc64761bd3570e
Reviewed-on: https://chromium-review.googlesource.com/c/1255924Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Commit-Queue: Evan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/master@{#596357}
parent b0b10e58
...@@ -325,12 +325,7 @@ void HeaderView::UpdateCaptionButtonsVisibility() { ...@@ -325,12 +325,7 @@ void HeaderView::UpdateCaptionButtonsVisibility() {
if (!target_widget_) if (!target_widget_)
return; return;
caption_button_container_->SetVisible( caption_button_container_->SetVisible(should_paint_);
should_paint_ && !(Shell::Get()
->tablet_mode_controller()
->IsTabletModeWindowManagerEnabled() &&
target_widget_->GetNativeWindow()->GetProperty(
ash::kHideCaptionButtonsInTabletModeKey)));
} }
} // namespace ash } // namespace ash
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "ash/accelerators/accelerator_controller.h" #include "ash/accelerators/accelerator_controller.h"
#include "ash/frame/header_view.h" #include "ash/frame/header_view.h"
#include "ash/frame/wide_frame_view.h" #include "ash/frame/wide_frame_view.h"
#include "ash/public/cpp/app_list/app_list_features.h"
#include "ash/public/cpp/ash_layout_constants.h" #include "ash/public/cpp/ash_layout_constants.h"
#include "ash/public/cpp/ash_switches.h" #include "ash/public/cpp/ash_switches.h"
#include "ash/public/cpp/caption_buttons/frame_caption_button.h" #include "ash/public/cpp/caption_buttons/frame_caption_button.h"
...@@ -29,7 +28,6 @@ ...@@ -29,7 +28,6 @@
#include "ash/wm/wm_event.h" #include "ash/wm/wm_event.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/containers/flat_set.h" #include "base/containers/flat_set.h"
#include "base/test/scoped_feature_list.h"
#include "services/ws/public/mojom/window_tree_constants.mojom.h" #include "services/ws/public/mojom/window_tree_constants.mojom.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
...@@ -927,81 +925,4 @@ TEST_P(NonClientFrameViewAshFrameColorTest, WideFrameInitialColor) { ...@@ -927,81 +925,4 @@ TEST_P(NonClientFrameViewAshFrameColorTest, WideFrameInitialColor) {
// Run frame color tests with and without custom wm::WindowStateDelegate. // Run frame color tests with and without custom wm::WindowStateDelegate.
INSTANTIATE_TEST_CASE_P(, NonClientFrameViewAshFrameColorTest, testing::Bool()); INSTANTIATE_TEST_CASE_P(, NonClientFrameViewAshFrameColorTest, testing::Bool());
class HomeLauncherNonClientFrameViewAshTest : public AshTestBase {
public:
HomeLauncherNonClientFrameViewAshTest() = default;
~HomeLauncherNonClientFrameViewAshTest() override = default;
void SetUp() override {
scoped_feature_list_.InitAndEnableFeature(
app_list_features::kEnableHomeLauncher);
AshTestBase::SetUp();
}
private:
base::test::ScopedFeatureList scoped_feature_list_;
DISALLOW_COPY_AND_ASSIGN(HomeLauncherNonClientFrameViewAshTest);
};
// Tests the visibility of the caption button container when
// kHideCaptionButtonsInTabletModeKey is set.
TEST_F(HomeLauncherNonClientFrameViewAshTest,
TabletModeBrowserCaptionButtonVisibility) {
auto* delegate = new NonClientFrameViewAshTestWidgetDelegate();
std::unique_ptr<views::Widget> widget = CreateTestWidget(
delegate, kShellWindowId_DefaultContainer, gfx::Rect(100, 0, 400, 500));
widget->GetNativeWindow()->SetProperty(kHideCaptionButtonsInTabletModeKey,
true);
FrameCaptionButtonContainerView* caption_buttons =
delegate->non_client_frame_view()
->GetHeaderView()
->caption_button_container();
EXPECT_TRUE(caption_buttons->visible());
ash::Shell* shell = ash::Shell::Get();
ash::TabletModeController* tablet_mode_controller =
shell->tablet_mode_controller();
tablet_mode_controller->EnableTabletModeWindowManager(true);
EXPECT_FALSE(caption_buttons->visible());
shell->window_selector_controller()->ToggleOverview();
EXPECT_FALSE(caption_buttons->visible());
shell->window_selector_controller()->ToggleOverview();
EXPECT_FALSE(caption_buttons->visible());
tablet_mode_controller->EnableTabletModeWindowManager(false);
EXPECT_TRUE(caption_buttons->visible());
}
// Tests the visibility of the caption button container when
// kHideCaptionButtonsInTabletModeKey is not set.
TEST_F(HomeLauncherNonClientFrameViewAshTest,
TabletModeAppCaptionButtonVisibility) {
auto* delegate = new NonClientFrameViewAshTestWidgetDelegate();
std::unique_ptr<views::Widget> widget = CreateTestWidget(
delegate, kShellWindowId_DefaultContainer, gfx::Rect(100, 0, 400, 500));
FrameCaptionButtonContainerView* caption_buttons =
delegate->non_client_frame_view()
->GetHeaderView()
->caption_button_container();
EXPECT_TRUE(caption_buttons->visible());
ash::Shell* shell = ash::Shell::Get();
ash::TabletModeController* tablet_mode_controller =
shell->tablet_mode_controller();
tablet_mode_controller->EnableTabletModeWindowManager(true);
EXPECT_TRUE(caption_buttons->visible());
shell->window_selector_controller()->ToggleOverview();
EXPECT_FALSE(caption_buttons->visible());
shell->window_selector_controller()->ToggleOverview();
EXPECT_TRUE(caption_buttons->visible());
tablet_mode_controller->EnableTabletModeWindowManager(false);
EXPECT_TRUE(caption_buttons->visible());
}
} // namespace ash } // namespace ash
...@@ -164,7 +164,7 @@ void FrameHeader::SetLeftHeaderView(views::View* left_header_view) { ...@@ -164,7 +164,7 @@ void FrameHeader::SetLeftHeaderView(views::View* left_header_view) {
void FrameHeader::SetBackButton(FrameCaptionButton* back_button) { void FrameHeader::SetBackButton(FrameCaptionButton* back_button) {
back_button_ = back_button; back_button_ = back_button;
if (back_button_) { if (back_button_) {
back_button_->SetColorMode(GetButtonColorMode()); back_button_->SetColorMode(button_color_mode_);
back_button_->SetBackgroundColor(GetCurrentFrameColor()); back_button_->SetBackgroundColor(GetCurrentFrameColor());
back_button_->SetImage(CAPTION_BUTTON_ICON_BACK, back_button_->SetImage(CAPTION_BUTTON_ICON_BACK,
FrameCaptionButton::ANIMATE_NO, FrameCaptionButton::ANIMATE_NO,
...@@ -208,12 +208,10 @@ gfx::Rect FrameHeader::GetPaintedBounds() const { ...@@ -208,12 +208,10 @@ gfx::Rect FrameHeader::GetPaintedBounds() const {
} }
void FrameHeader::UpdateCaptionButtonColors() { void FrameHeader::UpdateCaptionButtonColors() {
auto button_color_mode = GetButtonColorMode(); caption_button_container_->SetColorMode(button_color_mode_);
caption_button_container_->SetColorMode(button_color_mode);
caption_button_container_->SetBackgroundColor(GetCurrentFrameColor()); caption_button_container_->SetBackgroundColor(GetCurrentFrameColor());
if (back_button_) { if (back_button_) {
back_button_->SetColorMode(button_color_mode); back_button_->SetColorMode(button_color_mode_);
back_button_->SetBackgroundColor(GetCurrentFrameColor()); back_button_->SetBackgroundColor(GetCurrentFrameColor());
} }
} }
...@@ -303,11 +301,4 @@ gfx::Rect FrameHeader::GetTitleBounds() const { ...@@ -303,11 +301,4 @@ gfx::Rect FrameHeader::GetTitleBounds() const {
GetHeaderHeight()); GetHeaderHeight());
} }
FrameCaptionButton::ColorMode FrameHeader::GetButtonColorMode() {
return target_widget()->GetNativeWindow()->GetProperty(
ash::kFrameIsThemedByHostedAppKey)
? FrameCaptionButton::ColorMode::kThemed
: FrameCaptionButton::ColorMode::kDefault;
}
} // namespace ash } // namespace ash
...@@ -78,6 +78,10 @@ class ASH_PUBLIC_EXPORT FrameHeader : public gfx::AnimationDelegate { ...@@ -78,6 +78,10 @@ class ASH_PUBLIC_EXPORT FrameHeader : public gfx::AnimationDelegate {
// gfx::AnimationDelegate: // gfx::AnimationDelegate:
void AnimationProgressed(const gfx::Animation* animation) override; void AnimationProgressed(const gfx::Animation* animation) override;
void set_button_color_mode(FrameCaptionButton::ColorMode button_color_mode) {
button_color_mode_ = button_color_mode;
}
protected: protected:
FrameHeader(views::Widget* target_widget, views::View* view); FrameHeader(views::Widget* target_widget, views::View* view);
...@@ -127,7 +131,8 @@ class ASH_PUBLIC_EXPORT FrameHeader : public gfx::AnimationDelegate { ...@@ -127,7 +131,8 @@ class ASH_PUBLIC_EXPORT FrameHeader : public gfx::AnimationDelegate {
gfx::Rect GetTitleBounds() const; gfx::Rect GetTitleBounds() const;
FrameCaptionButton::ColorMode GetButtonColorMode(); FrameCaptionButton::ColorMode button_color_mode_ =
FrameCaptionButton::ColorMode::kDefault;
// The widget that the caption buttons act on. This can be different from // The widget that the caption buttons act on. This can be different from
// |view_|'s widget. // |view_|'s widget.
......
...@@ -85,13 +85,6 @@ void MusPropertyMirrorAsh::MirrorPropertyFromWidgetWindowToRootWindow( ...@@ -85,13 +85,6 @@ void MusPropertyMirrorAsh::MirrorPropertyFromWidgetWindowToRootWindow(
} else if (key == kFrameInactiveColorKey) { } else if (key == kFrameInactiveColorKey) {
root_window->SetProperty(kFrameInactiveColorKey, root_window->SetProperty(kFrameInactiveColorKey,
window->GetProperty(kFrameInactiveColorKey)); window->GetProperty(kFrameInactiveColorKey));
} else if (key == kFrameIsThemedByHostedAppKey) {
root_window->SetProperty(kFrameIsThemedByHostedAppKey,
window->GetProperty(kFrameIsThemedByHostedAppKey));
} else if (key == kHideCaptionButtonsInTabletModeKey) {
root_window->SetProperty(
kHideCaptionButtonsInTabletModeKey,
window->GetProperty(kHideCaptionButtonsInTabletModeKey));
} else if (key == kImmersiveImpliedByFullscreen) { } else if (key == kImmersiveImpliedByFullscreen) {
root_window->SetProperty( root_window->SetProperty(
kImmersiveImpliedByFullscreen, kImmersiveImpliedByFullscreen,
......
...@@ -59,17 +59,10 @@ void RegisterWindowProperties(aura::PropertyConverter* property_converter) { ...@@ -59,17 +59,10 @@ void RegisterWindowProperties(aura::PropertyConverter* property_converter) {
kFrameActiveColorKey, kFrameActiveColorKey,
ws::mojom::WindowManager::kFrameActiveColor_Property, ws::mojom::WindowManager::kFrameActiveColor_Property,
aura::PropertyConverter::CreateAcceptAnyValueCallback()); aura::PropertyConverter::CreateAcceptAnyValueCallback());
property_converter->RegisterPrimitiveProperty(
kHideCaptionButtonsInTabletModeKey,
mojom::kHideCaptionButtonsInTabletMode_Property,
aura::PropertyConverter::CreateAcceptAnyValueCallback());
property_converter->RegisterPrimitiveProperty( property_converter->RegisterPrimitiveProperty(
kFrameInactiveColorKey, kFrameInactiveColorKey,
ws::mojom::WindowManager::kFrameInactiveColor_Property, ws::mojom::WindowManager::kFrameInactiveColor_Property,
aura::PropertyConverter::CreateAcceptAnyValueCallback()); aura::PropertyConverter::CreateAcceptAnyValueCallback());
property_converter->RegisterPrimitiveProperty(
kFrameIsThemedByHostedAppKey, mojom::kFrameIsThemedByHostedApp_Property,
aura::PropertyConverter::CreateAcceptAnyValueCallback());
property_converter->RegisterPrimitiveProperty( property_converter->RegisterPrimitiveProperty(
kHideShelfWhenFullscreenKey, mojom::kHideShelfWhenFullscreen_Property, kHideShelfWhenFullscreenKey, mojom::kHideShelfWhenFullscreen_Property,
aura::PropertyConverter::CreateAcceptAnyValueCallback()); aura::PropertyConverter::CreateAcceptAnyValueCallback());
...@@ -157,7 +150,6 @@ DEFINE_UI_CLASS_PROPERTY_KEY(BackdropWindowMode, ...@@ -157,7 +150,6 @@ DEFINE_UI_CLASS_PROPERTY_KEY(BackdropWindowMode,
DEFINE_UI_CLASS_PROPERTY_KEY(bool, kBlockedForAssistantSnapshotKey, false); DEFINE_UI_CLASS_PROPERTY_KEY(bool, kBlockedForAssistantSnapshotKey, false);
DEFINE_UI_CLASS_PROPERTY_KEY(bool, kCanAttachToAnotherWindowKey, true); DEFINE_UI_CLASS_PROPERTY_KEY(bool, kCanAttachToAnotherWindowKey, true);
DEFINE_UI_CLASS_PROPERTY_KEY(bool, kCanConsumeSystemKeysKey, false); DEFINE_UI_CLASS_PROPERTY_KEY(bool, kCanConsumeSystemKeysKey, false);
DEFINE_UI_CLASS_PROPERTY_KEY(bool, kHideCaptionButtonsInTabletModeKey, false);
DEFINE_UI_CLASS_PROPERTY_KEY(bool, kHideInOverviewKey, false); DEFINE_UI_CLASS_PROPERTY_KEY(bool, kHideInOverviewKey, false);
DEFINE_UI_CLASS_PROPERTY_KEY(bool, kHideShelfWhenFullscreenKey, true); DEFINE_UI_CLASS_PROPERTY_KEY(bool, kHideShelfWhenFullscreenKey, true);
DEFINE_UI_CLASS_PROPERTY_KEY(bool, kImmersiveImpliedByFullscreen, true); DEFINE_UI_CLASS_PROPERTY_KEY(bool, kImmersiveImpliedByFullscreen, true);
...@@ -196,7 +188,6 @@ DEFINE_UI_CLASS_PROPERTY_KEY(SkColor, kFrameActiveColorKey, kDefaultFrameColor); ...@@ -196,7 +188,6 @@ DEFINE_UI_CLASS_PROPERTY_KEY(SkColor, kFrameActiveColorKey, kDefaultFrameColor);
DEFINE_UI_CLASS_PROPERTY_KEY(SkColor, DEFINE_UI_CLASS_PROPERTY_KEY(SkColor,
kFrameInactiveColorKey, kFrameInactiveColorKey,
kDefaultFrameColor); kDefaultFrameColor);
DEFINE_UI_CLASS_PROPERTY_KEY(bool, kFrameIsThemedByHostedAppKey, false);
DEFINE_UI_CLASS_PROPERTY_KEY(mojom::WindowPinType, DEFINE_UI_CLASS_PROPERTY_KEY(mojom::WindowPinType,
kWindowPinTypeKey, kWindowPinTypeKey,
mojom::WindowPinType::NONE); mojom::WindowPinType::NONE);
......
...@@ -68,11 +68,6 @@ ASH_PUBLIC_EXPORT extern const aura::WindowProperty<bool>* const ...@@ -68,11 +68,6 @@ ASH_PUBLIC_EXPORT extern const aura::WindowProperty<bool>* const
ASH_PUBLIC_EXPORT extern const aura::WindowProperty<bool>* const ASH_PUBLIC_EXPORT extern const aura::WindowProperty<bool>* const
kCanConsumeSystemKeysKey; kCanConsumeSystemKeysKey;
// A property to control the visibility of the frame captions buttons when in
// tablet mode (when not in tablet mode, this property is ignored).
ASH_PUBLIC_EXPORT extern const aura::WindowProperty<bool>* const
kHideCaptionButtonsInTabletModeKey;
// A property key to indicate whether we should hide this window in overview // A property key to indicate whether we should hide this window in overview
// mode and Alt + Tab. // mode and Alt + Tab.
ASH_PUBLIC_EXPORT extern const aura::WindowProperty<bool>* const ASH_PUBLIC_EXPORT extern const aura::WindowProperty<bool>* const
...@@ -172,11 +167,6 @@ ASH_PUBLIC_EXPORT extern const aura::WindowProperty<SkColor>* const ...@@ -172,11 +167,6 @@ ASH_PUBLIC_EXPORT extern const aura::WindowProperty<SkColor>* const
ASH_PUBLIC_EXPORT extern const aura::WindowProperty<SkColor>* const ASH_PUBLIC_EXPORT extern const aura::WindowProperty<SkColor>* const
kFrameInactiveColorKey; kFrameInactiveColorKey;
// True when the frame colors were provided by a hosted app, i.e. by a
// progressive web app manifest.
ASH_PUBLIC_EXPORT extern const aura::WindowProperty<bool>* const
kFrameIsThemedByHostedAppKey;
// A property key to store ash::WindowPinType for a window. // A property key to store ash::WindowPinType for a window.
// When setting this property to PINNED or TRUSTED_PINNED, the window manager // When setting this property to PINNED or TRUSTED_PINNED, the window manager
// will try to fullscreen the window and pin it on the top of the screen. If the // will try to fullscreen the window and pin it on the top of the screen. If the
......
...@@ -18,31 +18,19 @@ const string kBlockedForAssistantSnapshot_Property = ...@@ -18,31 +18,19 @@ const string kBlockedForAssistantSnapshot_Property =
const string kCanConsumeSystemKeys_Property = const string kCanConsumeSystemKeys_Property =
"ash:can-consume-system-keys"; "ash:can-consume-system-keys";
// A boolean that tells Ash whether the frame's colors come from a PWA manifest.
const string kFrameIsThemedByHostedApp_Property =
"ash:frame-is-themed-by-hosted-app";
// The color of the text drawn on the frame (i.e. the window title). Only used
// for tabless browser windows.
const string kFrameTextColor_Property = "ash:frame-text-color";
// See ash::kHideCaptionButtonsInTabletModeKey.
const string kHideCaptionButtonsInTabletMode_Property =
"ash:hide-caption-buttons-in-tablet-mode";
// True if the shelf should be hidden when this window is put into fullscreen. // True if the shelf should be hidden when this window is put into fullscreen.
// Exposed because some windows want to explicitly opt-out of this. // Exposed because some windows want to explicitly opt-out of this.
const string kHideShelfWhenFullscreen_Property = const string kHideShelfWhenFullscreen_Property =
"ash:hide-shelf-when-fullscreen"; "ash:hide-shelf-when-fullscreen";
// See ash::kImmseriveImpliedByFullscreen. // See ash::kImmersiveImpliedByFullscreen.
const string kImmersiveImpliedByFullscreen_Property = const string kImmersiveImpliedByFullscreen_Property =
"ash:immersive-implied-by-fullscreen"; "ash:immersive-implied-by-fullscreen";
// See ash::kImmseriveIsActive. // See ash::kImmersiveIsActive.
const string kImmersiveIsActive_Property = "ash:immersive-is-active"; const string kImmersiveIsActive_Property = "ash:immersive-is-active";
// See ash::kImmseriveTopContainerBoundsInScreen. // See ash::kImmersiveTopContainerBoundsInScreen.
const string kImmersiveTopContainerBoundsInScreen_Property = const string kImmersiveTopContainerBoundsInScreen_Property =
"ash:immersive-top-container-bounds-in-screen"; "ash:immersive-top-container-bounds-in-screen";
......
...@@ -81,15 +81,13 @@ class EmptyDraggableNonClientFrameView : public views::NonClientFrameView { ...@@ -81,15 +81,13 @@ class EmptyDraggableNonClientFrameView : public views::NonClientFrameView {
class WmNativeWidgetAura : public views::NativeWidgetAura { class WmNativeWidgetAura : public views::NativeWidgetAura {
public: public:
WmNativeWidgetAura(views::internal::NativeWidgetDelegate* delegate, WmNativeWidgetAura(views::internal::NativeWidgetDelegate* delegate,
bool remove_standard_frame, bool remove_standard_frame)
bool should_ash_control_immersive)
// The NativeWidget is mirroring the real Widget created in client code. // The NativeWidget is mirroring the real Widget created in client code.
// |is_parallel_widget_in_window_manager| is used to indicate this // |is_parallel_widget_in_window_manager| is used to indicate this
: views::NativeWidgetAura(delegate, : views::NativeWidgetAura(delegate,
true /* is_parallel_widget_in_window_manager */, true /* is_parallel_widget_in_window_manager */,
Shell::Get()->aura_env()), Shell::Get()->aura_env()),
remove_standard_frame_(remove_standard_frame), remove_standard_frame_(remove_standard_frame) {}
should_ash_control_immersive_(should_ash_control_immersive) {}
~WmNativeWidgetAura() override = default; ~WmNativeWidgetAura() override = default;
void set_cursor(const ui::Cursor& cursor) { cursor_ = cursor; } void set_cursor(const ui::Cursor& cursor) { cursor_ = cursor; }
...@@ -98,12 +96,8 @@ class WmNativeWidgetAura : public views::NativeWidgetAura { ...@@ -98,12 +96,8 @@ class WmNativeWidgetAura : public views::NativeWidgetAura {
views::NonClientFrameView* CreateNonClientFrameView() override { views::NonClientFrameView* CreateNonClientFrameView() override {
// TODO(sky): investigate why we have this. Seems this should be the same // TODO(sky): investigate why we have this. Seems this should be the same
// as not specifying client area insets. // as not specifying client area insets.
if (remove_standard_frame_) if (remove_standard_frame_) {
return new EmptyDraggableNonClientFrameView(); wm::InstallResizeHandleWindowTargeterForWindow(GetNativeWindow());
aura::Window* window = GetNativeView();
if (!should_ash_control_immersive_) {
wm::InstallResizeHandleWindowTargeterForWindow(window);
return new EmptyDraggableNonClientFrameView(); return new EmptyDraggableNonClientFrameView();
} }
...@@ -129,7 +123,6 @@ class WmNativeWidgetAura : public views::NativeWidgetAura { ...@@ -129,7 +123,6 @@ class WmNativeWidgetAura : public views::NativeWidgetAura {
private: private:
const bool remove_standard_frame_; const bool remove_standard_frame_;
const bool should_ash_control_immersive_;
// The cursor for this widget. CompoundEventFilter will retrieve this cursor // The cursor for this widget. CompoundEventFilter will retrieve this cursor
// via GetCursor and update the CursorManager's active cursor as appropriate // via GetCursor and update the CursorManager's active cursor as appropriate
...@@ -225,8 +218,7 @@ NonClientFrameController::NonClientFrameController( ...@@ -225,8 +218,7 @@ NonClientFrameController::NonClientFrameController(
params.opacity = views::Widget::InitParams::OPAQUE_WINDOW; params.opacity = views::Widget::InitParams::OPAQUE_WINDOW;
params.layer_type = ui::LAYER_SOLID_COLOR; params.layer_type = ui::LAYER_SOLID_COLOR;
WmNativeWidgetAura* native_widget = WmNativeWidgetAura* native_widget =
new WmNativeWidgetAura(widget_, ShouldRemoveStandardFrame(*properties), new WmNativeWidgetAura(widget_, ShouldRemoveStandardFrame(*properties));
ShouldEnableImmersive(*properties));
window_ = native_widget->GetNativeView(); window_ = native_widget->GetNativeView();
window_->SetProperty(kNonClientFrameControllerKey, this); window_->SetProperty(kNonClientFrameControllerKey, this);
window_->SetProperty(kWidgetCreationTypeKey, WidgetCreationType::FOR_CLIENT); window_->SetProperty(kWidgetCreationTypeKey, WidgetCreationType::FOR_CLIENT);
......
...@@ -57,12 +57,6 @@ bool ShouldRemoveStandardFrame(const InitProperties& properties) { ...@@ -57,12 +57,6 @@ bool ShouldRemoveStandardFrame(const InitProperties& properties) {
return iter != properties.end() && mojo::ConvertTo<bool>(iter->second); return iter != properties.end() && mojo::ConvertTo<bool>(iter->second);
} }
bool ShouldEnableImmersive(const InitProperties& properties) {
auto iter =
properties.find(ws::mojom::WindowManager::kDisableImmersive_InitProperty);
return iter == properties.end() || !mojo::ConvertTo<bool>(iter->second);
}
void ApplyProperties( void ApplyProperties(
aura::Window* window, aura::Window* window,
aura::PropertyConverter* property_converter, aura::PropertyConverter* property_converter,
......
...@@ -55,8 +55,6 @@ bool GetWindowPreferredSize(const InitProperties& properties, gfx::Size* size); ...@@ -55,8 +55,6 @@ bool GetWindowPreferredSize(const InitProperties& properties, gfx::Size* size);
bool ShouldRemoveStandardFrame(const InitProperties& properties); bool ShouldRemoveStandardFrame(const InitProperties& properties);
bool ShouldEnableImmersive(const InitProperties& properties);
// Applies |properties| to |window| using |property_converter|. // Applies |properties| to |window| using |property_converter|.
void ApplyProperties( void ApplyProperties(
aura::Window* window, aura::Window* window,
......
...@@ -97,8 +97,10 @@ class InteriorResizeHandleTargeter : public aura::WindowTargeter { ...@@ -97,8 +97,10 @@ class InteriorResizeHandleTargeter : public aura::WindowTargeter {
bool ShouldUseExtendedBounds(const aura::Window* target) const override { bool ShouldUseExtendedBounds(const aura::Window* target) const override {
// Fullscreen/maximized windows can't be drag-resized. // Fullscreen/maximized windows can't be drag-resized.
if (GetWindowState(window())->IsMaximizedOrFullscreenOrPinned()) if (GetWindowState(window())->IsMaximizedOrFullscreenOrPinned() ||
!wm::GetWindowState(target)->CanResize()) {
return false; return false;
}
// The shrunken hit region only applies to children of |window()|. // The shrunken hit region only applies to children of |window()|.
return target->parent() == window(); return target->parent() == window();
......
...@@ -58,9 +58,9 @@ views::Widget::InitParams BrowserFrameMash::GetWidgetParams() { ...@@ -58,9 +58,9 @@ views::Widget::InitParams BrowserFrameMash::GetWidgetParams() {
params.delegate = browser_view_; params.delegate = browser_view_;
std::map<std::string, std::vector<uint8_t>> properties = std::map<std::string, std::vector<uint8_t>> properties =
views::MusClient::ConfigurePropertiesFromParams(params); views::MusClient::ConfigurePropertiesFromParams(params);
// Indicates mash shouldn't handle immersive, rather we will.
properties[ws::mojom::WindowManager::kDisableImmersive_InitProperty] = // The client will draw the frame.
mojo::ConvertTo<std::vector<uint8_t>>(true); params.remove_standard_frame = true;
// ChromeLauncherController manages the browser shortcut shelf item; set the // ChromeLauncherController manages the browser shortcut shelf item; set the
// window's shelf item type property to be ignored by ash::ShelfWindowWatcher. // window's shelf item type property to be ignored by ash::ShelfWindowWatcher.
......
...@@ -186,17 +186,6 @@ void BrowserNonClientFrameViewAsh::Init() { ...@@ -186,17 +186,6 @@ void BrowserNonClientFrameViewAsh::Init() {
static_cast<int>(browser->is_app() ? ash::AppType::CHROME_APP static_cast<int>(browser->is_app() ? ash::AppType::CHROME_APP
: ash::AppType::BROWSER)); : ash::AppType::BROWSER));
// In tablet mode, to prevent accidental taps of the window controls, and to
// give more horizontal space for tabs and the new tab button especially in
// splitscreen view, we hide the window controls. We only do this when the
// Home Launcher feature is enabled, since it gives the user the ability to
// minimize all windows when pressing the Launcher button on the shelf.
window->SetProperty(
ash::kHideCaptionButtonsInTabletModeKey,
(browser->is_app() || !app_list_features::IsHomeLauncherEnabled())
? false
: true);
window_observer_.Add(GetFrameWindow()); window_observer_.Add(GetFrameWindow());
// To preserve privacy, tag incognito windows so that they won't be included // To preserve privacy, tag incognito windows so that they won't be included
...@@ -452,8 +441,6 @@ void BrowserNonClientFrameViewAsh::OnThemeChanged() { ...@@ -452,8 +441,6 @@ void BrowserNonClientFrameViewAsh::OnThemeChanged() {
void BrowserNonClientFrameViewAsh::ChildPreferredSizeChanged( void BrowserNonClientFrameViewAsh::ChildPreferredSizeChanged(
views::View* child) { views::View* child) {
// This is required even when Ash provides the header (as in Mash) for the
// |hosted_app_button_container_|.
if (browser_view()->initialized()) { if (browser_view()->initialized()) {
InvalidateLayout(); InvalidateLayout();
frame()->GetRootView()->Layout(); frame()->GetRootView()->Layout();
...@@ -744,9 +731,15 @@ void BrowserNonClientFrameViewAsh::OnProfileAvatarChanged( ...@@ -744,9 +731,15 @@ void BrowserNonClientFrameViewAsh::OnProfileAvatarChanged(
// BrowserNonClientFrameViewAsh, private: // BrowserNonClientFrameViewAsh, private:
bool BrowserNonClientFrameViewAsh::ShouldShowCaptionButtons() const { bool BrowserNonClientFrameViewAsh::ShouldShowCaptionButtons() const {
if (frame()->GetNativeWindow()->GetProperty( // In tablet mode, to prevent accidental taps of the window controls, and to
ash::kHideCaptionButtonsInTabletModeKey) && // give more horizontal space for tabs and the new tab button especially in
TabletModeClient::Get() && // splitscreen view, we hide the window controls. We only do this when the
// Home Launcher feature is enabled, since it gives the user the ability to
// minimize all windows when pressing the Launcher button on the shelf.
const bool hide_caption_buttons_in_tablet_mode =
!browser_view()->browser()->is_app() &&
app_list_features::IsHomeLauncherEnabled();
if (hide_caption_buttons_in_tablet_mode && TabletModeClient::Get() &&
TabletModeClient::Get()->tablet_mode_enabled()) { TabletModeClient::Get()->tablet_mode_enabled()) {
return false; return false;
} }
...@@ -823,11 +816,8 @@ void BrowserNonClientFrameViewAsh::SetUpForHostedApp( ...@@ -823,11 +816,8 @@ void BrowserNonClientFrameViewAsh::SetUpForHostedApp(
base::Optional<SkColor> theme_color = base::Optional<SkColor> theme_color =
browser->hosted_app_controller()->GetThemeColor(); browser->hosted_app_controller()->GetThemeColor();
if (theme_color) { if (theme_color) {
frame()->GetNativeWindow()->SetProperty( header->set_button_color_mode(ash::FrameCaptionButton::ColorMode::kThemed);
ash::kFrameIsThemedByHostedAppKey,
!!browser->hosted_app_controller()->GetThemeColor());
header->SetFrameColors(*theme_color, *theme_color); header->SetFrameColors(*theme_color, *theme_color);
active_color = ash::FrameCaptionButton::GetButtonColor( active_color = ash::FrameCaptionButton::GetButtonColor(
ash::FrameCaptionButton::ColorMode::kThemed, *theme_color); ash::FrameCaptionButton::ColorMode::kThemed, *theme_color);
} }
...@@ -852,7 +842,9 @@ void BrowserNonClientFrameViewAsh::UpdateFrameColors() { ...@@ -852,7 +842,9 @@ void BrowserNonClientFrameViewAsh::UpdateFrameColors() {
IsForExperimentalHostedAppBrowser(browser_view()->browser())) { IsForExperimentalHostedAppBrowser(browser_view()->browser())) {
active_color = active_color =
browser_view()->browser()->hosted_app_controller()->GetThemeColor(); browser_view()->browser()->hosted_app_controller()->GetThemeColor();
window->SetProperty(ash::kFrameIsThemedByHostedAppKey, !!active_color); frame_header_->set_button_color_mode(
active_color ? ash::FrameCaptionButton::ColorMode::kThemed
: ash::FrameCaptionButton::ColorMode::kDefault);
} else if (!browser_view()->browser()->is_app()) { } else if (!browser_view()->browser()->is_app()) {
active_color = kMdWebUiFrameColor; active_color = kMdWebUiFrameColor;
} }
......
...@@ -247,11 +247,6 @@ class BrowserNonClientFrameViewAsh ...@@ -247,11 +247,6 @@ class BrowserNonClientFrameViewAsh
// Owned by views hierarchy. // Owned by views hierarchy.
HostedAppButtonContainer* hosted_app_button_container_ = nullptr; HostedAppButtonContainer* hosted_app_button_container_ = nullptr;
// A view that contains the extra views used for hosted apps
// (|hosted_app_button_container_| and |hosted_app_origin_text_|).
// Only used in Mash.
views::View* hosted_app_extras_container_ = nullptr;
// Ash's mojom::SplitViewController. // Ash's mojom::SplitViewController.
ash::mojom::SplitViewControllerPtr split_view_controller_; ash::mojom::SplitViewControllerPtr split_view_controller_;
......
...@@ -34,11 +34,6 @@ interface WindowManager { ...@@ -34,11 +34,6 @@ interface WindowManager {
// Type: int32_t. // Type: int32_t.
const string kContainerId_InitProperty = "init:container_id"; const string kContainerId_InitProperty = "init:container_id";
// Disables the window manager from handling immersive fullscreen for the
// window. This is typically done if the client wants to handle immersive
// themselves. Type: bool.
const string kDisableImmersive_InitProperty = "init:disable_immersive";
// The id of the display (display::Display::id()) to create the window on. // The id of the display (display::Display::id()) to create the window on.
// Type: int64. // Type: int64.
const string kDisplayId_InitProperty = "init:display_id"; const string kDisplayId_InitProperty = "init:display_id";
......
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