| 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/bubble/bubble_frame_view.h" | 5 #include "ui/views/bubble/bubble_frame_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ui/base/hit_test.h" | 9 #include "ui/base/hit_test.h" |
| 10 #include "ui/base/l10n/l10n_util.h" |
| 10 #include "ui/base/resource/resource_bundle.h" | 11 #include "ui/base/resource/resource_bundle.h" |
| 11 #include "ui/gfx/path.h" | 12 #include "ui/gfx/path.h" |
| 12 #include "ui/gfx/screen.h" | 13 #include "ui/gfx/screen.h" |
| 13 #include "ui/gfx/skia_util.h" | 14 #include "ui/gfx/skia_util.h" |
| 14 #include "ui/native_theme/native_theme.h" | 15 #include "ui/native_theme/native_theme.h" |
| 15 #include "ui/resources/grit/ui_resources.h" | 16 #include "ui/resources/grit/ui_resources.h" |
| 17 #include "ui/strings/grit/ui_strings.h" |
| 16 #include "ui/views/bubble/bubble_border.h" | 18 #include "ui/views/bubble/bubble_border.h" |
| 17 #include "ui/views/controls/button/label_button.h" | 19 #include "ui/views/controls/button/label_button.h" |
| 18 #include "ui/views/controls/image_view.h" | 20 #include "ui/views/controls/image_view.h" |
| 19 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
| 20 #include "ui/views/widget/widget_delegate.h" | 22 #include "ui/views/widget/widget_delegate.h" |
| 21 #include "ui/views/window/client_view.h" | 23 #include "ui/views/window/client_view.h" |
| 22 | 24 |
| 23 namespace { | 25 namespace { |
| 24 | 26 |
| 25 // Insets for the title bar views in pixels. | 27 // Insets for the title bar views in pixels. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 98 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 97 LabelButton* close = new LabelButton(listener, base::string16()); | 99 LabelButton* close = new LabelButton(listener, base::string16()); |
| 98 close->SetImage(CustomButton::STATE_NORMAL, | 100 close->SetImage(CustomButton::STATE_NORMAL, |
| 99 *rb.GetImageNamed(IDR_CLOSE_DIALOG).ToImageSkia()); | 101 *rb.GetImageNamed(IDR_CLOSE_DIALOG).ToImageSkia()); |
| 100 close->SetImage(CustomButton::STATE_HOVERED, | 102 close->SetImage(CustomButton::STATE_HOVERED, |
| 101 *rb.GetImageNamed(IDR_CLOSE_DIALOG_H).ToImageSkia()); | 103 *rb.GetImageNamed(IDR_CLOSE_DIALOG_H).ToImageSkia()); |
| 102 close->SetImage(CustomButton::STATE_PRESSED, | 104 close->SetImage(CustomButton::STATE_PRESSED, |
| 103 *rb.GetImageNamed(IDR_CLOSE_DIALOG_P).ToImageSkia()); | 105 *rb.GetImageNamed(IDR_CLOSE_DIALOG_P).ToImageSkia()); |
| 104 close->SetBorder(nullptr); | 106 close->SetBorder(nullptr); |
| 105 close->SetSize(close->GetPreferredSize()); | 107 close->SetSize(close->GetPreferredSize()); |
| 108 close->SetTooltipText(l10n_util::GetStringUTF16(IDS_APP_CLOSE)); |
| 106 return close; | 109 return close; |
| 107 } | 110 } |
| 108 | 111 |
| 109 gfx::Rect BubbleFrameView::GetBoundsForClientView() const { | 112 gfx::Rect BubbleFrameView::GetBoundsForClientView() const { |
| 110 gfx::Rect client_bounds = GetLocalBounds(); | 113 gfx::Rect client_bounds = GetLocalBounds(); |
| 111 client_bounds.Inset(GetInsets()); | 114 client_bounds.Inset(GetInsets()); |
| 112 client_bounds.Inset(bubble_border_->GetInsets()); | 115 client_bounds.Inset(bubble_border_->GetInsets()); |
| 113 return client_bounds; | 116 return client_bounds; |
| 114 } | 117 } |
| 115 | 118 |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 if (titlebar_extra_view_ != NULL) | 424 if (titlebar_extra_view_ != NULL) |
| 422 title_bar_width += titlebar_extra_view_->GetPreferredSize().width(); | 425 title_bar_width += titlebar_extra_view_->GetPreferredSize().width(); |
| 423 gfx::Size size(client_size); | 426 gfx::Size size(client_size); |
| 424 size.SetToMax(gfx::Size(title_bar_width, 0)); | 427 size.SetToMax(gfx::Size(title_bar_width, 0)); |
| 425 const gfx::Insets insets(GetInsets()); | 428 const gfx::Insets insets(GetInsets()); |
| 426 size.Enlarge(insets.width(), insets.height()); | 429 size.Enlarge(insets.width(), insets.height()); |
| 427 return size; | 430 return size; |
| 428 } | 431 } |
| 429 | 432 |
| 430 } // namespace views | 433 } // namespace views |
| OLD | NEW |