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

Side by Side Diff: ui/aura/window.cc

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 years, 8 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/aura/window.h ('k') | ui/aura/window_event_dispatcher.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/aura/window.h" 5 #include "ui/aura/window.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/bind_helpers.h" 13 #include "base/bind_helpers.h"
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/ptr_util.h"
17 #include "base/strings/string_number_conversions.h" 18 #include "base/strings/string_number_conversions.h"
18 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
19 #include "base/strings/stringprintf.h" 20 #include "base/strings/stringprintf.h"
20 #include "ui/aura/client/capture_client.h" 21 #include "ui/aura/client/capture_client.h"
21 #include "ui/aura/client/cursor_client.h" 22 #include "ui/aura/client/cursor_client.h"
22 #include "ui/aura/client/event_client.h" 23 #include "ui/aura/client/event_client.h"
23 #include "ui/aura/client/focus_client.h" 24 #include "ui/aura/client/focus_client.h"
24 #include "ui/aura/client/screen_position_client.h" 25 #include "ui/aura/client/screen_position_client.h"
25 #include "ui/aura/client/visibility_client.h" 26 #include "ui/aura/client/visibility_client.h"
26 #include "ui/aura/client/window_stacking_client.h" 27 #include "ui/aura/client/window_stacking_client.h"
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 if (!layout_manager) 286 if (!layout_manager)
286 return; 287 return;
287 // If we're changing to a new layout manager, ensure it is aware of all the 288 // If we're changing to a new layout manager, ensure it is aware of all the
288 // existing child windows. 289 // existing child windows.
289 for (Windows::const_iterator it = children_.begin(); 290 for (Windows::const_iterator it = children_.begin();
290 it != children_.end(); 291 it != children_.end();
291 ++it) 292 ++it)
292 layout_manager_->OnWindowAddedToLayout(*it); 293 layout_manager_->OnWindowAddedToLayout(*it);
293 } 294 }
294 295
295 scoped_ptr<ui::EventTargeter> 296 std::unique_ptr<ui::EventTargeter> Window::SetEventTargeter(
296 Window::SetEventTargeter(scoped_ptr<ui::EventTargeter> targeter) { 297 std::unique_ptr<ui::EventTargeter> targeter) {
297 scoped_ptr<ui::EventTargeter> old_targeter = std::move(targeter_); 298 std::unique_ptr<ui::EventTargeter> old_targeter = std::move(targeter_);
298 targeter_ = std::move(targeter); 299 targeter_ = std::move(targeter);
299 return old_targeter; 300 return old_targeter;
300 } 301 }
301 302
302 void Window::SetBounds(const gfx::Rect& new_bounds) { 303 void Window::SetBounds(const gfx::Rect& new_bounds) {
303 if (parent_ && parent_->layout_manager()) 304 if (parent_ && parent_->layout_manager())
304 parent_->layout_manager()->SetChildBounds(this, new_bounds); 305 parent_->layout_manager()->SetChildBounds(this, new_bounds);
305 else { 306 else {
306 // Ensure we don't go smaller than our minimum bounds. 307 // Ensure we don't go smaller than our minimum bounds.
307 gfx::Rect final_bounds(new_bounds); 308 gfx::Rect final_bounds(new_bounds);
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 1081
1081 ui::EventTarget* Window::GetParentTarget() { 1082 ui::EventTarget* Window::GetParentTarget() {
1082 if (IsRootWindow()) { 1083 if (IsRootWindow()) {
1083 return client::GetEventClient(this) ? 1084 return client::GetEventClient(this) ?
1084 client::GetEventClient(this)->GetToplevelEventTarget() : 1085 client::GetEventClient(this)->GetToplevelEventTarget() :
1085 Env::GetInstance(); 1086 Env::GetInstance();
1086 } 1087 }
1087 return parent_; 1088 return parent_;
1088 } 1089 }
1089 1090
1090 scoped_ptr<ui::EventTargetIterator> Window::GetChildIterator() const { 1091 std::unique_ptr<ui::EventTargetIterator> Window::GetChildIterator() const {
1091 return make_scoped_ptr(new ui::EventTargetIteratorImpl<Window>(children())); 1092 return base::WrapUnique(new ui::EventTargetIteratorImpl<Window>(children()));
1092 } 1093 }
1093 1094
1094 ui::EventTargeter* Window::GetEventTargeter() { 1095 ui::EventTargeter* Window::GetEventTargeter() {
1095 return targeter_.get(); 1096 return targeter_.get();
1096 } 1097 }
1097 1098
1098 void Window::ConvertEventToTarget(ui::EventTarget* target, 1099 void Window::ConvertEventToTarget(ui::EventTarget* target,
1099 ui::LocatedEvent* event) { 1100 ui::LocatedEvent* event) {
1100 event->ConvertLocationToTarget(this, 1101 event->ConvertLocationToTarget(this,
1101 static_cast<Window*>(target)); 1102 static_cast<Window*>(target));
1102 } 1103 }
1103 1104
1104 void Window::UpdateLayerName() { 1105 void Window::UpdateLayerName() {
1105 #if !defined(NDEBUG) 1106 #if !defined(NDEBUG)
1106 DCHECK(layer()); 1107 DCHECK(layer());
1107 1108
1108 std::string layer_name(name_); 1109 std::string layer_name(name_);
1109 if (layer_name.empty()) 1110 if (layer_name.empty())
1110 layer_name = "Unnamed Window"; 1111 layer_name = "Unnamed Window";
1111 1112
1112 if (id_ != -1) 1113 if (id_ != -1)
1113 layer_name += " " + base::IntToString(id_); 1114 layer_name += " " + base::IntToString(id_);
1114 1115
1115 layer()->set_name(layer_name); 1116 layer()->set_name(layer_name);
1116 #endif 1117 #endif
1117 } 1118 }
1118 1119
1119 } // namespace aura 1120 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/window.h ('k') | ui/aura/window_event_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698