| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "chrome/browser/chromeos/frame/bubble_window.h" | 9 #include "chrome/browser/chromeos/frame/bubble_window.h" |
| 10 #include "chrome/browser/chromeos/login/helper.h" | 10 #include "chrome/browser/chromeos/login/helper.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 BubbleFrameView::BubbleFrameView(views::Widget* frame, | 44 BubbleFrameView::BubbleFrameView(views::Widget* frame, |
| 45 views::WidgetDelegate* widget_delegate, | 45 views::WidgetDelegate* widget_delegate, |
| 46 BubbleWindowStyle style) | 46 BubbleWindowStyle style) |
| 47 : frame_(frame), | 47 : frame_(frame), |
| 48 style_(style), | 48 style_(style), |
| 49 title_(NULL), | 49 title_(NULL), |
| 50 close_button_(NULL), | 50 close_button_(NULL), |
| 51 throbber_(NULL) { | 51 throbber_(NULL) { |
| 52 if (widget_delegate->ShouldShowWindowTitle()) { | 52 if (widget_delegate->ShouldShowWindowTitle()) { |
| 53 title_ = new views::Label( | 53 title_ = new views::Label(widget_delegate->GetWindowTitle()); |
| 54 UTF16ToWideHack(widget_delegate->GetWindowTitle())); | |
| 55 title_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 54 title_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
| 56 title_->SetFont(title_->font().DeriveFont(kFontSizeCorrectionDelta, | 55 title_->SetFont(title_->font().DeriveFont(kFontSizeCorrectionDelta, |
| 57 gfx::Font::BOLD)); | 56 gfx::Font::BOLD)); |
| 58 AddChildView(title_); | 57 AddChildView(title_); |
| 59 } | 58 } |
| 60 | 59 |
| 61 if (style_ & STYLE_XBAR) { | 60 if (style_ & STYLE_XBAR) { |
| 62 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 61 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 63 close_button_ = new views::ImageButton(this); | 62 close_button_ = new views::ImageButton(this); |
| 64 close_button_->SetImage(views::CustomButton::BS_NORMAL, | 63 close_button_->SetImage(views::CustomButton::BS_NORMAL, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 75 AddChildView(throbber_); | 74 AddChildView(throbber_); |
| 76 } | 75 } |
| 77 } | 76 } |
| 78 | 77 |
| 79 BubbleFrameView::~BubbleFrameView() { | 78 BubbleFrameView::~BubbleFrameView() { |
| 80 } | 79 } |
| 81 | 80 |
| 82 void BubbleFrameView::StartThrobber() { | 81 void BubbleFrameView::StartThrobber() { |
| 83 DCHECK(throbber_ != NULL); | 82 DCHECK(throbber_ != NULL); |
| 84 if (title_) | 83 if (title_) |
| 85 title_->SetText(std::wstring()); | 84 title_->SetText(string16()); |
| 86 throbber_->Start(); | 85 throbber_->Start(); |
| 87 } | 86 } |
| 88 | 87 |
| 89 void BubbleFrameView::StopThrobber() { | 88 void BubbleFrameView::StopThrobber() { |
| 90 DCHECK(throbber_ != NULL); | 89 DCHECK(throbber_ != NULL); |
| 91 throbber_->Stop(); | 90 throbber_->Stop(); |
| 92 if (title_) | 91 if (title_) |
| 93 title_->SetText( | 92 title_->SetText(frame_->widget_delegate()->GetWindowTitle()); |
| 94 UTF16ToWideHack(frame_->widget_delegate()->GetWindowTitle())); | |
| 95 } | 93 } |
| 96 | 94 |
| 97 gfx::Rect BubbleFrameView::GetBoundsForClientView() const { | 95 gfx::Rect BubbleFrameView::GetBoundsForClientView() const { |
| 98 return client_view_bounds_; | 96 return client_view_bounds_; |
| 99 } | 97 } |
| 100 | 98 |
| 101 gfx::Rect BubbleFrameView::GetWindowBoundsForClientBounds( | 99 gfx::Rect BubbleFrameView::GetWindowBoundsForClientBounds( |
| 102 const gfx::Rect& client_bounds) const { | 100 const gfx::Rect& client_bounds) const { |
| 103 gfx::Insets insets = GetInsets(); | 101 gfx::Insets insets = GetInsets(); |
| 104 | 102 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 canvas->AsCanvasSkia()->drawPath(path, paint); | 216 canvas->AsCanvasSkia()->drawPath(path, paint); |
| 219 } | 217 } |
| 220 | 218 |
| 221 void BubbleFrameView::ButtonPressed(views::Button* sender, | 219 void BubbleFrameView::ButtonPressed(views::Button* sender, |
| 222 const views::Event& event) { | 220 const views::Event& event) { |
| 223 if (close_button_ != NULL && sender == close_button_) | 221 if (close_button_ != NULL && sender == close_button_) |
| 224 frame_->Close(); | 222 frame_->Close(); |
| 225 } | 223 } |
| 226 | 224 |
| 227 } // namespace chromeos | 225 } // namespace chromeos |
| OLD | NEW |