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/panels/panel_frame_view.h" | 5 #include "chrome/browser/ui/views/panels/panel_frame_view.h" |
6 | 6 |
7 #include "chrome/browser/themes/theme_service.h" | 7 #include "chrome/browser/themes/theme_service.h" |
8 #include "chrome/browser/themes/theme_service_factory.h" | 8 #include "chrome/browser/themes/theme_service_factory.h" |
9 #include "chrome/browser/ui/panels/panel.h" | 9 #include "chrome/browser/ui/panels/panel.h" |
10 #include "chrome/browser/ui/panels/panel_constants.h" | 10 #include "chrome/browser/ui/panels/panel_constants.h" |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 AddChildView(title_icon_); | 224 AddChildView(title_icon_); |
225 title_icon_->Update(); | 225 title_icon_->Update(); |
226 | 226 |
227 title_label_ = new views::Label(panel_view_->panel()->GetWindowTitle()); | 227 title_label_ = new views::Label(panel_view_->panel()->GetWindowTitle()); |
228 title_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 228 title_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
229 title_label_->SetAutoColorReadabilityEnabled(false); | 229 title_label_->SetAutoColorReadabilityEnabled(false); |
230 AddChildView(title_label_); | 230 AddChildView(title_label_); |
231 } | 231 } |
232 | 232 |
233 void PanelFrameView::UpdateTitle() { | 233 void PanelFrameView::UpdateTitle() { |
234 title_label_->SetText(panel_view_->panel()->GetWindowTitle()); | 234 UpdateWindowTitle(); |
235 } | 235 } |
236 | 236 |
237 void PanelFrameView::UpdateIcon() { | 237 void PanelFrameView::UpdateIcon() { |
238 UpdateWindowIcon(); | 238 UpdateWindowIcon(); |
239 } | 239 } |
240 | 240 |
241 void PanelFrameView::UpdateThrobber() { | 241 void PanelFrameView::UpdateThrobber() { |
242 title_icon_->Update(); | 242 title_icon_->Update(); |
243 } | 243 } |
244 | 244 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 } | 333 } |
334 | 334 |
335 void PanelFrameView::ResetWindowControls() { | 335 void PanelFrameView::ResetWindowControls() { |
336 // The controls aren't affected by this constraint. | 336 // The controls aren't affected by this constraint. |
337 } | 337 } |
338 | 338 |
339 void PanelFrameView::UpdateWindowIcon() { | 339 void PanelFrameView::UpdateWindowIcon() { |
340 title_icon_->SchedulePaint(); | 340 title_icon_->SchedulePaint(); |
341 } | 341 } |
342 | 342 |
| 343 void PanelFrameView::UpdateWindowTitle() { |
| 344 title_label_->SetText(panel_view_->panel()->GetWindowTitle()); |
| 345 } |
| 346 |
343 gfx::Size PanelFrameView::GetPreferredSize() { | 347 gfx::Size PanelFrameView::GetPreferredSize() { |
344 gfx::Size pref_size = | 348 gfx::Size pref_size = |
345 panel_view_->window()->client_view()->GetPreferredSize(); | 349 panel_view_->window()->client_view()->GetPreferredSize(); |
346 gfx::Rect bounds(0, 0, pref_size.width(), pref_size.height()); | 350 gfx::Rect bounds(0, 0, pref_size.width(), pref_size.height()); |
347 return panel_view_->window()->non_client_view()-> | 351 return panel_view_->window()->non_client_view()-> |
348 GetWindowBoundsForClientBounds(bounds).size(); | 352 GetWindowBoundsForClientBounds(bounds).size(); |
349 } | 353 } |
350 | 354 |
351 std::string PanelFrameView::GetClassName() const { | 355 std::string PanelFrameView::GetClassName() const { |
352 return kViewClassName; | 356 return kViewClassName; |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 | 629 |
626 void PanelFrameView::PaintDivider(gfx::Canvas* canvas) { | 630 void PanelFrameView::PaintDivider(gfx::Canvas* canvas) { |
627 // Draw the divider between the titlebar and the client area only if the panel | 631 // Draw the divider between the titlebar and the client area only if the panel |
628 // is big enough to show more than the titlebar. | 632 // is big enough to show more than the titlebar. |
629 if (height() > TitlebarHeight()) { | 633 if (height() > TitlebarHeight()) { |
630 canvas->DrawLine(gfx::Point(0, panel::kTitlebarHeight - 1), | 634 canvas->DrawLine(gfx::Point(0, panel::kTitlebarHeight - 1), |
631 gfx::Point(width() - 1, panel::kTitlebarHeight - 1), | 635 gfx::Point(width() - 1, panel::kTitlebarHeight - 1), |
632 kDividerColor); | 636 kDividerColor); |
633 } | 637 } |
634 } | 638 } |
OLD | NEW |