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

Side by Side Diff: ui/views/bubble/tray_bubble_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/bubble/tray_bubble_view.h ('k') | ui/views/cocoa/bridged_native_widget.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) 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/bubble/tray_bubble_view.h" 5 #include "ui/views/bubble/tray_bubble_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "third_party/skia/include/core/SkCanvas.h" 9 #include "third_party/skia/include/core/SkCanvas.h"
10 #include "third_party/skia/include/core/SkColor.h" 10 #include "third_party/skia/include/core/SkColor.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 namespace internal { 49 namespace internal {
50 50
51 // Detects any mouse movement. This is needed to detect mouse movements by the 51 // Detects any mouse movement. This is needed to detect mouse movements by the
52 // user over the bubble if the bubble got created underneath the cursor. 52 // user over the bubble if the bubble got created underneath the cursor.
53 class MouseMoveDetectorHost : public MouseWatcherHost { 53 class MouseMoveDetectorHost : public MouseWatcherHost {
54 public: 54 public:
55 MouseMoveDetectorHost(); 55 MouseMoveDetectorHost();
56 virtual ~MouseMoveDetectorHost(); 56 virtual ~MouseMoveDetectorHost();
57 57
58 virtual bool Contains(const gfx::Point& screen_point, 58 virtual bool Contains(const gfx::Point& screen_point,
59 MouseEventType type) OVERRIDE; 59 MouseEventType type) override;
60 private: 60 private:
61 DISALLOW_COPY_AND_ASSIGN(MouseMoveDetectorHost); 61 DISALLOW_COPY_AND_ASSIGN(MouseMoveDetectorHost);
62 }; 62 };
63 63
64 MouseMoveDetectorHost::MouseMoveDetectorHost() { 64 MouseMoveDetectorHost::MouseMoveDetectorHost() {
65 } 65 }
66 66
67 MouseMoveDetectorHost::~MouseMoveDetectorHost() { 67 MouseMoveDetectorHost::~MouseMoveDetectorHost() {
68 } 68 }
69 69
(...skipping 17 matching lines...) Expand all
87 set_alignment(params.arrow_alignment); 87 set_alignment(params.arrow_alignment);
88 set_background_color(params.arrow_color); 88 set_background_color(params.arrow_color);
89 set_paint_arrow(params.arrow_paint_type); 89 set_paint_arrow(params.arrow_paint_type);
90 } 90 }
91 91
92 virtual ~TrayBubbleBorder() {} 92 virtual ~TrayBubbleBorder() {}
93 93
94 // Overridden from BubbleBorder. 94 // Overridden from BubbleBorder.
95 // Sets the bubble on top of the anchor when it has no arrow. 95 // Sets the bubble on top of the anchor when it has no arrow.
96 virtual gfx::Rect GetBounds(const gfx::Rect& position_relative_to, 96 virtual gfx::Rect GetBounds(const gfx::Rect& position_relative_to,
97 const gfx::Size& contents_size) const OVERRIDE { 97 const gfx::Size& contents_size) const override {
98 if (has_arrow(arrow())) { 98 if (has_arrow(arrow())) {
99 gfx::Rect rect = 99 gfx::Rect rect =
100 BubbleBorder::GetBounds(position_relative_to, contents_size); 100 BubbleBorder::GetBounds(position_relative_to, contents_size);
101 if (first_item_has_no_margin_) { 101 if (first_item_has_no_margin_) {
102 if (arrow() == BubbleBorder::BOTTOM_RIGHT || 102 if (arrow() == BubbleBorder::BOTTOM_RIGHT ||
103 arrow() == BubbleBorder::BOTTOM_LEFT) { 103 arrow() == BubbleBorder::BOTTOM_LEFT) {
104 rect.set_y(rect.y() + kArrowOffsetTopBottom); 104 rect.set_y(rect.y() + kArrowOffsetTopBottom);
105 int rtl_factor = base::i18n::IsRTL() ? -1 : 1; 105 int rtl_factor = base::i18n::IsRTL() ? -1 : 1;
106 rect.set_x(rect.x() + 106 rect.set_x(rect.x() +
107 rtl_factor * kOffsetLeftRightForTopBottomOrientation); 107 rtl_factor * kOffsetLeftRightForTopBottomOrientation);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // TODO(miket): This does not work on Windows. Implement layer masking or 175 // TODO(miket): This does not work on Windows. Implement layer masking or
176 // alternate solutions if the TrayBubbleView is needed there in the future. 176 // alternate solutions if the TrayBubbleView is needed there in the future.
177 class TrayBubbleContentMask : public ui::LayerDelegate { 177 class TrayBubbleContentMask : public ui::LayerDelegate {
178 public: 178 public:
179 explicit TrayBubbleContentMask(int corner_radius); 179 explicit TrayBubbleContentMask(int corner_radius);
180 virtual ~TrayBubbleContentMask(); 180 virtual ~TrayBubbleContentMask();
181 181
182 ui::Layer* layer() { return &layer_; } 182 ui::Layer* layer() { return &layer_; }
183 183
184 // Overridden from LayerDelegate. 184 // Overridden from LayerDelegate.
185 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; 185 virtual void OnPaintLayer(gfx::Canvas* canvas) override;
186 virtual void OnDelegatedFrameDamage( 186 virtual void OnDelegatedFrameDamage(
187 const gfx::Rect& damage_rect_in_dip) OVERRIDE {} 187 const gfx::Rect& damage_rect_in_dip) override {}
188 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; 188 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override;
189 virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE; 189 virtual base::Closure PrepareForLayerBoundsChange() override;
190 190
191 private: 191 private:
192 ui::Layer layer_; 192 ui::Layer layer_;
193 int corner_radius_; 193 int corner_radius_;
194 194
195 DISALLOW_COPY_AND_ASSIGN(TrayBubbleContentMask); 195 DISALLOW_COPY_AND_ASSIGN(TrayBubbleContentMask);
196 }; 196 };
197 197
198 TrayBubbleContentMask::TrayBubbleContentMask(int corner_radius) 198 TrayBubbleContentMask::TrayBubbleContentMask(int corner_radius)
199 : layer_(ui::LAYER_TEXTURED), 199 : layer_(ui::LAYER_TEXTURED),
(...skipping 27 matching lines...) Expand all
227 class BottomAlignedBoxLayout : public BoxLayout { 227 class BottomAlignedBoxLayout : public BoxLayout {
228 public: 228 public:
229 explicit BottomAlignedBoxLayout(TrayBubbleView* bubble_view) 229 explicit BottomAlignedBoxLayout(TrayBubbleView* bubble_view)
230 : BoxLayout(BoxLayout::kVertical, 0, 0, 0), 230 : BoxLayout(BoxLayout::kVertical, 0, 0, 0),
231 bubble_view_(bubble_view) { 231 bubble_view_(bubble_view) {
232 } 232 }
233 233
234 virtual ~BottomAlignedBoxLayout() {} 234 virtual ~BottomAlignedBoxLayout() {}
235 235
236 private: 236 private:
237 virtual void Layout(View* host) OVERRIDE { 237 virtual void Layout(View* host) override {
238 if (host->height() >= host->GetPreferredSize().height() || 238 if (host->height() >= host->GetPreferredSize().height() ||
239 !bubble_view_->is_gesture_dragging()) { 239 !bubble_view_->is_gesture_dragging()) {
240 BoxLayout::Layout(host); 240 BoxLayout::Layout(host);
241 return; 241 return;
242 } 242 }
243 243
244 int consumed_height = 0; 244 int consumed_height = 0;
245 for (int i = host->child_count() - 1; 245 for (int i = host->child_count() - 1;
246 i >= 0 && consumed_height < host->height(); --i) { 246 i >= 0 && consumed_height < host->height(); --i) {
247 View* child = host->child_at(i); 247 View* child = host->child_at(i);
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 void TrayBubbleView::ViewHierarchyChanged( 499 void TrayBubbleView::ViewHierarchyChanged(
500 const ViewHierarchyChangedDetails& details) { 500 const ViewHierarchyChangedDetails& details) {
501 if (details.is_add && details.child == this) { 501 if (details.is_add && details.child == this) {
502 details.parent->SetPaintToLayer(true); 502 details.parent->SetPaintToLayer(true);
503 details.parent->SetFillsBoundsOpaquely(true); 503 details.parent->SetFillsBoundsOpaquely(true);
504 details.parent->layer()->SetMasksToBounds(true); 504 details.parent->layer()->SetMasksToBounds(true);
505 } 505 }
506 } 506 }
507 507
508 } // namespace views 508 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/bubble/tray_bubble_view.h ('k') | ui/views/cocoa/bridged_native_widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698