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_win.h" | 5 #include "chrome/browser/ui/views/constrained_window_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
10 #include "app/win/hwnd_util.h" | |
11 #include "app/win/win_util.h" | 10 #include "app/win/win_util.h" |
12 #include "chrome/app/chrome_command_ids.h" | 11 #include "chrome/app/chrome_command_ids.h" |
13 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/tab_contents/tab_contents.h" | 13 #include "chrome/browser/tab_contents/tab_contents.h" |
15 #include "chrome/browser/tab_contents/tab_contents_view.h" | 14 #include "chrome/browser/tab_contents/tab_contents_view.h" |
16 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 15 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
17 #include "chrome/browser/ui/views/frame/browser_view.h" | 16 #include "chrome/browser/ui/views/frame/browser_view.h" |
18 #include "chrome/browser/ui/window_sizer.h" | 17 #include "chrome/browser/ui/window_sizer.h" |
19 #include "chrome/common/chrome_constants.h" | 18 #include "chrome/common/chrome_constants.h" |
20 #include "chrome/common/notification_service.h" | 19 #include "chrome/common/notification_service.h" |
21 #include "gfx/canvas.h" | 20 #include "gfx/canvas.h" |
22 #include "gfx/font.h" | 21 #include "gfx/font.h" |
23 #include "gfx/path.h" | 22 #include "gfx/path.h" |
24 #include "gfx/rect.h" | 23 #include "gfx/rect.h" |
25 #include "grit/app_resources.h" | 24 #include "grit/app_resources.h" |
26 #include "grit/chromium_strings.h" | 25 #include "grit/chromium_strings.h" |
27 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
28 #include "grit/theme_resources.h" | 27 #include "grit/theme_resources.h" |
29 #include "net/base/net_util.h" | 28 #include "net/base/net_util.h" |
| 29 #include "ui/base/win/hwnd_util.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/window/client_view.h" | 32 #include "views/window/client_view.h" |
33 #include "views/window/non_client_view.h" | 33 #include "views/window/non_client_view.h" |
34 #include "views/window/window_resources.h" | 34 #include "views/window/window_resources.h" |
35 #include "views/window/window_shape.h" | 35 #include "views/window/window_shape.h" |
36 | 36 |
37 using base::TimeDelta; | 37 using base::TimeDelta; |
38 | 38 |
39 namespace views { | 39 namespace views { |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 191 |
192 // Layout various sub-components of this view. | 192 // Layout various sub-components of this view. |
193 void LayoutWindowControls(); | 193 void LayoutWindowControls(); |
194 void LayoutTitleBar(); | 194 void LayoutTitleBar(); |
195 | 195 |
196 // Returns the bounds of the client area for the specified view size. | 196 // Returns the bounds of the client area for the specified view size. |
197 gfx::Rect CalculateClientAreaBounds(int width, int height) const; | 197 gfx::Rect CalculateClientAreaBounds(int width, int height) const; |
198 | 198 |
199 SkColor GetTitleColor() const { | 199 SkColor GetTitleColor() const { |
200 return (container_->owner()->profile()->IsOffTheRecord() || | 200 return (container_->owner()->profile()->IsOffTheRecord() || |
201 !app::win::ShouldUseVistaFrame()) ? SK_ColorWHITE : SK_ColorBLACK; | 201 !ui::ShouldUseVistaFrame()) ? SK_ColorWHITE : SK_ColorBLACK; |
202 } | 202 } |
203 | 203 |
204 // Loads the appropriate set of WindowResources for the frame view. | 204 // Loads the appropriate set of WindowResources for the frame view. |
205 void InitWindowResources(); | 205 void InitWindowResources(); |
206 | 206 |
207 ConstrainedWindowWin* container_; | 207 ConstrainedWindowWin* container_; |
208 | 208 |
209 scoped_ptr<views::WindowResources> resources_; | 209 scoped_ptr<views::WindowResources> resources_; |
210 | 210 |
211 gfx::Rect title_bounds_; | 211 gfx::Rect title_bounds_; |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 int width, | 528 int width, |
529 int height) const { | 529 int height) const { |
530 int top_height = NonClientTopBorderHeight(); | 530 int top_height = NonClientTopBorderHeight(); |
531 int border_thickness = NonClientBorderThickness(); | 531 int border_thickness = NonClientBorderThickness(); |
532 return gfx::Rect(border_thickness, top_height, | 532 return gfx::Rect(border_thickness, top_height, |
533 std::max(0, width - (2 * border_thickness)), | 533 std::max(0, width - (2 * border_thickness)), |
534 std::max(0, height - top_height - border_thickness)); | 534 std::max(0, height - top_height - border_thickness)); |
535 } | 535 } |
536 | 536 |
537 void ConstrainedWindowFrameView::InitWindowResources() { | 537 void ConstrainedWindowFrameView::InitWindowResources() { |
538 resources_.reset(app::win::ShouldUseVistaFrame() ? | 538 resources_.reset(ui::ShouldUseVistaFrame() ? |
539 static_cast<views::WindowResources*>(new VistaWindowResources) : | 539 static_cast<views::WindowResources*>(new VistaWindowResources) : |
540 new XPWindowResources); | 540 new XPWindowResources); |
541 } | 541 } |
542 | 542 |
543 // static | 543 // static |
544 void ConstrainedWindowFrameView::InitClass() { | 544 void ConstrainedWindowFrameView::InitClass() { |
545 static bool initialized = false; | 545 static bool initialized = false; |
546 if (!initialized) { | 546 if (!initialized) { |
547 title_font_ = new gfx::Font(app::win::GetWindowTitleFont()); | 547 title_font_ = new gfx::Font(app::win::GetWindowTitleFont()); |
548 initialized = true; | 548 initialized = true; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 | 664 |
665 | 665 |
666 // static | 666 // static |
667 ConstrainedWindow* ConstrainedWindow::CreateConstrainedDialog( | 667 ConstrainedWindow* ConstrainedWindow::CreateConstrainedDialog( |
668 TabContents* parent, | 668 TabContents* parent, |
669 views::WindowDelegate* window_delegate) { | 669 views::WindowDelegate* window_delegate) { |
670 ConstrainedWindowWin* window = new ConstrainedWindowWin(parent, | 670 ConstrainedWindowWin* window = new ConstrainedWindowWin(parent, |
671 window_delegate); | 671 window_delegate); |
672 return window; | 672 return window; |
673 } | 673 } |
OLD | NEW |