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

Side by Side Diff: ui/events/test/test_event_target.cc

Issue 1138993007: Substituting pattern push_back(ptr.release()) with push_back(ptr.Pass()) in ui/events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporated the review comments Created 5 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
« no previous file with comments | « ui/events/platform/platform_event_source_unittest.cc ('k') | ui/views/controls/label.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/events/test/test_event_target.h" 5 #include "ui/events/test/test_event_target.h"
6 6
7 #include "ui/events/event.h" 7 #include "ui/events/event.h"
8 #include "ui/events/event_target_iterator.h" 8 #include "ui/events/event_target_iterator.h"
9 #include "ui/events/event_targeter.h" 9 #include "ui/events/event_targeter.h"
10 10
11 namespace ui { 11 namespace ui {
12 namespace test { 12 namespace test {
13 13
14 TestEventTarget::TestEventTarget() 14 TestEventTarget::TestEventTarget()
15 : parent_(NULL), 15 : parent_(NULL),
16 mark_events_as_handled_(false), 16 mark_events_as_handled_(false),
17 recorder_(NULL), 17 recorder_(NULL),
18 target_name_("unknown") {} 18 target_name_("unknown") {}
19 TestEventTarget::~TestEventTarget() {} 19 TestEventTarget::~TestEventTarget() {}
20 20
21 void TestEventTarget::AddChild(scoped_ptr<TestEventTarget> child) { 21 void TestEventTarget::AddChild(scoped_ptr<TestEventTarget> child) {
22 TestEventTarget* child_r = child.get(); 22 TestEventTarget* child_r = child.get();
23 if (child->parent()) { 23 if (child->parent()) {
24 AddChild(child->parent()->RemoveChild(child.release())); 24 AddChild(child->parent()->RemoveChild(child.release()));
25 } else { 25 } else {
26 children_.push_back(child.release()); 26 children_.push_back(child.Pass());
27 } 27 }
28 child_r->set_parent(this); 28 child_r->set_parent(this);
29 } 29 }
30 30
31 scoped_ptr<TestEventTarget> TestEventTarget::RemoveChild(TestEventTarget *c) { 31 scoped_ptr<TestEventTarget> TestEventTarget::RemoveChild(TestEventTarget *c) {
32 ScopedVector<TestEventTarget>::iterator iter = std::find(children_.begin(), 32 ScopedVector<TestEventTarget>::iterator iter = std::find(children_.begin(),
33 children_.end(), 33 children_.end(),
34 c); 34 c);
35 if (iter != children_.end()) { 35 if (iter != children_.end()) {
36 children_.weak_erase(iter); 36 children_.weak_erase(iter);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // TestEventTarget, private 85 // TestEventTarget, private
86 86
87 bool TestEventTarget::Contains(TestEventTarget* target) const { 87 bool TestEventTarget::Contains(TestEventTarget* target) const {
88 while (target && target != this) 88 while (target && target != this)
89 target = target->parent(); 89 target = target->parent();
90 return target == this; 90 return target == this;
91 } 91 }
92 92
93 } // namespace test 93 } // namespace test
94 } // namespace ui 94 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/platform/platform_event_source_unittest.cc ('k') | ui/views/controls/label.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698