OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/chromeos/frame/bubble_frame_view.h" | 5 #include "chrome/browser/chromeos/frame/bubble_frame_view.h" |
6 | 6 |
7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
8 #include "gfx/canvas_skia.h" | 8 #include "gfx/canvas_skia.h" |
9 #include "gfx/font.h" | 9 #include "gfx/font.h" |
10 #include "gfx/insets.h" | 10 #include "gfx/insets.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "views/window/window.h" | 21 #include "views/window/window.h" |
22 #include "views/window/window_delegate.h" | 22 #include "views/window/window_delegate.h" |
23 #include "third_party/skia/include/core/SkPaint.h" | 23 #include "third_party/skia/include/core/SkPaint.h" |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 static const int kTitleTopPadding = 10; | 27 static const int kTitleTopPadding = 10; |
28 static const int kTitleContentPadding = 10; | 28 static const int kTitleContentPadding = 10; |
29 static const int kHorizontalPadding = 10; | 29 static const int kHorizontalPadding = 10; |
30 | 30 |
| 31 // Title font size correction. |
| 32 #if defined(CROS_FONTS_USING_BCI) |
| 33 static const int kTitleFontSizeDelta = 0; |
| 34 #else |
| 35 static const int kTitleFontSizeDelta = 1; |
| 36 #endif |
| 37 |
31 } // namespace | 38 } // namespace |
32 | 39 |
33 namespace chromeos { | 40 namespace chromeos { |
34 | 41 |
35 BubbleFrameView::BubbleFrameView(views::Window* frame, | 42 BubbleFrameView::BubbleFrameView(views::Window* frame, |
36 BubbleWindow::Style style) | 43 BubbleWindow::Style style) |
37 : frame_(frame), | 44 : frame_(frame), |
38 style_(style), | 45 style_(style), |
39 title_(NULL), | 46 title_(NULL), |
40 close_button_(NULL), | 47 close_button_(NULL), |
41 throbber_(NULL) { | 48 throbber_(NULL) { |
42 set_border(new BubbleBorder(BubbleBorder::NONE)); | 49 set_border(new BubbleBorder(BubbleBorder::NONE)); |
43 | 50 |
44 if (frame_->GetDelegate()->ShouldShowWindowTitle()) { | 51 if (frame_->GetDelegate()->ShouldShowWindowTitle()) { |
45 title_ = new views::Label(frame_->GetDelegate()->GetWindowTitle()); | 52 title_ = new views::Label(frame_->GetDelegate()->GetWindowTitle()); |
46 title_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 53 title_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
47 title_->SetFont(title_->font().DeriveFont(1, gfx::Font::BOLD)); | 54 title_->SetFont(title_->font().DeriveFont(kFontSizeCorrectionDelta, |
| 55 gfx::Font::BOLD)); |
48 AddChildView(title_); | 56 AddChildView(title_); |
49 } | 57 } |
50 | 58 |
51 if (style_ & BubbleWindow::STYLE_XBAR) { | 59 if (style_ & BubbleWindow::STYLE_XBAR) { |
52 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 60 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
53 close_button_ = new views::ImageButton(this); | 61 close_button_ = new views::ImageButton(this); |
54 close_button_->SetImage(views::CustomButton::BS_NORMAL, | 62 close_button_->SetImage(views::CustomButton::BS_NORMAL, |
55 rb.GetBitmapNamed(IDR_CLOSE_BAR)); | 63 rb.GetBitmapNamed(IDR_CLOSE_BAR)); |
56 close_button_->SetImage(views::CustomButton::BS_HOT, | 64 close_button_->SetImage(views::CustomButton::BS_HOT, |
57 rb.GetBitmapNamed(IDR_CLOSE_BAR_H)); | 65 rb.GetBitmapNamed(IDR_CLOSE_BAR_H)); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 PaintBorder(canvas); | 221 PaintBorder(canvas); |
214 } | 222 } |
215 | 223 |
216 void BubbleFrameView::ButtonPressed(views::Button* sender, | 224 void BubbleFrameView::ButtonPressed(views::Button* sender, |
217 const views::Event& event) { | 225 const views::Event& event) { |
218 if (close_button_ != NULL && sender == close_button_) | 226 if (close_button_ != NULL && sender == close_button_) |
219 frame_->Close(); | 227 frame_->Close(); |
220 } | 228 } |
221 | 229 |
222 } // namespace chromeos | 230 } // namespace chromeos |
OLD | NEW |