diff options
Diffstat (limited to 'ash')
-rw-r--r-- | ash/ash_switches.cc | 5 | ||||
-rw-r--r-- | ash/ash_switches.h | 1 | ||||
-rw-r--r-- | ash/shell.cc | 6 | ||||
-rw-r--r-- | ash/shell.h | 4 | ||||
-rw-r--r-- | ash/wm/workspace/frame_maximize_button.cc | 11 | ||||
-rw-r--r-- | ash/wm/workspace/frame_maximize_button.h | 3 | ||||
-rw-r--r-- | ash/wm/workspace/workspace_event_handler.cc | 3 |
7 files changed, 31 insertions, 2 deletions
diff --git a/ash/ash_switches.cc b/ash/ash_switches.cc index 1b18492..516fa60 100644 --- a/ash/ash_switches.cc +++ b/ash/ash_switches.cc @@ -141,8 +141,11 @@ const char kAuraLegacyPowerButton[] = "aura-legacy-power-button"; // Force Ash to open its root window on the desktop, even on Windows 8 where // it would normally end up in metro. const char kForceAshToDesktop[] = "ash-force-desktop"; -; #endif +// Enables a mode which enforces all browser & application windows to be created +// in maximized mode. +const char kForcedMaximizeMode[] = "forced-maximize-mode"; + } // namespace switches } // namespace ash diff --git a/ash/ash_switches.h b/ash/ash_switches.h index f25647a..003cd35 100644 --- a/ash/ash_switches.h +++ b/ash/ash_switches.h @@ -55,6 +55,7 @@ ASH_EXPORT extern const char kAuraLegacyPowerButton[]; #if defined(OS_WIN) ASH_EXPORT extern const char kForceAshToDesktop[]; #endif +ASH_EXPORT extern const char kForcedMaximizeMode[]; } // namespace switches } // namespace ash diff --git a/ash/shell.cc b/ash/shell.cc index 589caed..203145b 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -419,6 +419,12 @@ bool Shell::IsLauncherPerDisplayEnabled() { return !command_line->HasSwitch(switches::kAshDisableLauncherPerDisplay); } +// static +bool Shell::IsForcedMaximizeMode() { + CommandLine* command_line = CommandLine::ForCurrentProcess(); + return command_line->HasSwitch(switches::kForcedMaximizeMode); +} + void Shell::Init() { delegate_->PreInit(); #if defined(OS_CHROMEOS) && defined(USE_X11) diff --git a/ash/shell.h b/ash/shell.h index 92ef58c..43ee1c6 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -200,6 +200,10 @@ class ASH_EXPORT Shell // True if "launcher per display" feature is enabled. static bool IsLauncherPerDisplayEnabled(); + // True if an experimental maximize mode is enabled which forces browser and + // application windows to be maximized only. + static bool IsForcedMaximizeMode(); + void set_active_root_window(aura::RootWindow* active_root_window) { active_root_window_ = active_root_window; } diff --git a/ash/wm/workspace/frame_maximize_button.cc b/ash/wm/workspace/frame_maximize_button.cc index d258b378..0329e3f 100644 --- a/ash/wm/workspace/frame_maximize_button.cc +++ b/ash/wm/workspace/frame_maximize_button.cc @@ -91,6 +91,9 @@ FrameMaximizeButton::FrameMaximizeButton(views::ButtonListener* listener, bubble_appearance_delay_ms_(kBubbleAppearanceDelayMS) { // TODO(sky): nuke this. It's temporary while we don't have good images. SetImageAlignment(ALIGN_LEFT, ALIGN_BOTTOM); + + if (ash::Shell::IsForcedMaximizeMode()) + views::View::SetVisible(false); } FrameMaximizeButton::~FrameMaximizeButton() { @@ -306,6 +309,14 @@ void FrameMaximizeButton::OnGestureEvent(ui::GestureEvent* event) { ImageButton::OnGestureEvent(event); } +void FrameMaximizeButton::SetVisible(bool visible) { + // In the enforced maximized mode we do not allow to be made visible. + if (ash::Shell::IsForcedMaximizeMode()) + return; + + views::View::SetVisible(visible); +} + void FrameMaximizeButton::ProcessStartEvent(const ui::LocatedEvent& event) { DCHECK(is_snap_enabled_); // Prepare the help menu. diff --git a/ash/wm/workspace/frame_maximize_button.h b/ash/wm/workspace/frame_maximize_button.h index b6aa1fa..6429aed 100644 --- a/ash/wm/workspace/frame_maximize_button.h +++ b/ash/wm/workspace/frame_maximize_button.h @@ -74,6 +74,9 @@ class ASH_EXPORT FrameMaximizeButton : public views::ImageButton, // ui::EventHandler overrides: virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; + // views::View overwrite: + virtual void SetVisible(bool visible) OVERRIDE; + // Unit test overwrite: Change the UI delay used for the bubble show up. void set_bubble_appearance_delay_ms(int bubble_appearance_delay_ms) { bubble_appearance_delay_ms_ = bubble_appearance_delay_ms; diff --git a/ash/wm/workspace/workspace_event_handler.cc b/ash/wm/workspace/workspace_event_handler.cc index 5839e21..16d86ca 100644 --- a/ash/wm/workspace/workspace_event_handler.cc +++ b/ash/wm/workspace/workspace_event_handler.cc @@ -91,7 +91,8 @@ void WorkspaceEventHandler::OnMouseEvent(ui::MouseEvent* event) { if (event->flags() & ui::EF_IS_DOUBLE_CLICK && target->delegate()->GetNonClientComponent(event->location()) == - HTCAPTION) { + HTCAPTION && + !ash::Shell::IsForcedMaximizeMode()) { bool destroyed = false; destroyed_ = &destroyed; ash::Shell::GetInstance()->delegate()->RecordUserMetricsAction( |