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/l10n/l10n_util.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 98 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
99 LabelButton* close = new LabelButton(listener, base::string16()); | 99 LabelButton* close = new LabelButton(listener, base::string16()); |
100 close->SetImage(CustomButton::STATE_NORMAL, | 100 close->SetImage(CustomButton::STATE_NORMAL, |
101 *rb.GetImageNamed(IDR_CLOSE_DIALOG).ToImageSkia()); | 101 *rb.GetImageNamed(IDR_CLOSE_DIALOG).ToImageSkia()); |
102 close->SetImage(CustomButton::STATE_HOVERED, | 102 close->SetImage(CustomButton::STATE_HOVERED, |
103 *rb.GetImageNamed(IDR_CLOSE_DIALOG_H).ToImageSkia()); | 103 *rb.GetImageNamed(IDR_CLOSE_DIALOG_H).ToImageSkia()); |
104 close->SetImage(CustomButton::STATE_PRESSED, | 104 close->SetImage(CustomButton::STATE_PRESSED, |
105 *rb.GetImageNamed(IDR_CLOSE_DIALOG_P).ToImageSkia()); | 105 *rb.GetImageNamed(IDR_CLOSE_DIALOG_P).ToImageSkia()); |
106 close->SetBorder(nullptr); | 106 close->SetBorder(nullptr); |
107 close->SetSize(close->GetPreferredSize()); | 107 close->SetSize(close->GetPreferredSize()); |
| 108 #if !defined(OS_WIN) |
| 109 // Windows will automatically create a tooltip for the close button based on |
| 110 // the HTCLOSE result from NonClientHitTest(). |
108 close->SetTooltipText(l10n_util::GetStringUTF16(IDS_APP_CLOSE)); | 111 close->SetTooltipText(l10n_util::GetStringUTF16(IDS_APP_CLOSE)); |
| 112 #endif |
109 return close; | 113 return close; |
110 } | 114 } |
111 | 115 |
112 gfx::Rect BubbleFrameView::GetBoundsForClientView() const { | 116 gfx::Rect BubbleFrameView::GetBoundsForClientView() const { |
113 gfx::Rect client_bounds = GetLocalBounds(); | 117 gfx::Rect client_bounds = GetLocalBounds(); |
114 client_bounds.Inset(GetInsets()); | 118 client_bounds.Inset(GetInsets()); |
115 client_bounds.Inset(bubble_border_->GetInsets()); | 119 client_bounds.Inset(bubble_border_->GetInsets()); |
116 return client_bounds; | 120 return client_bounds; |
117 } | 121 } |
118 | 122 |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 if (titlebar_extra_view_ != NULL) | 428 if (titlebar_extra_view_ != NULL) |
425 title_bar_width += titlebar_extra_view_->GetPreferredSize().width(); | 429 title_bar_width += titlebar_extra_view_->GetPreferredSize().width(); |
426 gfx::Size size(client_size); | 430 gfx::Size size(client_size); |
427 size.SetToMax(gfx::Size(title_bar_width, 0)); | 431 size.SetToMax(gfx::Size(title_bar_width, 0)); |
428 const gfx::Insets insets(GetInsets()); | 432 const gfx::Insets insets(GetInsets()); |
429 size.Enlarge(insets.width(), insets.height()); | 433 size.Enlarge(insets.width(), insets.height()); |
430 return size; | 434 return size; |
431 } | 435 } |
432 | 436 |
433 } // namespace views | 437 } // namespace views |
OLD | NEW |