| 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 "ui/views/window/custom_frame_view.h" | 5 #include "ui/views/window/custom_frame_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
| 11 #include "grit/ui_strings.h" | 11 #include "grit/ui_strings.h" |
| 12 #include "ui/base/hit_test.h" | 12 #include "ui/base/hit_test.h" |
| 13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
| 14 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
| 15 #include "ui/gfx/canvas.h" | 15 #include "ui/gfx/canvas.h" |
| 16 #include "ui/gfx/font.h" | 16 #include "ui/gfx/font.h" |
| 17 #include "ui/gfx/image/image.h" | 17 #include "ui/gfx/image/image.h" |
| 18 #include "ui/gfx/path.h" | 18 #include "ui/gfx/path.h" |
| 19 #include "ui/views/color_constants.h" | 19 #include "ui/views/color_constants.h" |
| 20 #include "ui/views/controls/button/image_button.h" | 20 #include "ui/views/controls/button/image_button.h" |
| 21 #include "ui/views/views_delegate.h" | 21 #include "ui/views/views_delegate.h" |
| 22 #include "ui/views/widget/native_widget_aura.h" |
| 22 #include "ui/views/widget/widget.h" | 23 #include "ui/views/widget/widget.h" |
| 23 #include "ui/views/widget/widget_delegate.h" | 24 #include "ui/views/widget/widget_delegate.h" |
| 24 #include "ui/views/window/client_view.h" | 25 #include "ui/views/window/client_view.h" |
| 25 #include "ui/views/window/frame_background.h" | 26 #include "ui/views/window/frame_background.h" |
| 26 #include "ui/views/window/window_resources.h" | 27 #include "ui/views/window/window_resources.h" |
| 27 #include "ui/views/window/window_shape.h" | 28 #include "ui/views/window/window_shape.h" |
| 28 | 29 |
| 29 #if defined(USE_AURA) | |
| 30 #include "ui/views/widget/native_widget_aura.h" | |
| 31 #endif | |
| 32 | |
| 33 namespace views { | 30 namespace views { |
| 34 | 31 |
| 35 namespace { | 32 namespace { |
| 36 | 33 |
| 37 // The frame border is only visible in restored mode and is hardcoded to 4 px on | 34 // The frame border is only visible in restored mode and is hardcoded to 4 px on |
| 38 // each side regardless of the system window border size. | 35 // each side regardless of the system window border size. |
| 39 const int kFrameBorderThickness = 4; | 36 const int kFrameBorderThickness = 4; |
| 40 // In the window corners, the resize areas don't actually expand bigger, but the | 37 // In the window corners, the resize areas don't actually expand bigger, but the |
| 41 // 16 px at the end of each edge triggers diagonal resizing. | 38 // 16 px at the end of each edge triggers diagonal resizing. |
| 42 const int kResizeAreaCornerSize = 16; | 39 const int kResizeAreaCornerSize = 16; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 59 const SkColor kDefaultColorFrame = SkColorSetRGB(109, 109, 109); | 56 const SkColor kDefaultColorFrame = SkColorSetRGB(109, 109, 109); |
| 60 const SkColor kDefaultColorFrameInactive = SkColorSetRGB(176, 176, 176); | 57 const SkColor kDefaultColorFrameInactive = SkColorSetRGB(176, 176, 176); |
| 61 #else | 58 #else |
| 62 // Windows and Linux use a blue. | 59 // Windows and Linux use a blue. |
| 63 const SkColor kDefaultColorFrame = SkColorSetRGB(66, 116, 201); | 60 const SkColor kDefaultColorFrame = SkColorSetRGB(66, 116, 201); |
| 64 const SkColor kDefaultColorFrameInactive = SkColorSetRGB(161, 182, 228); | 61 const SkColor kDefaultColorFrameInactive = SkColorSetRGB(161, 182, 228); |
| 65 #endif | 62 #endif |
| 66 | 63 |
| 67 const gfx::FontList& GetTitleFontList() { | 64 const gfx::FontList& GetTitleFontList() { |
| 68 static const gfx::FontList title_font_list = | 65 static const gfx::FontList title_font_list = |
| 69 #if defined(USE_AURA) | |
| 70 NativeWidgetAura::GetWindowTitleFontList(); | 66 NativeWidgetAura::GetWindowTitleFontList(); |
| 71 #elif defined(OS_LINUX) | |
| 72 // TODO(ben): need to resolve what font this is. | |
| 73 gfx::FontList(); | |
| 74 #endif | |
| 75 return title_font_list; | 67 return title_font_list; |
| 76 } | 68 } |
| 77 | 69 |
| 78 } // namespace | 70 } // namespace |
| 79 | 71 |
| 80 /////////////////////////////////////////////////////////////////////////////// | 72 /////////////////////////////////////////////////////////////////////////////// |
| 81 // CustomFrameView, public: | 73 // CustomFrameView, public: |
| 82 | 74 |
| 83 CustomFrameView::CustomFrameView() | 75 CustomFrameView::CustomFrameView() |
| 84 : frame_(NULL), | 76 : frame_(NULL), |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 rb.GetImageNamed(normal_image_id).ToImageSkia()); | 575 rb.GetImageNamed(normal_image_id).ToImageSkia()); |
| 584 button->SetImage(CustomButton::STATE_HOVERED, | 576 button->SetImage(CustomButton::STATE_HOVERED, |
| 585 rb.GetImageNamed(hot_image_id).ToImageSkia()); | 577 rb.GetImageNamed(hot_image_id).ToImageSkia()); |
| 586 button->SetImage(CustomButton::STATE_PRESSED, | 578 button->SetImage(CustomButton::STATE_PRESSED, |
| 587 rb.GetImageNamed(pushed_image_id).ToImageSkia()); | 579 rb.GetImageNamed(pushed_image_id).ToImageSkia()); |
| 588 AddChildView(button); | 580 AddChildView(button); |
| 589 return button; | 581 return button; |
| 590 } | 582 } |
| 591 | 583 |
| 592 } // namespace views | 584 } // namespace views |
| OLD | NEW |