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()); |
| 561 #elif defined(USE_AURA) |
| 562 // TODO(beng): |
| 563 NOTIMPLEMENTED(); |
| 564 title_font_ = NULL; |
559 #endif | 565 #endif |
560 initialized = true; | 566 initialized = true; |
561 } | 567 } |
562 } | 568 } |
563 | 569 |
564 //////////////////////////////////////////////////////////////////////////////// | 570 //////////////////////////////////////////////////////////////////////////////// |
565 // ConstrainedWindowViews, public: | 571 // ConstrainedWindowViews, public: |
566 | 572 |
567 ConstrainedWindowViews::ConstrainedWindowViews( | 573 ConstrainedWindowViews::ConstrainedWindowViews( |
568 TabContents* owner, | 574 TabContents* owner, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 } | 631 } |
626 | 632 |
627 void ConstrainedWindowViews::OnNativeConstrainedWindowMouseActivate() { | 633 void ConstrainedWindowViews::OnNativeConstrainedWindowMouseActivate() { |
628 Activate(); | 634 Activate(); |
629 } | 635 } |
630 | 636 |
631 views::internal::NativeWidgetDelegate* | 637 views::internal::NativeWidgetDelegate* |
632 ConstrainedWindowViews::AsNativeWidgetDelegate() { | 638 ConstrainedWindowViews::AsNativeWidgetDelegate() { |
633 return this; | 639 return this; |
634 } | 640 } |
OLD | NEW |