Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Side by Side Diff: chrome/browser/chromeos/frame/bubble_frame_view.cc

Issue 8811001: Oust BubbleWindow from ExtensionDialog, use chromeos::BubbleFrameView directly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Build requisite and non-breaking chrome/browser/chromeos/frame/ files in aura cros. Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/chromeos/frame/bubble_window.h" 10 #include "chrome/browser/chromeos/frame/bubble_window.h"
(...skipping 24 matching lines...) Expand all
35 #if defined(CROS_FONTS_USING_BCI) 35 #if defined(CROS_FONTS_USING_BCI)
36 const int kTitleFontSizeDelta = 0; 36 const int kTitleFontSizeDelta = 0;
37 #else 37 #else
38 const int kTitleFontSizeDelta = 1; 38 const int kTitleFontSizeDelta = 1;
39 #endif 39 #endif
40 40
41 } // namespace 41 } // namespace
42 42
43 namespace chromeos { 43 namespace chromeos {
44 44
45 BubbleFrameView::BubbleFrameView(views::Widget* frame, 45 BubbleFrameView::BubbleFrameView(views::WidgetDelegate* widget_delegate,
46 views::WidgetDelegate* widget_delegate,
47 DialogStyle style) 46 DialogStyle style)
48 : frame_(frame), 47 : style_(style),
49 style_(style),
50 title_(NULL), 48 title_(NULL),
51 close_button_(NULL), 49 close_button_(NULL),
52 throbber_(NULL) { 50 throbber_(NULL) {
53 if (widget_delegate->ShouldShowWindowTitle()) { 51 if (widget_delegate->ShouldShowWindowTitle()) {
54 title_ = new views::Label(widget_delegate->GetWindowTitle()); 52 title_ = new views::Label(widget_delegate->GetWindowTitle());
55 title_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 53 title_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
56 title_->SetFont(title_->font().DeriveFont(kFontSizeCorrectionDelta, 54 title_->SetFont(title_->font().DeriveFont(kFontSizeCorrectionDelta,
57 gfx::Font::BOLD)); 55 gfx::Font::BOLD));
58 AddChildView(title_); 56 AddChildView(title_);
59 } 57 }
(...skipping 23 matching lines...) Expand all
83 DCHECK(throbber_ != NULL); 81 DCHECK(throbber_ != NULL);
84 if (title_) 82 if (title_)
85 title_->SetText(string16()); 83 title_->SetText(string16());
86 throbber_->Start(); 84 throbber_->Start();
87 } 85 }
88 86
89 void BubbleFrameView::StopThrobber() { 87 void BubbleFrameView::StopThrobber() {
90 DCHECK(throbber_ != NULL); 88 DCHECK(throbber_ != NULL);
91 throbber_->Stop(); 89 throbber_->Stop();
92 if (title_) 90 if (title_)
93 title_->SetText(frame_->widget_delegate()->GetWindowTitle()); 91 title_->SetText(GetWidget()->widget_delegate()->GetWindowTitle());
94 } 92 }
95 93
96 gfx::Rect BubbleFrameView::GetBoundsForClientView() const { 94 gfx::Rect BubbleFrameView::GetBoundsForClientView() const {
97 return client_view_bounds_; 95 return client_view_bounds_;
98 } 96 }
99 97
100 gfx::Rect BubbleFrameView::GetWindowBoundsForClientBounds( 98 gfx::Rect BubbleFrameView::GetWindowBoundsForClientBounds(
101 const gfx::Rect& client_bounds) const { 99 const gfx::Rect& client_bounds) const {
102 gfx::Insets insets = GetInsets(); 100 gfx::Insets insets = GetInsets();
103 101
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 gfx::Insets BubbleFrameView::GetInsets() const { 140 gfx::Insets BubbleFrameView::GetInsets() const {
143 return (style_ & STYLE_FLUSH || style_ & STYLE_FLUSH_CONTENT) ? 141 return (style_ & STYLE_FLUSH || style_ & STYLE_FLUSH_CONTENT) ?
144 gfx::Insets() : 142 gfx::Insets() :
145 gfx::Insets(kTitleTopPadding, 143 gfx::Insets(kTitleTopPadding,
146 kHorizontalPadding, 144 kHorizontalPadding,
147 0, 145 0,
148 kHorizontalPadding); 146 kHorizontalPadding);
149 } 147 }
150 148
151 gfx::Size BubbleFrameView::GetPreferredSize() { 149 gfx::Size BubbleFrameView::GetPreferredSize() {
152 gfx::Size pref = frame_->client_view()->GetPreferredSize(); 150 gfx::Size pref = GetWidget()->client_view()->GetPreferredSize();
153 gfx::Rect bounds(0, 0, pref.width(), pref.height()); 151 gfx::Rect bounds(0, 0, pref.width(), pref.height());
154 return frame_->non_client_view()->GetWindowBoundsForClientBounds( 152 return GetWidget()->non_client_view()->GetWindowBoundsForClientBounds(
155 bounds).size(); 153 bounds).size();
156 } 154 }
157 155
158 void BubbleFrameView::Layout() { 156 void BubbleFrameView::Layout() {
159 gfx::Insets insets = GetInsets(); 157 gfx::Insets insets = GetInsets();
160 158
161 gfx::Size title_size; 159 gfx::Size title_size;
162 if (title_) 160 if (title_)
163 title_size = title_->GetPreferredSize(); 161 title_size = title_->GetPreferredSize();
164 gfx::Size close_button_size; 162 gfx::Size close_button_size;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 SkRect rect; 230 SkRect rect;
233 rect.set(SkIntToScalar(bounds.x()), SkIntToScalar(bounds.y()), 231 rect.set(SkIntToScalar(bounds.x()), SkIntToScalar(bounds.y()),
234 SkIntToScalar(bounds.right()), SkIntToScalar(bounds.bottom())); 232 SkIntToScalar(bounds.right()), SkIntToScalar(bounds.bottom()));
235 path.addRect(rect); 233 path.addRect(rect);
236 canvas->GetSkCanvas()->drawPath(path, paint); 234 canvas->GetSkCanvas()->drawPath(path, paint);
237 } 235 }
238 236
239 void BubbleFrameView::ButtonPressed(views::Button* sender, 237 void BubbleFrameView::ButtonPressed(views::Button* sender,
240 const views::Event& event) { 238 const views::Event& event) {
241 if (close_button_ != NULL && sender == close_button_) 239 if (close_button_ != NULL && sender == close_button_)
242 frame_->Close(); 240 GetWidget()->Close();
243 } 241 }
244 242
245 } // namespace chromeos 243 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/frame/bubble_frame_view.h ('k') | chrome/browser/chromeos/frame/bubble_window_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698