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

Side by Side Diff: ash/popup_message.cc

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More compile fix for ToT Created 6 years, 7 months 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
« no previous file with comments | « ash/ime/mode_indicator_view.cc ('k') | ash/shelf/overflow_bubble_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "ash/popup_message.h" 5 #include "ash/popup_message.h"
6 6
7 #include "ash/wm/window_animations.h" 7 #include "ash/wm/window_animations.h"
8 #include "grit/ash_resources.h" 8 #include "grit/ash_resources.h"
9 #include "ui/base/resource/resource_bundle.h" 9 #include "ui/base/resource/resource_bundle.h"
10 #include "ui/gfx/insets.h" 10 #include "ui/gfx/insets.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 IconType message_type, 47 IconType message_type,
48 views::View* anchor, 48 views::View* anchor,
49 views::BubbleBorder::Arrow arrow_orientation, 49 views::BubbleBorder::Arrow arrow_orientation,
50 const gfx::Size& size_override, 50 const gfx::Size& size_override,
51 int arrow_offset); 51 int arrow_offset);
52 52
53 void Close(); 53 void Close();
54 54
55 private: 55 private:
56 // views::View overrides: 56 // views::View overrides:
57 virtual gfx::Size GetPreferredSize() OVERRIDE; 57 virtual gfx::Size GetPreferredSize() const OVERRIDE;
58 58
59 // Each component (width/height) can force a size override for that component 59 // Each component (width/height) can force a size override for that component
60 // if not 0. 60 // if not 0.
61 gfx::Size size_override_; 61 gfx::Size size_override_;
62 62
63 DISALLOW_COPY_AND_ASSIGN(MessageBubble); 63 DISALLOW_COPY_AND_ASSIGN(MessageBubble);
64 }; 64 };
65 65
66 PopupMessage::MessageBubble::MessageBubble(const base::string16& caption, 66 PopupMessage::MessageBubble::MessageBubble(const base::string16& caption,
67 const base::string16& message, 67 const base::string16& message,
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 GetBubbleFrameView()->bubble_border()->set_arrow(arrow); 156 GetBubbleFrameView()->bubble_border()->set_arrow(arrow);
157 SetAlignment(views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR); 157 SetAlignment(views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR);
158 } 158 }
159 } 159 }
160 160
161 void PopupMessage::MessageBubble::Close() { 161 void PopupMessage::MessageBubble::Close() {
162 if (GetWidget()) 162 if (GetWidget())
163 GetWidget()->Close(); 163 GetWidget()->Close();
164 } 164 }
165 165
166 gfx::Size PopupMessage::MessageBubble::GetPreferredSize() { 166 gfx::Size PopupMessage::MessageBubble::GetPreferredSize() const {
167 gfx::Size pref_size = views::BubbleDelegateView::GetPreferredSize(); 167 gfx::Size pref_size = views::BubbleDelegateView::GetPreferredSize();
168 // Override the size with either the provided size or adjust it to not 168 // Override the size with either the provided size or adjust it to not
169 // violate our minimum / maximum sizes. 169 // violate our minimum / maximum sizes.
170 if (size_override_.height()) 170 if (size_override_.height())
171 pref_size.set_height(size_override_.height()); 171 pref_size.set_height(size_override_.height());
172 else if (pref_size.height() < kMessageMinHeight) 172 else if (pref_size.height() < kMessageMinHeight)
173 pref_size.set_height(kMessageMinHeight); 173 pref_size.set_height(kMessageMinHeight);
174 174
175 if (size_override_.width()) 175 if (size_override_.width())
176 pref_size.set_width(size_override_.width()); 176 pref_size.set_width(size_override_.width());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 void PopupMessage::CancelHidingAnimation() { 217 void PopupMessage::CancelHidingAnimation() {
218 if (!widget_ || !widget_->GetNativeView()) 218 if (!widget_ || !widget_->GetNativeView())
219 return; 219 return;
220 220
221 gfx::NativeView native_view = widget_->GetNativeView(); 221 gfx::NativeView native_view = widget_->GetNativeView();
222 wm::SetWindowVisibilityAnimationTransition( 222 wm::SetWindowVisibilityAnimationTransition(
223 native_view, wm::ANIMATE_NONE); 223 native_view, wm::ANIMATE_NONE);
224 } 224 }
225 225
226 } // namespace ash 226 } // namespace ash
OLDNEW
« no previous file with comments | « ash/ime/mode_indicator_view.cc ('k') | ash/shelf/overflow_bubble_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698