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

Unified Diff: ui/events/scoped_target_handler.cc

Issue 1411833006: Refactoring to make adding ink drop animations easier (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactor ink drop animations (simplify MenuButton) Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: ui/events/scoped_target_handler.cc
diff --git a/ui/events/scoped_target_handler.cc b/ui/events/scoped_target_handler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..62439cb82fb7e35bf9d1dfcc3442b565c53b66f6
--- /dev/null
+++ b/ui/events/scoped_target_handler.cc
@@ -0,0 +1,23 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/events/scoped_target_handler.h"
+
+#include "ui/events/event.h"
+#include "ui/events/event_target.h"
+
+namespace ui {
+
+ScopedTargetHandler::ScopedTargetHandler(EventTarget* target,
+ EventHandler* handler)
+ : target_(target), handler_(handler) {
+ original_handler_ = target_->SetTargetHandler(handler);
+}
+
+ScopedTargetHandler::~ScopedTargetHandler() {
+ EventHandler* handler = target_->SetTargetHandler(original_handler_);
+ DCHECK_EQ(handler_, handler);
+}
+
+} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698