Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 #include "ui/gfx/path.h" | 28 #include "ui/gfx/path.h" |
| 29 #include "ui/gfx/rect.h" | 29 #include "ui/gfx/rect.h" |
| 30 #include "views/controls/button/image_button.h" | 30 #include "views/controls/button/image_button.h" |
| 31 #include "views/focus/focus_manager.h" | 31 #include "views/focus/focus_manager.h" |
| 32 #include "views/widget/widget.h" | 32 #include "views/widget/widget.h" |
| 33 #include "views/window/client_view.h" | 33 #include "views/window/client_view.h" |
| 34 #include "views/window/non_client_view.h" | 34 #include "views/window/non_client_view.h" |
| 35 #include "views/window/window_resources.h" | 35 #include "views/window/window_resources.h" |
| 36 #include "views/window/window_shape.h" | 36 #include "views/window/window_shape.h" |
| 37 | 37 |
| 38 #if defined(OS_WIN) | 38 #if defined(OS_WIN) && !defined(USE_AURA) |
| 39 #include "views/widget/native_widget_win.h" | 39 #include "views/widget/native_widget_win.h" |
| 40 #endif | 40 #endif |
| 41 | 41 |
| 42 using base::TimeDelta; | 42 using base::TimeDelta; |
| 43 | 43 |
| 44 namespace views { | 44 namespace views { |
| 45 class ClientView; | 45 class ClientView; |
| 46 } | 46 } |
| 47 | 47 |
| 48 // An enumeration of bitmap resources used by this window. | 48 // An enumeration of bitmap resources used by this window. |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 | 198 |
| 199 // Layout various sub-components of this view. | 199 // Layout various sub-components of this view. |
| 200 void LayoutWindowControls(); | 200 void LayoutWindowControls(); |
| 201 void LayoutTitleBar(); | 201 void LayoutTitleBar(); |
| 202 | 202 |
| 203 // Returns the bounds of the client area for the specified view size. | 203 // Returns the bounds of the client area for the specified view size. |
| 204 gfx::Rect CalculateClientAreaBounds(int width, int height) const; | 204 gfx::Rect CalculateClientAreaBounds(int width, int height) const; |
| 205 | 205 |
| 206 SkColor GetTitleColor() const { | 206 SkColor GetTitleColor() const { |
| 207 return container_->owner()->browser_context()->IsOffTheRecord() | 207 return container_->owner()->browser_context()->IsOffTheRecord() |
| 208 #if defined(OS_WIN) | 208 #if defined(OS_WIN) && !defined(USE_AURA) |
| 209 || !views::NativeWidgetWin::IsAeroGlassEnabled() | 209 || !views::NativeWidgetWin::IsAeroGlassEnabled() |
| 210 #endif | 210 #endif |
| 211 ? SK_ColorWHITE : SK_ColorBLACK; | 211 ? SK_ColorWHITE : SK_ColorBLACK; |
| 212 } | 212 } |
| 213 | 213 |
| 214 // Loads the appropriate set of WindowResources for the frame view. | 214 // Loads the appropriate set of WindowResources for the frame view. |
| 215 void InitWindowResources(); | 215 void InitWindowResources(); |
| 216 | 216 |
| 217 ConstrainedWindowViews* container_; | 217 ConstrainedWindowViews* container_; |
| 218 | 218 |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 538 int width, | 538 int width, |
| 539 int height) const { | 539 int height) const { |
| 540 int top_height = NonClientTopBorderHeight(); | 540 int top_height = NonClientTopBorderHeight(); |
| 541 int border_thickness = NonClientBorderThickness(); | 541 int border_thickness = NonClientBorderThickness(); |
| 542 return gfx::Rect(border_thickness, top_height, | 542 return gfx::Rect(border_thickness, top_height, |
| 543 std::max(0, width - (2 * border_thickness)), | 543 std::max(0, width - (2 * border_thickness)), |
| 544 std::max(0, height - top_height - border_thickness)); | 544 std::max(0, height - top_height - border_thickness)); |
| 545 } | 545 } |
| 546 | 546 |
| 547 void ConstrainedWindowFrameView::InitWindowResources() { | 547 void ConstrainedWindowFrameView::InitWindowResources() { |
| 548 #if !defined(USE_AURA) | |
| 548 resources_.reset(views::NativeWidgetWin::IsAeroGlassEnabled() ? | 549 resources_.reset(views::NativeWidgetWin::IsAeroGlassEnabled() ? |
| 549 static_cast<views::WindowResources*>(new VistaWindowResources) : | 550 static_cast<views::WindowResources*>(new VistaWindowResources) : |
| 550 new XPWindowResources); | 551 new XPWindowResources); |
| 552 #endif | |
| 551 } | 553 } |
| 552 | 554 |
| 553 // static | 555 // static |
| 554 void ConstrainedWindowFrameView::InitClass() { | 556 void ConstrainedWindowFrameView::InitClass() { |
| 555 static bool initialized = false; | 557 static bool initialized = false; |
| 556 if (!initialized) { | 558 if (!initialized) { |
| 557 #if defined(OS_WIN) | 559 #if defined(OS_WIN) && !defined(USE_AURA) |
| 558 title_font_ = new gfx::Font(views::NativeWidgetWin::GetWindowTitleFont()); | 560 title_font_ = new gfx::Font(views::NativeWidgetWin::GetWindowTitleFont()); |
| 559 #endif | 561 #endif |
|
sky
2011/09/06 17:22:48
#else NOTIMPLEMENTED? Also, do we need to set titl
| |
| 560 initialized = true; | 562 initialized = true; |
| 561 } | 563 } |
| 562 } | 564 } |
| 563 | 565 |
| 564 //////////////////////////////////////////////////////////////////////////////// | 566 //////////////////////////////////////////////////////////////////////////////// |
| 565 // ConstrainedWindowViews, public: | 567 // ConstrainedWindowViews, public: |
| 566 | 568 |
| 567 ConstrainedWindowViews::ConstrainedWindowViews( | 569 ConstrainedWindowViews::ConstrainedWindowViews( |
| 568 TabContents* owner, | 570 TabContents* owner, |
| 569 views::WidgetDelegate* widget_delegate) | 571 views::WidgetDelegate* widget_delegate) |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 625 } | 627 } |
| 626 | 628 |
| 627 void ConstrainedWindowViews::OnNativeConstrainedWindowMouseActivate() { | 629 void ConstrainedWindowViews::OnNativeConstrainedWindowMouseActivate() { |
| 628 Activate(); | 630 Activate(); |
| 629 } | 631 } |
| 630 | 632 |
| 631 views::internal::NativeWidgetDelegate* | 633 views::internal::NativeWidgetDelegate* |
| 632 ConstrainedWindowViews::AsNativeWidgetDelegate() { | 634 ConstrainedWindowViews::AsNativeWidgetDelegate() { |
| 633 return this; | 635 return this; |
| 634 } | 636 } |
| OLD | NEW |