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

Side by Side Diff: ui/views/controls/scroll_view.cc

Issue 623293004: replace OVERRIDE and FINAL with override and final in ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 6 years, 2 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
« no previous file with comments | « ui/views/controls/scroll_view.h ('k') | ui/views/controls/scroll_view_unittest.cc » ('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) 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/scroll_view.h" 5 #include "ui/views/controls/scroll_view.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/events/event.h" 8 #include "ui/events/event.h"
9 #include "ui/gfx/canvas.h" 9 #include "ui/gfx/canvas.h"
10 #include "ui/native_theme/native_theme.h" 10 #include "ui/native_theme/native_theme.h"
11 #include "ui/views/border.h" 11 #include "ui/views/border.h"
12 #include "ui/views/controls/scrollbar/native_scroll_bar.h" 12 #include "ui/views/controls/scrollbar/native_scroll_bar.h"
13 #include "ui/views/widget/root_view.h" 13 #include "ui/views/widget/root_view.h"
14 14
15 namespace views { 15 namespace views {
16 16
17 const char ScrollView::kViewClassName[] = "ScrollView"; 17 const char ScrollView::kViewClassName[] = "ScrollView";
18 18
19 namespace { 19 namespace {
20 20
21 // Subclass of ScrollView that resets the border when the theme changes. 21 // Subclass of ScrollView that resets the border when the theme changes.
22 class ScrollViewWithBorder : public views::ScrollView { 22 class ScrollViewWithBorder : public views::ScrollView {
23 public: 23 public:
24 ScrollViewWithBorder() {} 24 ScrollViewWithBorder() {}
25 25
26 // View overrides; 26 // View overrides;
27 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE { 27 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) override {
28 SetBorder(Border::CreateSolidBorder( 28 SetBorder(Border::CreateSolidBorder(
29 1, 29 1,
30 theme->GetSystemColor(ui::NativeTheme::kColorId_UnfocusedBorderColor))); 30 theme->GetSystemColor(ui::NativeTheme::kColorId_UnfocusedBorderColor)));
31 } 31 }
32 32
33 private: 33 private:
34 DISALLOW_COPY_AND_ASSIGN(ScrollViewWithBorder); 34 DISALLOW_COPY_AND_ASSIGN(ScrollViewWithBorder);
35 }; 35 };
36 36
37 class ScrollCornerView : public views::View { 37 class ScrollCornerView : public views::View {
38 public: 38 public:
39 ScrollCornerView() {} 39 ScrollCornerView() {}
40 40
41 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { 41 virtual void OnPaint(gfx::Canvas* canvas) override {
42 ui::NativeTheme::ExtraParams ignored; 42 ui::NativeTheme::ExtraParams ignored;
43 GetNativeTheme()->Paint(canvas->sk_canvas(), 43 GetNativeTheme()->Paint(canvas->sk_canvas(),
44 ui::NativeTheme::kScrollbarCorner, 44 ui::NativeTheme::kScrollbarCorner,
45 ui::NativeTheme::kNormal, 45 ui::NativeTheme::kNormal,
46 GetLocalBounds(), 46 GetLocalBounds(),
47 ignored); 47 ignored);
48 } 48 }
49 49
50 private: 50 private:
51 DISALLOW_COPY_AND_ASSIGN(ScrollCornerView); 51 DISALLOW_COPY_AND_ASSIGN(ScrollCornerView);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 } 89 }
90 90
91 } // namespace 91 } // namespace
92 92
93 // Viewport contains the contents View of the ScrollView. 93 // Viewport contains the contents View of the ScrollView.
94 class ScrollView::Viewport : public View { 94 class ScrollView::Viewport : public View {
95 public: 95 public:
96 Viewport() {} 96 Viewport() {}
97 virtual ~Viewport() {} 97 virtual ~Viewport() {}
98 98
99 virtual const char* GetClassName() const OVERRIDE { 99 virtual const char* GetClassName() const override {
100 return "ScrollView::Viewport"; 100 return "ScrollView::Viewport";
101 } 101 }
102 102
103 virtual void ScrollRectToVisible(const gfx::Rect& rect) OVERRIDE { 103 virtual void ScrollRectToVisible(const gfx::Rect& rect) override {
104 if (!has_children() || !parent()) 104 if (!has_children() || !parent())
105 return; 105 return;
106 106
107 View* contents = child_at(0); 107 View* contents = child_at(0);
108 gfx::Rect scroll_rect(rect); 108 gfx::Rect scroll_rect(rect);
109 scroll_rect.Offset(-contents->x(), -contents->y()); 109 scroll_rect.Offset(-contents->x(), -contents->y());
110 static_cast<ScrollView*>(parent())->ScrollContentsRegionToBeVisible( 110 static_cast<ScrollView*>(parent())->ScrollContentsRegionToBeVisible(
111 scroll_rect); 111 scroll_rect);
112 } 112 }
113 113
114 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE { 114 virtual void ChildPreferredSizeChanged(View* child) override {
115 if (parent()) 115 if (parent())
116 parent()->Layout(); 116 parent()->Layout();
117 } 117 }
118 118
119 private: 119 private:
120 DISALLOW_COPY_AND_ASSIGN(Viewport); 120 DISALLOW_COPY_AND_ASSIGN(Viewport);
121 }; 121 };
122 122
123 ScrollView::ScrollView() 123 ScrollView::ScrollView()
124 : contents_(NULL), 124 : contents_(NULL),
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 635
636 VariableRowHeightScrollHelper::RowInfo 636 VariableRowHeightScrollHelper::RowInfo
637 FixedRowHeightScrollHelper::GetRowInfo(int y) { 637 FixedRowHeightScrollHelper::GetRowInfo(int y) {
638 if (y < top_margin_) 638 if (y < top_margin_)
639 return RowInfo(0, top_margin_); 639 return RowInfo(0, top_margin_);
640 return RowInfo((y - top_margin_) / row_height_ * row_height_ + top_margin_, 640 return RowInfo((y - top_margin_) / row_height_ * row_height_ + top_margin_,
641 row_height_); 641 row_height_);
642 } 642 }
643 643
644 } // namespace views 644 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/scroll_view.h ('k') | ui/views/controls/scroll_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698