Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2013)

Unified Diff: apps/ui/views/shell_window_frame_view.cc

Issue 111723012: Linux Aura: Added --use-system-title-bar flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Formatting. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: apps/ui/views/shell_window_frame_view.cc
diff --git a/apps/ui/views/shell_window_frame_view.cc b/apps/ui/views/shell_window_frame_view.cc
index 3efa2887dea9c935e85d07539bd1e9634d7cfeaf..c651b3aa477d99673065d1c8506337732357e073 100644
--- a/apps/ui/views/shell_window_frame_view.cc
+++ b/apps/ui/views/shell_window_frame_view.cc
@@ -60,7 +60,7 @@ void ShellWindowFrameView::Init(views::Widget* frame,
resize_inside_bounds_size_ = resize_inside_bounds_size;
resize_area_corner_size_ = resize_area_corner_size;
- if (!window_->IsFrameless()) {
+ if (ShouldShowWindowFrame()) {
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
close_button_ = new views::ImageButton(this);
close_button_->SetImage(views::CustomButton::STATE_NORMAL,
@@ -127,10 +127,20 @@ void ShellWindowFrameView::Init(views::Widget* frame,
#endif
}
+bool ShellWindowFrameView::ShouldShowWindowFrame() const {
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+ // Linux does not use the custom window frame. The operating system's native
+ // window frame will be applied when window_->IsFrameless() is false.
+ return false;
+#endif
+
+ return !window_->IsFrameless();
+}
+
// views::NonClientFrameView implementation.
gfx::Rect ShellWindowFrameView::GetBoundsForClientView() const {
- if (window_->IsFrameless() || frame_->IsFullscreen())
+ if (!ShouldShowWindowFrame() || frame_->IsFullscreen())
return bounds();
return gfx::Rect(0, kCaptionHeight, width(),
std::max(0, height() - kCaptionHeight));
@@ -138,7 +148,7 @@ gfx::Rect ShellWindowFrameView::GetBoundsForClientView() const {
gfx::Rect ShellWindowFrameView::GetWindowBoundsForClientBounds(
const gfx::Rect& client_bounds) const {
- if (window_->IsFrameless()) {
+ if (!ShouldShowWindowFrame()) {
gfx::Rect window_bounds = client_bounds;
// Enforce minimum size (1, 1) in case that client_bounds is passed with
// empty size. This could occur when the frameless window is being
@@ -198,7 +208,7 @@ int ShellWindowFrameView::NonClientHitTest(const gfx::Point& point) {
// Check for possible draggable region in the client area for the frameless
// window.
- if (window_->IsFrameless()) {
+ if (!ShouldShowWindowFrame()) {
SkRegion* draggable_region = window_->GetDraggableRegion();
if (draggable_region && draggable_region->contains(point.x(), point.y()))
return HTCAPTION;
@@ -243,7 +253,7 @@ gfx::Size ShellWindowFrameView::GetPreferredSize() {
}
void ShellWindowFrameView::Layout() {
- if (window_->IsFrameless())
+ if (!ShouldShowWindowFrame())
return;
gfx::Size close_size = close_button_->GetPreferredSize();
const int kButtonOffsetY = 0;
@@ -290,7 +300,7 @@ void ShellWindowFrameView::Layout() {
}
void ShellWindowFrameView::OnPaint(gfx::Canvas* canvas) {
- if (window_->IsFrameless())
+ if (!ShouldShowWindowFrame())
return;
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
@@ -325,7 +335,7 @@ const char* ShellWindowFrameView::GetClassName() const {
gfx::Size ShellWindowFrameView::GetMinimumSize() {
gfx::Size min_size = frame_->client_view()->GetMinimumSize();
- if (window_->IsFrameless())
+ if (!ShouldShowWindowFrame())
return min_size;
// Ensure we can display the top of the caption area.
@@ -358,7 +368,7 @@ gfx::Size ShellWindowFrameView::GetMaximumSize() {
void ShellWindowFrameView::ButtonPressed(views::Button* sender,
const ui::Event& event) {
- DCHECK(!window_->IsFrameless());
+ DCHECK(ShouldShowWindowFrame());
if (sender == close_button_)
frame_->Close();
else if (sender == maximize_button_)

Powered by Google App Engine
This is Rietveld 408576698