summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui
diff options
context:
space:
mode:
authorjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-07 05:28:34 +0000
committerjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-07 05:28:34 +0000
commitc71191ad33533448a1e18a70ab27eca59edf22b7 (patch)
tree122e702ee0c34f5ea9540d6c4aa2e77029741035 /chrome/browser/ui
parent6f54879f441c7d499517e6fcecb639e220bce9b0 (diff)
downloadchromium_src-c71191ad33533448a1e18a70ab27eca59edf22b7.zip
chromium_src-c71191ad33533448a1e18a70ab27eca59edf22b7.tar.gz
chromium_src-c71191ad33533448a1e18a70ab27eca59edf22b7.tar.bz2
Ash: Use translucent frames by default
Remove --aura-translucent-frames switch. Tie old-style frames to the existing --aura-window-mode=compact flag. Also fix a couple of cases where views::Widget wasn't be flagged as transparent, which would lead to black pixels in the window corners and incorrect headers in the inactive state. (Edit: I had to back out the conversion of constrained windows -- it breaks some unit tests and needs to be changed slightly.) BUG=113075 TEST=visual, look at active and inactive browser windows, popup windows, task manager (general dialog) Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=125251 Reverted: http://src.chromium.org/viewvc/chrome?view=rev&revision=125266 Review URL: http://codereview.chromium.org/9618022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125333 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui')
-rw-r--r--chrome/browser/ui/views/constrained_window_views.cc11
-rw-r--r--chrome/browser/ui/views/frame/browser_frame.cc5
-rw-r--r--chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_aura.cc18
-rw-r--r--chrome/browser/ui/views/window.cc31
4 files changed, 47 insertions, 18 deletions
diff --git a/chrome/browser/ui/views/constrained_window_views.cc b/chrome/browser/ui/views/constrained_window_views.cc
index fb42722..e8d9ad8 100644
--- a/chrome/browser/ui/views/constrained_window_views.cc
+++ b/chrome/browser/ui/views/constrained_window_views.cc
@@ -566,6 +566,9 @@ ConstrainedWindowViews::ConstrainedWindowViews(
params.native_widget = native_constrained_window_->AsNativeWidget();
params.child = true;
params.parent = wrapper->web_contents()->GetNativeView();
+ // TODO(jamescook): In non-compact mode the window header can be transparent.
+ // Check defined(USE_AURA) and set params.transparent = true.
+ // Don't use Shell::GetInstance() here as some tests run this without a Shell.
Init(params);
wrapper_->constrained_window_tab_helper()->AddConstrainedDialog(this);
@@ -612,10 +615,12 @@ gfx::NativeWindow ConstrainedWindowViews::GetNativeWindow() {
views::NonClientFrameView* ConstrainedWindowViews::CreateNonClientFrameView() {
#if defined(USE_AURA)
CommandLine* command_line = CommandLine::ForCurrentProcess();
- if (command_line->HasSwitch(ash::switches::kAuraGoogleDialogFrames) ||
- command_line->HasSwitch(ash::switches::kAuraTranslucentFrames)) {
+ if (command_line->HasSwitch(ash::switches::kAuraGoogleDialogFrames))
return ash::Shell::GetInstance()->CreateDefaultNonClientFrameView(this);
- }
+ // TODO(jamescook): In non-compact mode we should use fancy translucent
+ // headers. Figure out how to handle closing the window and communication
+ // with the ConstrainedWindowTabHelper. Avoid Shell::GetInstance() as
+ // some tests run this without a Shell.
#endif
return new ConstrainedWindowFrameView(this);
}
diff --git a/chrome/browser/ui/views/frame/browser_frame.cc b/chrome/browser/ui/views/frame/browser_frame.cc
index f5ab38d..58e3554 100644
--- a/chrome/browser/ui/views/frame/browser_frame.cc
+++ b/chrome/browser/ui/views/frame/browser_frame.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/ui/views/frame/browser_frame.h"
-#include "base/command_line.h"
#include "base/i18n/rtl.h"
#include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/themes/theme_service_factory.h"
@@ -79,8 +78,8 @@ void BrowserFrame::InitBrowserFrame() {
#endif
}
#if defined(USE_AURA)
- CommandLine* command_line = CommandLine::ForCurrentProcess();
- if (command_line->HasSwitch(ash::switches::kAuraTranslucentFrames))
+ // Compact mode has opaque frames, otherwise Aura frames are translucent.
+ if (!ash::Shell::GetInstance()->IsWindowModeCompact())
params.transparent = true;
// Aura compact mode fills the monitor with with its windows.
if (ash::Shell::GetInstance()->IsWindowModeCompact() &&
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_aura.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_aura.cc
index fdbe881..72d6878 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_aura.cc
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_aura.cc
@@ -4,9 +4,7 @@
#include "chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.h"
-#include "ash/ash_switches.h"
#include "ash/shell.h"
-#include "base/command_line.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/panels/panel_browser_frame_view.h"
#include "chrome/browser/ui/panels/panel_browser_view.h"
@@ -24,6 +22,8 @@ BrowserNonClientFrameView* CreateBrowserNonClientFrameView(
return new PanelBrowserFrameView(
frame, static_cast<PanelBrowserView*>(browser_view));
}
+
+ // Compact mode uses special opaque frames.
if (ash::Shell::GetInstance()->IsWindowModeCompact())
return new CompactBrowserFrameView(frame, browser_view);
@@ -31,15 +31,11 @@ BrowserNonClientFrameView* CreateBrowserNonClientFrameView(
if (browser_view->browser()->is_app() && browser_view->IsMaximized())
return new AppNonClientFrameViewAura(frame, browser_view);
- CommandLine* command_line = CommandLine::ForCurrentProcess();
- if (command_line->HasSwitch(ash::switches::kAuraTranslucentFrames)) {
- BrowserNonClientFrameViewAura* frame_view =
- new BrowserNonClientFrameViewAura(frame, browser_view);
- frame_view->Init();
- return frame_view;
- }
-
- return new OpaqueBrowserFrameView(frame, browser_view);
+ // Default is potentially translucent fancy frames.
+ BrowserNonClientFrameViewAura* frame_view =
+ new BrowserNonClientFrameViewAura(frame, browser_view);
+ frame_view->Init();
+ return frame_view;
}
} // namespace browser
diff --git a/chrome/browser/ui/views/window.cc b/chrome/browser/ui/views/window.cc
index d3b0e56..d4d8daa 100644
--- a/chrome/browser/ui/views/window.cc
+++ b/chrome/browser/ui/views/window.cc
@@ -8,8 +8,10 @@
#include "ui/views/widget/widget.h"
#if defined(USE_AURA)
+#include "ash/ash_switches.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
+#include "base/command_line.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#endif
@@ -33,6 +35,33 @@
// The remainder of the code here is dealing with the legacy CrOS WM and
// can also be removed.
+namespace {
+
+views::Widget* CreateViewsWindowWithParent(gfx::NativeWindow parent,
+ views::WidgetDelegate* delegate) {
+ views::Widget* widget = new views::Widget;
+ views::Widget::InitParams params;
+ params.delegate = delegate;
+#if defined(OS_WIN) || defined(USE_AURA)
+ params.parent = parent;
+#endif
+#if defined(USE_AURA)
+ // Outside of compact mode, dialog windows may have translucent frames.
+ // TODO(jamescook): Find a better way to set this.
+ CommandLine* cmd = CommandLine::ForCurrentProcess();
+ bool compact_window_mode =
+ cmd->HasSwitch(ash::switches::kAuraForceCompactWindowMode) ||
+ cmd->GetSwitchValueASCII(ash::switches::kAuraWindowMode) ==
+ ash::switches::kAuraWindowModeCompact;
+ if (!compact_window_mode)
+ params.transparent = true;
+#endif
+ widget->Init(params);
+ return widget;
+}
+
+} // namespace
+
namespace browser {
views::Widget* CreateViewsWindow(gfx::NativeWindow parent,
@@ -41,7 +70,7 @@ views::Widget* CreateViewsWindow(gfx::NativeWindow parent,
#if defined(OS_CHROMEOS) && !defined(USE_AURA)
return chromeos::BubbleWindow::Create(parent, style, delegate);
#else
- return views::Widget::CreateWindowWithParent(delegate, parent);
+ return CreateViewsWindowWithParent(parent, delegate);
#endif
}