| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/constrained_window_views.h" | 5 #include "chrome/browser/ui/views/constrained_window_views.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 #include "ui/views/views_delegate.h" | 40 #include "ui/views/views_delegate.h" |
| 41 #include "ui/views/widget/widget.h" | 41 #include "ui/views/widget/widget.h" |
| 42 #include "ui/views/window/client_view.h" | 42 #include "ui/views/window/client_view.h" |
| 43 #include "ui/views/window/frame_background.h" | 43 #include "ui/views/window/frame_background.h" |
| 44 #include "ui/views/window/non_client_view.h" | 44 #include "ui/views/window/non_client_view.h" |
| 45 #include "ui/views/window/window_resources.h" | 45 #include "ui/views/window/window_resources.h" |
| 46 #include "ui/views/window/window_shape.h" | 46 #include "ui/views/window/window_shape.h" |
| 47 | 47 |
| 48 #if defined(OS_WIN) && !defined(USE_AURA) | 48 #if defined(OS_WIN) && !defined(USE_AURA) |
| 49 #include "ui/views/widget/native_widget_win.h" | 49 #include "ui/views/widget/native_widget_win.h" |
| 50 #include "ui/base/win/shell.h" |
| 50 #endif | 51 #endif |
| 51 | 52 |
| 52 #if defined(USE_ASH) | 53 #if defined(USE_ASH) |
| 53 #include "ash/ash_constants.h" | 54 #include "ash/ash_constants.h" |
| 54 #include "ash/ash_switches.h" | 55 #include "ash/ash_switches.h" |
| 55 #include "ash/shell.h" | 56 #include "ash/shell.h" |
| 56 #include "ash/wm/custom_frame_view_ash.h" | 57 #include "ash/wm/custom_frame_view_ash.h" |
| 57 #include "ash/wm/visibility_controller.h" | 58 #include "ash/wm/visibility_controller.h" |
| 58 #include "ui/aura/window.h" | 59 #include "ui/aura/window.h" |
| 59 #endif | 60 #endif |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 // Layout various sub-components of this view. | 217 // Layout various sub-components of this view. |
| 217 void LayoutWindowControls(); | 218 void LayoutWindowControls(); |
| 218 void LayoutTitleBar(); | 219 void LayoutTitleBar(); |
| 219 | 220 |
| 220 // Returns the bounds of the client area for the specified view size. | 221 // Returns the bounds of the client area for the specified view size. |
| 221 gfx::Rect CalculateClientAreaBounds(int width, int height) const; | 222 gfx::Rect CalculateClientAreaBounds(int width, int height) const; |
| 222 | 223 |
| 223 SkColor GetTitleColor() const { | 224 SkColor GetTitleColor() const { |
| 224 return container_->owner()->profile()->IsOffTheRecord() | 225 return container_->owner()->profile()->IsOffTheRecord() |
| 225 #if defined(OS_WIN) && !defined(USE_AURA) | 226 #if defined(OS_WIN) && !defined(USE_AURA) |
| 226 || !views::NativeWidgetWin::IsAeroGlassEnabled() | 227 || !ui::win::IsAeroGlassEnabled() |
| 227 #endif | 228 #endif |
| 228 ? SK_ColorWHITE : SK_ColorBLACK; | 229 ? SK_ColorWHITE : SK_ColorBLACK; |
| 229 } | 230 } |
| 230 | 231 |
| 231 // Loads the appropriate set of WindowResources for the frame view. | 232 // Loads the appropriate set of WindowResources for the frame view. |
| 232 void InitWindowResources(); | 233 void InitWindowResources(); |
| 233 | 234 |
| 234 ConstrainedWindowViews* container_; | 235 ConstrainedWindowViews* container_; |
| 235 | 236 |
| 236 scoped_ptr<views::WindowResources> resources_; | 237 scoped_ptr<views::WindowResources> resources_; |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 int height) const { | 511 int height) const { |
| 511 int top_height = NonClientTopBorderHeight(); | 512 int top_height = NonClientTopBorderHeight(); |
| 512 int border_thickness = NonClientBorderThickness(); | 513 int border_thickness = NonClientBorderThickness(); |
| 513 return gfx::Rect(border_thickness, top_height, | 514 return gfx::Rect(border_thickness, top_height, |
| 514 std::max(0, width - (2 * border_thickness)), | 515 std::max(0, width - (2 * border_thickness)), |
| 515 std::max(0, height - top_height - border_thickness)); | 516 std::max(0, height - top_height - border_thickness)); |
| 516 } | 517 } |
| 517 | 518 |
| 518 void ConstrainedWindowFrameView::InitWindowResources() { | 519 void ConstrainedWindowFrameView::InitWindowResources() { |
| 519 #if defined(OS_WIN) && !defined(USE_AURA) | 520 #if defined(OS_WIN) && !defined(USE_AURA) |
| 520 resources_.reset(views::NativeWidgetWin::IsAeroGlassEnabled() ? | 521 resources_.reset(ui::win::IsAeroGlassEnabled() ? |
| 521 static_cast<views::WindowResources*>(new VistaWindowResources) : | 522 static_cast<views::WindowResources*>(new VistaWindowResources) : |
| 522 new XPWindowResources); | 523 new XPWindowResources); |
| 523 #else | 524 #else |
| 524 // TODO(oshima): Use aura frame decoration. | 525 // TODO(oshima): Use aura frame decoration. |
| 525 resources_.reset(new XPWindowResources); | 526 resources_.reset(new XPWindowResources); |
| 526 #endif | 527 #endif |
| 527 } | 528 } |
| 528 | 529 |
| 529 // static | 530 // static |
| 530 void ConstrainedWindowFrameView::InitClass() { | 531 void ConstrainedWindowFrameView::InitClass() { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 | 680 |
| 680 views::internal::NativeWidgetDelegate* | 681 views::internal::NativeWidgetDelegate* |
| 681 ConstrainedWindowViews::AsNativeWidgetDelegate() { | 682 ConstrainedWindowViews::AsNativeWidgetDelegate() { |
| 682 return this; | 683 return this; |
| 683 } | 684 } |
| 684 | 685 |
| 685 int ConstrainedWindowViews::GetNonClientComponent(const gfx::Point& point) { | 686 int ConstrainedWindowViews::GetNonClientComponent(const gfx::Point& point) { |
| 686 // Prevent a constrained window to be moved by the user. | 687 // Prevent a constrained window to be moved by the user. |
| 687 return HTNOWHERE; | 688 return HTNOWHERE; |
| 688 } | 689 } |
| OLD | NEW |