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

Side by Side Diff: ui/views/controls/menu/menu_scroll_view_container.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
OLDNEW
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 "ui/views/controls/menu/menu_scroll_view_container.h" 5 #include "ui/views/controls/menu/menu_scroll_view_container.h"
6 6
7 #include "third_party/skia/include/core/SkPaint.h" 7 #include "third_party/skia/include/core/SkPaint.h"
8 #include "third_party/skia/include/core/SkPath.h" 8 #include "third_party/skia/include/core/SkPath.h"
9 #include "ui/accessibility/ax_view_state.h" 9 #include "ui/accessibility/ax_view_state.h"
10 #include "ui/gfx/canvas.h" 10 #include "ui/gfx/canvas.h"
(...skipping 22 matching lines...) Expand all
33 33
34 class MenuScrollButton : public View { 34 class MenuScrollButton : public View {
35 public: 35 public:
36 MenuScrollButton(SubmenuView* host, bool is_up) 36 MenuScrollButton(SubmenuView* host, bool is_up)
37 : host_(host), 37 : host_(host),
38 is_up_(is_up), 38 is_up_(is_up),
39 // Make our height the same as that of other MenuItemViews. 39 // Make our height the same as that of other MenuItemViews.
40 pref_height_(MenuItemView::pref_menu_height()) { 40 pref_height_(MenuItemView::pref_menu_height()) {
41 } 41 }
42 42
43 virtual gfx::Size GetPreferredSize() OVERRIDE { 43 virtual gfx::Size GetPreferredSize() const OVERRIDE {
44 return gfx::Size( 44 return gfx::Size(
45 host_->GetMenuItem()->GetMenuConfig().scroll_arrow_height * 2 - 1, 45 host_->GetMenuItem()->GetMenuConfig().scroll_arrow_height * 2 - 1,
46 pref_height_); 46 pref_height_);
47 } 47 }
48 48
49 virtual bool CanDrop(const OSExchangeData& data) OVERRIDE { 49 virtual bool CanDrop(const OSExchangeData& data) OVERRIDE {
50 DCHECK(host_->GetMenuItem()->GetMenuController()); 50 DCHECK(host_->GetMenuItem()->GetMenuController());
51 return true; // Always return true so that drop events are targeted to us. 51 return true; // Always return true so that drop events are targeted to us.
52 } 52 }
53 53
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 236
237 pref = scroll_down_button_->GetPreferredSize(); 237 pref = scroll_down_button_->GetPreferredSize();
238 scroll_down_button_->SetBounds(x, height() - pref.height() - insets.top(), 238 scroll_down_button_->SetBounds(x, height() - pref.height() - insets.top(),
239 width, pref.height()); 239 width, pref.height());
240 content_height -= pref.height(); 240 content_height -= pref.height();
241 241
242 scroll_view_->SetBounds(x, scroll_view_y, width, content_height); 242 scroll_view_->SetBounds(x, scroll_view_y, width, content_height);
243 scroll_view_->Layout(); 243 scroll_view_->Layout();
244 } 244 }
245 245
246 gfx::Size MenuScrollViewContainer::GetPreferredSize() { 246 gfx::Size MenuScrollViewContainer::GetPreferredSize() const {
247 gfx::Size prefsize = scroll_view_->GetContents()->GetPreferredSize(); 247 gfx::Size prefsize = scroll_view_->GetContents()->GetPreferredSize();
248 gfx::Insets insets = GetInsets(); 248 gfx::Insets insets = GetInsets();
249 prefsize.Enlarge(insets.width(), insets.height()); 249 prefsize.Enlarge(insets.width(), insets.height());
250 return prefsize; 250 return prefsize;
251 } 251 }
252 252
253 void MenuScrollViewContainer::GetAccessibleState( 253 void MenuScrollViewContainer::GetAccessibleState(
254 ui::AXViewState* state) { 254 ui::AXViewState* state) {
255 // Get the name from the submenu view. 255 // Get the name from the submenu view.
256 content_view_->GetAccessibleState(state); 256 content_view_->GetAccessibleState(state);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 case MENU_ANCHOR_BUBBLE_ABOVE: 325 case MENU_ANCHOR_BUBBLE_ABOVE:
326 return BubbleBorder::BOTTOM_CENTER; 326 return BubbleBorder::BOTTOM_CENTER;
327 case MENU_ANCHOR_BUBBLE_BELOW: 327 case MENU_ANCHOR_BUBBLE_BELOW:
328 return BubbleBorder::TOP_CENTER; 328 return BubbleBorder::TOP_CENTER;
329 default: 329 default:
330 return BubbleBorder::NONE; 330 return BubbleBorder::NONE;
331 } 331 }
332 } 332 }
333 333
334 } // namespace views 334 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_scroll_view_container.h ('k') | ui/views/controls/menu/menu_separator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698