summaryrefslogtreecommitdiffstats
path: root/ash/drag_drop
diff options
context:
space:
mode:
authordcheng <dcheng@chromium.org>2014-10-29 11:58:19 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-29 18:58:47 +0000
commit34dfcbecb289b7e0c7de7376f152da1eff7754eb (patch)
treea37071ca8fe57a9961011e65e4624d9a66d1482b /ash/drag_drop
parent80420e6031d94679f13af28f7d072e80a484b3a0 (diff)
downloadchromium_src-34dfcbecb289b7e0c7de7376f152da1eff7754eb.zip
chromium_src-34dfcbecb289b7e0c7de7376f152da1eff7754eb.tar.gz
chromium_src-34dfcbecb289b7e0c7de7376f152da1eff7754eb.tar.bz2
Standardize usage of virtual/override/final specifiers.
The Google C++ style guide states: Explicitly annotate overrides of virtual functions or virtual destructors with an override or (less frequently) final specifier. Older (pre-C++11) code will use the virtual keyword as an inferior alternative annotation. For clarity, use exactly one of override, final, or virtual when declaring an override. To better conform to these guidelines, the following constructs have been rewritten: - if a base class has a virtual destructor, then: virtual ~Foo(); -> ~Foo() override; - virtual void Foo() override; -> void Foo() override; - virtual void Foo() override final; -> void Foo() final; This patch was automatically generated. The clang plugin can generate fixit hints, which are suggested edits when it is 100% sure it knows how to fix a problem. The hints from the clang plugin were applied to the source tree using the tool in https://codereview.chromium.org/598073004. BUG=417463 R=varunjain@chromium.org Review URL: https://codereview.chromium.org/678123002 Cr-Commit-Position: refs/heads/master@{#301897}
Diffstat (limited to 'ash/drag_drop')
-rw-r--r--ash/drag_drop/drag_drop_controller.cc41
-rw-r--r--ash/drag_drop/drag_drop_controller.h41
-rw-r--r--ash/drag_drop/drag_drop_controller_unittest.cc67
-rw-r--r--ash/drag_drop/drag_drop_interactive_uitest.cc28
-rw-r--r--ash/drag_drop/drag_drop_tracker.cc6
-rw-r--r--ash/drag_drop/drag_drop_tracker_unittest.cc4
-rw-r--r--ash/drag_drop/drag_image_view.h4
7 files changed, 81 insertions, 110 deletions
diff --git a/ash/drag_drop/drag_drop_controller.cc b/ash/drag_drop/drag_drop_controller.cc
index 0aa1675..5ce5cd5 100644
--- a/ash/drag_drop/drag_drop_controller.cc
+++ b/ash/drag_drop/drag_drop_controller.cc
@@ -78,45 +78,38 @@ class DragDropTrackerDelegate : public aura::WindowDelegate {
public:
explicit DragDropTrackerDelegate(DragDropController* controller)
: drag_drop_controller_(controller) {}
- virtual ~DragDropTrackerDelegate() {}
+ ~DragDropTrackerDelegate() override {}
// Overridden from WindowDelegate:
- virtual gfx::Size GetMinimumSize() const override {
- return gfx::Size();
- }
+ gfx::Size GetMinimumSize() const override { return gfx::Size(); }
- virtual gfx::Size GetMaximumSize() const override {
- return gfx::Size();
- }
+ gfx::Size GetMaximumSize() const override { return gfx::Size(); }
- virtual void OnBoundsChanged(const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) override {}
- virtual gfx::NativeCursor GetCursor(const gfx::Point& point) override {
+ void OnBoundsChanged(const gfx::Rect& old_bounds,
+ const gfx::Rect& new_bounds) override {}
+ gfx::NativeCursor GetCursor(const gfx::Point& point) override {
return gfx::kNullCursor;
}
- virtual int GetNonClientComponent(const gfx::Point& point) const override {
+ int GetNonClientComponent(const gfx::Point& point) const override {
return HTCAPTION;
}
- virtual bool ShouldDescendIntoChildForEventHandling(
+ bool ShouldDescendIntoChildForEventHandling(
aura::Window* child,
const gfx::Point& location) override {
return true;
}
- virtual bool CanFocus() override { return true; }
- virtual void OnCaptureLost() override {
+ bool CanFocus() override { return true; }
+ void OnCaptureLost() override {
if (drag_drop_controller_->IsDragDropInProgress())
drag_drop_controller_->DragCancel();
}
- virtual void OnPaint(gfx::Canvas* canvas) override {
- }
- virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override {}
- virtual void OnWindowDestroying(aura::Window* window) override {}
- virtual void OnWindowDestroyed(aura::Window* window) override {}
- virtual void OnWindowTargetVisibilityChanged(bool visible) override {}
- virtual bool HasHitTestMask() const override {
- return true;
- }
- virtual void GetHitTestMask(gfx::Path* mask) const override {
+ void OnPaint(gfx::Canvas* canvas) override {}
+ void OnDeviceScaleFactorChanged(float device_scale_factor) override {}
+ void OnWindowDestroying(aura::Window* window) override {}
+ void OnWindowDestroyed(aura::Window* window) override {}
+ void OnWindowTargetVisibilityChanged(bool visible) override {}
+ bool HasHitTestMask() const override { return true; }
+ void GetHitTestMask(gfx::Path* mask) const override {
DCHECK(mask->isEmpty());
}
diff --git a/ash/drag_drop/drag_drop_controller.h b/ash/drag_drop/drag_drop_controller.h
index fba69372e..9be5b12 100644
--- a/ash/drag_drop/drag_drop_controller.h
+++ b/ash/drag_drop/drag_drop_controller.h
@@ -36,35 +36,32 @@ class ASH_EXPORT DragDropController
public aura::WindowObserver {
public:
DragDropController();
- virtual ~DragDropController();
+ ~DragDropController() override;
void set_should_block_during_drag_drop(bool should_block_during_drag_drop) {
should_block_during_drag_drop_ = should_block_during_drag_drop;
}
// Overridden from aura::client::DragDropClient:
- virtual int StartDragAndDrop(
- const ui::OSExchangeData& data,
- aura::Window* root_window,
- aura::Window* source_window,
- const gfx::Point& root_location,
- int operation,
- ui::DragDropTypes::DragEventSource source) override;
- virtual void DragUpdate(aura::Window* target,
- const ui::LocatedEvent& event) override;
- virtual void Drop(aura::Window* target,
- const ui::LocatedEvent& event) override;
- virtual void DragCancel() override;
- virtual bool IsDragDropInProgress() override;
+ int StartDragAndDrop(const ui::OSExchangeData& data,
+ aura::Window* root_window,
+ aura::Window* source_window,
+ const gfx::Point& root_location,
+ int operation,
+ ui::DragDropTypes::DragEventSource source) override;
+ void DragUpdate(aura::Window* target, const ui::LocatedEvent& event) override;
+ void Drop(aura::Window* target, const ui::LocatedEvent& event) override;
+ void DragCancel() override;
+ bool IsDragDropInProgress() override;
// Overridden from ui::EventHandler:
- virtual void OnKeyEvent(ui::KeyEvent* event) override;
- virtual void OnMouseEvent(ui::MouseEvent* event) override;
- virtual void OnTouchEvent(ui::TouchEvent* event) override;
- virtual void OnGestureEvent(ui::GestureEvent* event) override;
+ void OnKeyEvent(ui::KeyEvent* event) override;
+ void OnMouseEvent(ui::MouseEvent* event) override;
+ void OnTouchEvent(ui::TouchEvent* event) override;
+ void OnGestureEvent(ui::GestureEvent* event) override;
// Overridden from aura::WindowObserver.
- virtual void OnWindowDestroyed(aura::Window* window) override;
+ void OnWindowDestroyed(aura::Window* window) override;
protected:
// Helper method to create a LinearAnimation object that will run the drag
@@ -82,9 +79,9 @@ class ASH_EXPORT DragDropController
friend class ash::test::DragDropControllerTest;
// Overridden from gfx::AnimationDelegate:
- virtual void AnimationEnded(const gfx::Animation* animation) override;
- virtual void AnimationProgressed(const gfx::Animation* animation) override;
- virtual void AnimationCanceled(const gfx::Animation* animation) override;
+ void AnimationEnded(const gfx::Animation* animation) override;
+ void AnimationProgressed(const gfx::Animation* animation) override;
+ void AnimationCanceled(const gfx::Animation* animation) override;
// Helper method to start drag widget flying back animation.
void StartCanceledAnimation(int animation_duration_ms);
diff --git a/ash/drag_drop/drag_drop_controller_unittest.cc b/ash/drag_drop/drag_drop_controller_unittest.cc
index 9632989..2fa520c 100644
--- a/ash/drag_drop/drag_drop_controller_unittest.cc
+++ b/ash/drag_drop/drag_drop_controller_unittest.cc
@@ -71,12 +71,11 @@ class DragTestView : public views::View {
private:
// View overrides:
- virtual int GetDragOperations(const gfx::Point& press_pt) override {
+ int GetDragOperations(const gfx::Point& press_pt) override {
return ui::DragDropTypes::DRAG_COPY;
}
- virtual void WriteDragData(const gfx::Point& p,
- OSExchangeData* data) override {
+ void WriteDragData(const gfx::Point& p, OSExchangeData* data) override {
data->SetString(base::UTF8ToUTF16("I am being dragged"));
gfx::ImageSkiaRep image_rep(gfx::Size(10, 20), 1.0f);
gfx::ImageSkia image_skia(image_rep);
@@ -84,48 +83,40 @@ class DragTestView : public views::View {
drag_utils::SetDragImageOnDataObject(image_skia, gfx::Vector2d(), data);
}
- virtual bool OnMousePressed(const ui::MouseEvent& event) override {
- return true;
- }
+ bool OnMousePressed(const ui::MouseEvent& event) override { return true; }
- virtual void OnGestureEvent(ui::GestureEvent* event) override {
+ void OnGestureEvent(ui::GestureEvent* event) override {
if (event->type() == ui::ET_GESTURE_LONG_TAP)
long_tap_received_ = true;
return;
}
- virtual bool GetDropFormats(
+ bool GetDropFormats(
int* formats,
std::set<OSExchangeData::CustomFormat>* custom_formats) override {
*formats = ui::OSExchangeData::STRING;
return true;
}
- virtual bool CanDrop(const OSExchangeData& data) override {
- return true;
- }
+ bool CanDrop(const OSExchangeData& data) override { return true; }
- virtual void OnDragEntered(const ui::DropTargetEvent& event) override {
+ void OnDragEntered(const ui::DropTargetEvent& event) override {
num_drag_enters_++;
}
- virtual int OnDragUpdated(const ui::DropTargetEvent& event) override {
+ int OnDragUpdated(const ui::DropTargetEvent& event) override {
num_drag_updates_++;
return ui::DragDropTypes::DRAG_COPY;
}
- virtual void OnDragExited() override {
- num_drag_exits_++;
- }
+ void OnDragExited() override { num_drag_exits_++; }
- virtual int OnPerformDrop(const ui::DropTargetEvent& event) override {
+ int OnPerformDrop(const ui::DropTargetEvent& event) override {
num_drops_++;
return ui::DragDropTypes::DRAG_COPY;
}
- virtual void OnDragDone() override {
- drag_done_received_ = true;
- }
+ void OnDragDone() override { drag_done_received_ = true; }
DISALLOW_COPY_AND_ASSIGN(DragTestView);
};
@@ -159,44 +150,42 @@ class TestDragDropController : public DragDropController {
drag_string_.clear();
}
- virtual int StartDragAndDrop(
- const ui::OSExchangeData& data,
- aura::Window* root_window,
- aura::Window* source_window,
- const gfx::Point& location,
- int operation,
- ui::DragDropTypes::DragEventSource source) override {
+ int StartDragAndDrop(const ui::OSExchangeData& data,
+ aura::Window* root_window,
+ aura::Window* source_window,
+ const gfx::Point& location,
+ int operation,
+ ui::DragDropTypes::DragEventSource source) override {
drag_start_received_ = true;
data.GetString(&drag_string_);
return DragDropController::StartDragAndDrop(
data, root_window, source_window, location, operation, source);
}
- virtual void DragUpdate(aura::Window* target,
- const ui::LocatedEvent& event) override {
+ void DragUpdate(aura::Window* target,
+ const ui::LocatedEvent& event) override {
DragDropController::DragUpdate(target, event);
num_drag_updates_++;
}
- virtual void Drop(aura::Window* target,
- const ui::LocatedEvent& event) override {
+ void Drop(aura::Window* target, const ui::LocatedEvent& event) override {
DragDropController::Drop(target, event);
drop_received_ = true;
}
- virtual void DragCancel() override {
+ void DragCancel() override {
DragDropController::DragCancel();
drag_canceled_ = true;
}
- virtual gfx::LinearAnimation* CreateCancelAnimation(
+ gfx::LinearAnimation* CreateCancelAnimation(
int duration,
int frame_rate,
gfx::AnimationDelegate* delegate) override {
return new CompletableLinearAnimation(duration, frame_rate, delegate);
}
- virtual void DoDragCancel(int animation_duration_ms) override {
+ void DoDragCancel(int animation_duration_ms) override {
DragDropController::DoDragCancel(animation_duration_ms);
drag_canceled_ = true;
}
@@ -222,7 +211,7 @@ class TestNativeWidgetAura : public views::NativeWidgetAura {
check_if_capture_lost_ = value;
}
- virtual void OnCaptureLost() override {
+ void OnCaptureLost() override {
DCHECK(!check_if_capture_lost_);
views::NativeWidgetAura::OnCaptureLost();
}
@@ -290,9 +279,9 @@ void DispatchGesture(ui::EventType gesture_type, gfx::Point location) {
class DragDropControllerTest : public AshTestBase {
public:
DragDropControllerTest() : AshTestBase() {}
- virtual ~DragDropControllerTest() {}
+ ~DragDropControllerTest() override {}
- virtual void SetUp() override {
+ void SetUp() override {
AshTestBase::SetUp();
drag_drop_controller_.reset(new TestDragDropController);
drag_drop_controller_->set_should_block_during_drag_drop(false);
@@ -300,7 +289,7 @@ class DragDropControllerTest : public AshTestBase {
drag_drop_controller_.get());
}
- virtual void TearDown() override {
+ void TearDown() override {
aura::client::SetDragDropClient(Shell::GetPrimaryRootWindow(), NULL);
drag_drop_controller_.reset();
AshTestBase::TearDown();
@@ -970,7 +959,7 @@ namespace {
class DragImageWindowObserver : public aura::WindowObserver {
public:
- virtual void OnWindowDestroying(aura::Window* window) override {
+ void OnWindowDestroying(aura::Window* window) override {
window_location_on_destroying_ = window->GetBoundsInScreen().origin();
}
diff --git a/ash/drag_drop/drag_drop_interactive_uitest.cc b/ash/drag_drop/drag_drop_interactive_uitest.cc
index f45db8c..739847b 100644
--- a/ash/drag_drop/drag_drop_interactive_uitest.cc
+++ b/ash/drag_drop/drag_drop_interactive_uitest.cc
@@ -25,14 +25,14 @@ namespace {
class DraggableView : public views::View {
public:
DraggableView() {}
- virtual ~DraggableView() {}
+ ~DraggableView() override {}
// views::View overrides:
- virtual int GetDragOperations(const gfx::Point& press_pt) override {
+ int GetDragOperations(const gfx::Point& press_pt) override {
return ui::DragDropTypes::DRAG_MOVE;
}
- virtual void WriteDragData(const gfx::Point& press_pt,
- OSExchangeData* data)override {
+ void WriteDragData(const gfx::Point& press_pt,
+ OSExchangeData* data) override {
data->SetString(base::UTF8ToUTF16("test"));
}
@@ -43,25 +43,21 @@ class DraggableView : public views::View {
class TargetView : public views::View {
public:
TargetView() : dropped_(false) {}
- virtual ~TargetView() {}
+ ~TargetView() override {}
// views::View overrides:
- virtual bool GetDropFormats(
+ bool GetDropFormats(
int* formats,
std::set<OSExchangeData::CustomFormat>* custom_formats) override {
*formats = ui::OSExchangeData::STRING;
return true;
}
- virtual bool AreDropTypesRequired() override {
- return false;
- }
- virtual bool CanDrop(const OSExchangeData& data) override {
- return true;
- }
- virtual int OnDragUpdated(const ui::DropTargetEvent& event) override {
+ bool AreDropTypesRequired() override { return false; }
+ bool CanDrop(const OSExchangeData& data) override { return true; }
+ int OnDragUpdated(const ui::DropTargetEvent& event) override {
return ui::DragDropTypes::DRAG_MOVE;
}
- virtual int OnPerformDrop(const ui::DropTargetEvent& event) override {
+ int OnPerformDrop(const ui::DropTargetEvent& event) override {
dropped_ = true;
return ui::DragDropTypes::DRAG_MOVE;
}
@@ -124,9 +120,9 @@ void DragDropAcrossMultiDisplay_Step1() {
class DragDropTest : public test::AshTestBase {
public:
DragDropTest() {}
- virtual ~DragDropTest() {}
+ ~DragDropTest() override {}
- virtual void SetUp() override {
+ void SetUp() override {
gfx::GLSurface::InitializeOneOffForTests();
ui::RegisterPathProvider();
diff --git a/ash/drag_drop/drag_drop_tracker.cc b/ash/drag_drop/drag_drop_tracker.cc
index 76482a9..d851098 100644
--- a/ash/drag_drop/drag_drop_tracker.cc
+++ b/ash/drag_drop/drag_drop_tracker.cc
@@ -23,12 +23,10 @@ class CaptureWindowActivationDelegate
: public aura::client::ActivationDelegate {
public:
CaptureWindowActivationDelegate() {}
- virtual ~CaptureWindowActivationDelegate() {}
+ ~CaptureWindowActivationDelegate() override {}
// aura::client::ActivationDelegate overrides:
- virtual bool ShouldActivate() const override {
- return false;
- }
+ bool ShouldActivate() const override { return false; }
private:
diff --git a/ash/drag_drop/drag_drop_tracker_unittest.cc b/ash/drag_drop/drag_drop_tracker_unittest.cc
index 66e678f..0e6d7f2 100644
--- a/ash/drag_drop/drag_drop_tracker_unittest.cc
+++ b/ash/drag_drop/drag_drop_tracker_unittest.cc
@@ -17,9 +17,7 @@ namespace test {
class DragDropTrackerTest : public test::AshTestBase {
public:
- virtual void SetUp() override {
- AshTestBase::SetUp();
- }
+ void SetUp() override { AshTestBase::SetUp(); }
aura::Window* CreateTestWindow(const gfx::Rect& bounds) {
static int window_id = 0;
diff --git a/ash/drag_drop/drag_image_view.h b/ash/drag_drop/drag_image_view.h
index 4ba0c07..1415f50 100644
--- a/ash/drag_drop/drag_image_view.h
+++ b/ash/drag_drop/drag_image_view.h
@@ -27,7 +27,7 @@ class DragImageView : public views::ImageView {
// whether to show drag operation hint on top of the image.
DragImageView(gfx::NativeView context,
ui::DragDropTypes::DragEventSource source);
- virtual ~DragImageView();
+ ~DragImageView() override;
// Sets the bounds of the native widget in screen
// coordinates.
@@ -59,7 +59,7 @@ class DragImageView : public views::ImageView {
private:
// Overridden from views::ImageView.
- virtual void OnPaint(gfx::Canvas* canvas) override;
+ void OnPaint(gfx::Canvas* canvas) override;
scoped_ptr<views::Widget> widget_;
gfx::Size widget_size_;