diff options
author | skuhne@chromium.org <skuhne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-02 07:53:47 +0000 |
---|---|---|
committer | skuhne@chromium.org <skuhne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-02 07:53:47 +0000 |
commit | a4016f15e7abb41735dc3eec9e4d9dcb4b0d4fa5 (patch) | |
tree | f559e0dcd34863c861ccad534a9ad7eb88bcfaf2 /ash | |
parent | 7abe41339b91e2c75f4b2b811c48794280d0116c (diff) | |
download | chromium_src-a4016f15e7abb41735dc3eec9e4d9dcb4b0d4fa5.zip chromium_src-a4016f15e7abb41735dc3eec9e4d9dcb4b0d4fa5.tar.gz chromium_src-a4016f15e7abb41735dc3eec9e4d9dcb4b0d4fa5.tar.bz2 |
Adding experimental maximize mode (behind a flag)
This experimental feature is behind a flag and allows our user interface designers to experiment with an always maximized window mode. It also removes certain context menu options which make no sense in that mode anymore.
No goals for this CL are:
- The minimal / maximal window size properties of V2 apps will get ignored, and the apps will always get maximized.
- Rather then not creating buttons in the first place, they only get hidden to keep the changes to the code to a minimum.
Note: Since this feature is entirely experimental + behind a flag + subject to change + does only contain minor behavioral changes, there are no unit tests for this at this time.
BUG=230510
TEST=visual (browser, hosted apps, V1 apps)
Review URL: https://chromiumcodereview.appspot.com/13934007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@197856 0039d316-1c4b-4281-b951-d872f2087c98
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( |