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/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "grit/theme_resources_standard.h" | 25 #include "grit/theme_resources_standard.h" |
26 #include "grit/ui_resources.h" | 26 #include "grit/ui_resources.h" |
27 #include "net/base/net_util.h" | 27 #include "net/base/net_util.h" |
28 #include "ui/base/hit_test.h" | 28 #include "ui/base/hit_test.h" |
29 #include "ui/base/resource/resource_bundle.h" | 29 #include "ui/base/resource/resource_bundle.h" |
30 #include "ui/gfx/canvas.h" | 30 #include "ui/gfx/canvas.h" |
31 #include "ui/gfx/font.h" | 31 #include "ui/gfx/font.h" |
32 #include "ui/gfx/path.h" | 32 #include "ui/gfx/path.h" |
33 #include "ui/gfx/rect.h" | 33 #include "ui/gfx/rect.h" |
34 #include "ui/gfx/screen.h" | 34 #include "ui/gfx/screen.h" |
| 35 #include "ui/views/color_constants.h" |
35 #include "ui/views/controls/button/image_button.h" | 36 #include "ui/views/controls/button/image_button.h" |
36 #include "ui/views/focus/focus_manager.h" | 37 #include "ui/views/focus/focus_manager.h" |
37 #include "ui/views/views_delegate.h" | 38 #include "ui/views/views_delegate.h" |
38 #include "ui/views/widget/widget.h" | 39 #include "ui/views/widget/widget.h" |
39 #include "ui/views/window/client_view.h" | 40 #include "ui/views/window/client_view.h" |
40 #include "ui/views/window/frame_background.h" | 41 #include "ui/views/window/frame_background.h" |
41 #include "ui/views/window/non_client_view.h" | 42 #include "ui/views/window/non_client_view.h" |
42 #include "ui/views/window/window_resources.h" | 43 #include "ui/views/window/window_resources.h" |
43 #include "ui/views/window/window_shape.h" | 44 #include "ui/views/window/window_shape.h" |
44 | 45 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 // The titlebar has a 2 px 3D edge along the top and bottom. | 266 // The titlebar has a 2 px 3D edge along the top and bottom. |
266 const int kTitlebarTopAndBottomEdgeThickness = 2; | 267 const int kTitlebarTopAndBottomEdgeThickness = 2; |
267 // The icon would never shrink below 16 px on a side, if there was one. | 268 // The icon would never shrink below 16 px on a side, if there was one. |
268 const int kIconMinimumSize = 16; | 269 const int kIconMinimumSize = 16; |
269 // The title text starts 2 px from the right edge of the left frame border. | 270 // The title text starts 2 px from the right edge of the left frame border. |
270 const int kTitleLeftSpacing = 2; | 271 const int kTitleLeftSpacing = 2; |
271 // There is a 5 px gap between the title text and the caption buttons. | 272 // There is a 5 px gap between the title text and the caption buttons. |
272 const int kTitleCaptionSpacing = 5; | 273 const int kTitleCaptionSpacing = 5; |
273 | 274 |
274 const SkColor kContentsBorderShadow = SkColorSetARGB(51, 0, 0, 0); | 275 const SkColor kContentsBorderShadow = SkColorSetARGB(51, 0, 0, 0); |
275 } | 276 |
| 277 } // namespace |
276 | 278 |
277 //////////////////////////////////////////////////////////////////////////////// | 279 //////////////////////////////////////////////////////////////////////////////// |
278 // ConstrainedWindowFrameView, public: | 280 // ConstrainedWindowFrameView, public: |
279 | 281 |
280 ConstrainedWindowFrameView::ConstrainedWindowFrameView( | 282 ConstrainedWindowFrameView::ConstrainedWindowFrameView( |
281 ConstrainedWindowViews* container) | 283 ConstrainedWindowViews* container) |
282 : NonClientFrameView(), | 284 : NonClientFrameView(), |
283 container_(container), | 285 container_(container), |
284 close_button_(new views::ImageButton(this)), | 286 close_button_(new views::ImageButton(this)), |
285 frame_background_(new views::FrameBackground()) { | 287 frame_background_(new views::FrameBackground()) { |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 title_bounds_.y(), title_bounds_.width(), title_bounds_.height()); | 482 title_bounds_.y(), title_bounds_.width(), title_bounds_.height()); |
481 } | 483 } |
482 | 484 |
483 void ConstrainedWindowFrameView::PaintClientEdge(gfx::Canvas* canvas) { | 485 void ConstrainedWindowFrameView::PaintClientEdge(gfx::Canvas* canvas) { |
484 gfx::Rect client_edge_bounds(CalculateClientAreaBounds(width(), height())); | 486 gfx::Rect client_edge_bounds(CalculateClientAreaBounds(width(), height())); |
485 client_edge_bounds.Inset(-kClientEdgeThickness, -kClientEdgeThickness); | 487 client_edge_bounds.Inset(-kClientEdgeThickness, -kClientEdgeThickness); |
486 gfx::Rect frame_shadow_bounds(client_edge_bounds); | 488 gfx::Rect frame_shadow_bounds(client_edge_bounds); |
487 frame_shadow_bounds.Inset(-kFrameShadowThickness, -kFrameShadowThickness); | 489 frame_shadow_bounds.Inset(-kFrameShadowThickness, -kFrameShadowThickness); |
488 | 490 |
489 canvas->FillRect(frame_shadow_bounds, kContentsBorderShadow); | 491 canvas->FillRect(frame_shadow_bounds, kContentsBorderShadow); |
490 canvas->FillRect(client_edge_bounds, ResourceBundle::toolbar_color); | 492 canvas->FillRect(client_edge_bounds, views::kClientEdgeColor); |
491 } | 493 } |
492 | 494 |
493 void ConstrainedWindowFrameView::LayoutWindowControls() { | 495 void ConstrainedWindowFrameView::LayoutWindowControls() { |
494 gfx::Size close_button_size = close_button_->GetPreferredSize(); | 496 gfx::Size close_button_size = close_button_->GetPreferredSize(); |
495 close_button_->SetBounds( | 497 close_button_->SetBounds( |
496 width() - kFrameBorderThickness - close_button_size.width(), | 498 width() - kFrameBorderThickness - close_button_size.width(), |
497 kFrameShadowThickness, close_button_size.width(), | 499 kFrameShadowThickness, close_button_size.width(), |
498 close_button_size.height()); | 500 close_button_size.height()); |
499 } | 501 } |
500 | 502 |
(...skipping 124 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 |