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 "chrome/browser/ui/views/constrained_window_frame_simple.h" | 5 #include "chrome/browser/ui/views/constrained_window_frame_simple.h" |
6 | 6 |
7 #include "chrome/browser/ui/constrained_window_constants.h" | 7 #include "chrome/browser/ui/constrained_window_constants.h" |
8 #include "chrome/browser/ui/constrained_window.h" | 8 #include "chrome/browser/ui/constrained_window.h" |
9 #include "chrome/browser/ui/views/constrained_window_views.h" | 9 #include "chrome/browser/ui/views/constrained_window_views.h" |
10 #include "grit/chromium_strings.h" | 10 #include "grit/chromium_strings.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 cs->AddColumn(views::GridLayout::TRAILING, views::GridLayout::LEADING, 0, | 68 cs->AddColumn(views::GridLayout::TRAILING, views::GridLayout::LEADING, 0, |
69 views::GridLayout::USE_PREF, 0, 0); // Close Button. | 69 views::GridLayout::USE_PREF, 0, 0); // Close Button. |
70 | 70 |
71 layout->StartRow(0, 0); | 71 layout->StartRow(0, 0); |
72 | 72 |
73 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 73 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
74 title_label_ = new views::Label( | 74 title_label_ = new views::Label( |
75 container->widget_delegate()->GetWindowTitle()); | 75 container->widget_delegate()->GetWindowTitle()); |
76 title_label_->SetFont(rb.GetFont( | 76 title_label_->SetFont(rb.GetFont( |
77 ConstrainedWindowConstants::kTitleFontStyle)); | 77 ConstrainedWindowConstants::kTitleFontStyle)); |
78 title_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 78 title_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
79 title_label_->SetEnabledColor(ConstrainedWindow::GetTextColor()); | 79 title_label_->SetEnabledColor(ConstrainedWindow::GetTextColor()); |
80 title_label_->set_border(views::Border::CreateEmptyBorder( | 80 title_label_->set_border(views::Border::CreateEmptyBorder( |
81 ConstrainedWindowConstants::kTitleTopPadding - kHeaderTopPadding, | 81 ConstrainedWindowConstants::kTitleTopPadding - kHeaderTopPadding, |
82 0, 0, 0)); | 82 0, 0, 0)); |
83 layout->AddView(title_label_); | 83 layout->AddView(title_label_); |
84 | 84 |
85 close_button_ = new views::ImageButton(this); | 85 close_button_ = new views::ImageButton(this); |
86 close_button_->SetImage(views::CustomButton::BS_NORMAL, | 86 close_button_->SetImage(views::CustomButton::BS_NORMAL, |
87 rb.GetImageSkiaNamed(IDR_WEB_UI_CLOSE)); | 87 rb.GetImageSkiaNamed(IDR_WEB_UI_CLOSE)); |
88 close_button_->SetImage(views::CustomButton::BS_HOT, | 88 close_button_->SetImage(views::CustomButton::BS_HOT, |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 return GetWindowBoundsForClientBounds( | 193 return GetWindowBoundsForClientBounds( |
194 gfx::Rect(container_->client_view()->GetPreferredSize())).size(); | 194 gfx::Rect(container_->client_view()->GetPreferredSize())).size(); |
195 } | 195 } |
196 | 196 |
197 void ConstrainedWindowFrameSimple::ButtonPressed(views::Button* sender, | 197 void ConstrainedWindowFrameSimple::ButtonPressed(views::Button* sender, |
198 const ui::Event& event) { | 198 const ui::Event& event) { |
199 DCHECK(close_button_); | 199 DCHECK(close_button_); |
200 if (sender == close_button_) | 200 if (sender == close_button_) |
201 sender->GetWidget()->Close(); | 201 sender->GetWidget()->Close(); |
202 } | 202 } |
OLD | NEW |