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 "grit/ui_resources.h" | 9 #include "grit/ui_resources.h" |
10 #include "ui/base/hit_test.h" | 10 #include "ui/base/hit_test.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 154 |
155 void BubbleFrameView::UpdateWindowIcon() {} | 155 void BubbleFrameView::UpdateWindowIcon() {} |
156 | 156 |
157 void BubbleFrameView::UpdateWindowTitle() { | 157 void BubbleFrameView::UpdateWindowTitle() { |
158 title_->SetText(GetWidget()->widget_delegate()->ShouldShowWindowTitle() ? | 158 title_->SetText(GetWidget()->widget_delegate()->ShouldShowWindowTitle() ? |
159 GetWidget()->widget_delegate()->GetWindowTitle() : base::string16()); | 159 GetWidget()->widget_delegate()->GetWindowTitle() : base::string16()); |
160 // Update the close button visibility too, otherwise it's not intialized. | 160 // Update the close button visibility too, otherwise it's not intialized. |
161 ResetWindowControls(); | 161 ResetWindowControls(); |
162 } | 162 } |
163 | 163 |
| 164 void BubbleFrameView::SetTitleFontList(const gfx::FontList& font_list) { |
| 165 title_->SetFontList(font_list); |
| 166 UpdateWindowTitle(); |
| 167 } |
| 168 |
164 gfx::Insets BubbleFrameView::GetInsets() const { | 169 gfx::Insets BubbleFrameView::GetInsets() const { |
165 gfx::Insets insets = content_margins_; | 170 gfx::Insets insets = content_margins_; |
166 const int title_height = title_->text().empty() ? 0 : | 171 const int title_height = title_->text().empty() ? 0 : |
167 title_->GetPreferredSize().height() + kTitleTopInset + kTitleBottomInset; | 172 title_->GetPreferredSize().height() + kTitleTopInset + kTitleBottomInset; |
168 const int close_height = close_->visible() ? close_->height() : 0; | 173 const int close_height = close_->visible() ? close_->height() : 0; |
169 insets += gfx::Insets(std::max(title_height, close_height), 0, 0, 0); | 174 insets += gfx::Insets(std::max(title_height, close_height), 0, 0, 0); |
170 return insets; | 175 return insets; |
171 } | 176 } |
172 | 177 |
173 gfx::Size BubbleFrameView::GetPreferredSize() const { | 178 gfx::Size BubbleFrameView::GetPreferredSize() const { |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 if (titlebar_extra_view_ != NULL) | 361 if (titlebar_extra_view_ != NULL) |
357 title_bar_width += titlebar_extra_view_->GetPreferredSize().width(); | 362 title_bar_width += titlebar_extra_view_->GetPreferredSize().width(); |
358 gfx::Size size(client_size); | 363 gfx::Size size(client_size); |
359 size.SetToMax(gfx::Size(title_bar_width, 0)); | 364 size.SetToMax(gfx::Size(title_bar_width, 0)); |
360 const gfx::Insets insets(GetInsets()); | 365 const gfx::Insets insets(GetInsets()); |
361 size.Enlarge(insets.width(), insets.height()); | 366 size.Enlarge(insets.width(), insets.height()); |
362 return size; | 367 return size; |
363 } | 368 } |
364 | 369 |
365 } // namespace views | 370 } // namespace views |
OLD | NEW |