| 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(widget_delegate->GetWindowTitle()); | 53 title_ = new views::Label( |
| 54 UTF16ToWideHack(widget_delegate->GetWindowTitle())); |
| 54 title_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 55 title_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
| 55 title_->SetFont(title_->font().DeriveFont(kFontSizeCorrectionDelta, | 56 title_->SetFont(title_->font().DeriveFont(kFontSizeCorrectionDelta, |
| 56 gfx::Font::BOLD)); | 57 gfx::Font::BOLD)); |
| 57 AddChildView(title_); | 58 AddChildView(title_); |
| 58 } | 59 } |
| 59 | 60 |
| 60 if (style_ & STYLE_XBAR) { | 61 if (style_ & STYLE_XBAR) { |
| 61 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 62 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 62 close_button_ = new views::ImageButton(this); | 63 close_button_ = new views::ImageButton(this); |
| 63 close_button_->SetImage(views::CustomButton::BS_NORMAL, | 64 close_button_->SetImage(views::CustomButton::BS_NORMAL, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 74 AddChildView(throbber_); | 75 AddChildView(throbber_); |
| 75 } | 76 } |
| 76 } | 77 } |
| 77 | 78 |
| 78 BubbleFrameView::~BubbleFrameView() { | 79 BubbleFrameView::~BubbleFrameView() { |
| 79 } | 80 } |
| 80 | 81 |
| 81 void BubbleFrameView::StartThrobber() { | 82 void BubbleFrameView::StartThrobber() { |
| 82 DCHECK(throbber_ != NULL); | 83 DCHECK(throbber_ != NULL); |
| 83 if (title_) | 84 if (title_) |
| 84 title_->SetText(string16()); | 85 title_->SetText(std::wstring()); |
| 85 throbber_->Start(); | 86 throbber_->Start(); |
| 86 } | 87 } |
| 87 | 88 |
| 88 void BubbleFrameView::StopThrobber() { | 89 void BubbleFrameView::StopThrobber() { |
| 89 DCHECK(throbber_ != NULL); | 90 DCHECK(throbber_ != NULL); |
| 90 throbber_->Stop(); | 91 throbber_->Stop(); |
| 91 if (title_) | 92 if (title_) |
| 92 title_->SetText(frame_->widget_delegate()->GetWindowTitle()); | 93 title_->SetText( |
| 94 UTF16ToWideHack(frame_->widget_delegate()->GetWindowTitle())); |
| 93 } | 95 } |
| 94 | 96 |
| 95 gfx::Rect BubbleFrameView::GetBoundsForClientView() const { | 97 gfx::Rect BubbleFrameView::GetBoundsForClientView() const { |
| 96 return client_view_bounds_; | 98 return client_view_bounds_; |
| 97 } | 99 } |
| 98 | 100 |
| 99 gfx::Rect BubbleFrameView::GetWindowBoundsForClientBounds( | 101 gfx::Rect BubbleFrameView::GetWindowBoundsForClientBounds( |
| 100 const gfx::Rect& client_bounds) const { | 102 const gfx::Rect& client_bounds) const { |
| 101 gfx::Insets insets = GetInsets(); | 103 gfx::Insets insets = GetInsets(); |
| 102 | 104 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 canvas->AsCanvasSkia()->drawPath(path, paint); | 218 canvas->AsCanvasSkia()->drawPath(path, paint); |
| 217 } | 219 } |
| 218 | 220 |
| 219 void BubbleFrameView::ButtonPressed(views::Button* sender, | 221 void BubbleFrameView::ButtonPressed(views::Button* sender, |
| 220 const views::Event& event) { | 222 const views::Event& event) { |
| 221 if (close_button_ != NULL && sender == close_button_) | 223 if (close_button_ != NULL && sender == close_button_) |
| 222 frame_->Close(); | 224 frame_->Close(); |
| 223 } | 225 } |
| 224 | 226 |
| 225 } // namespace chromeos | 227 } // namespace chromeos |
| OLD | NEW |