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

Side by Side Diff: ui/views/view.cc

Issue 1539583003: Convert Pass()→std::move() in ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
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 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first.
6 6
7 #include "ui/views/view.h" 7 #include "ui/views/view.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
11 #include <utility>
11 12
12 #include "base/logging.h" 13 #include "base/logging.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
15 #include "base/stl_util.h" 16 #include "base/stl_util.h"
16 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
17 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
18 #include "base/trace_event/trace_event.h" 19 #include "base/trace_event/trace_event.h"
19 #include "third_party/skia/include/core/SkRect.h" 20 #include "third_party/skia/include/core/SkRect.h"
20 #include "ui/accessibility/ax_enums.h" 21 #include "ui/accessibility/ax_enums.h"
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 } else if (!paint_to_layer_ && layer()) { 469 } else if (!paint_to_layer_ && layer()) {
469 DestroyLayer(); 470 DestroyLayer();
470 } 471 }
471 } 472 }
472 473
473 scoped_ptr<ui::Layer> View::RecreateLayer() { 474 scoped_ptr<ui::Layer> View::RecreateLayer() {
474 scoped_ptr<ui::Layer> old_layer = LayerOwner::RecreateLayer(); 475 scoped_ptr<ui::Layer> old_layer = LayerOwner::RecreateLayer();
475 Widget* widget = GetWidget(); 476 Widget* widget = GetWidget();
476 if (widget) 477 if (widget)
477 widget->UpdateRootLayers(); 478 widget->UpdateRootLayers();
478 return old_layer.Pass(); 479 return old_layer;
479 } 480 }
480 481
481 // RTL positioning ------------------------------------------------------------- 482 // RTL positioning -------------------------------------------------------------
482 483
483 gfx::Rect View::GetMirroredBounds() const { 484 gfx::Rect View::GetMirroredBounds() const {
484 gfx::Rect bounds(bounds_); 485 gfx::Rect bounds(bounds_);
485 bounds.set_x(GetMirroredX()); 486 bounds.set_x(GetMirroredX());
486 return bounds; 487 return bounds;
487 } 488 }
488 489
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 } 842 }
842 843
843 // View::Paint() recursion over the subtree. 844 // View::Paint() recursion over the subtree.
844 PaintChildren(context); 845 PaintChildren(context);
845 } 846 }
846 847
847 void View::set_background(Background* b) { 848 void View::set_background(Background* b) {
848 background_.reset(b); 849 background_.reset(b);
849 } 850 }
850 851
851 void View::SetBorder(scoped_ptr<Border> b) { border_ = b.Pass(); } 852 void View::SetBorder(scoped_ptr<Border> b) {
853 border_ = std::move(b);
854 }
852 855
853 const ui::ThemeProvider* View::GetThemeProvider() const { 856 const ui::ThemeProvider* View::GetThemeProvider() const {
854 const Widget* widget = GetWidget(); 857 const Widget* widget = GetWidget();
855 return widget ? widget->GetThemeProvider() : nullptr; 858 return widget ? widget->GetThemeProvider() : nullptr;
856 } 859 }
857 860
858 const ui::NativeTheme* View::GetNativeTheme() const { 861 const ui::NativeTheme* View::GetNativeTheme() const {
859 const Widget* widget = GetWidget(); 862 const Widget* widget = GetWidget();
860 if (widget) 863 if (widget)
861 return widget->GetNativeTheme(); 864 return widget->GetNativeTheme();
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 } 1053 }
1051 1054
1052 const ui::InputMethod* View::GetInputMethod() const { 1055 const ui::InputMethod* View::GetInputMethod() const {
1053 Widget* widget = const_cast<Widget*>(GetWidget()); 1056 Widget* widget = const_cast<Widget*>(GetWidget());
1054 return widget ? const_cast<const ui::InputMethod*>(widget->GetInputMethod()) 1057 return widget ? const_cast<const ui::InputMethod*>(widget->GetInputMethod())
1055 : nullptr; 1058 : nullptr;
1056 } 1059 }
1057 1060
1058 scoped_ptr<ViewTargeter> 1061 scoped_ptr<ViewTargeter>
1059 View::SetEventTargeter(scoped_ptr<ViewTargeter> targeter) { 1062 View::SetEventTargeter(scoped_ptr<ViewTargeter> targeter) {
1060 scoped_ptr<ViewTargeter> old_targeter = targeter_.Pass(); 1063 scoped_ptr<ViewTargeter> old_targeter = std::move(targeter_);
1061 targeter_ = targeter.Pass(); 1064 targeter_ = std::move(targeter);
1062 return old_targeter.Pass(); 1065 return old_targeter;
1063 } 1066 }
1064 1067
1065 ViewTargeter* View::GetEffectiveViewTargeter() const { 1068 ViewTargeter* View::GetEffectiveViewTargeter() const {
1066 DCHECK(GetWidget()); 1069 DCHECK(GetWidget());
1067 ViewTargeter* view_targeter = targeter(); 1070 ViewTargeter* view_targeter = targeter();
1068 if (!view_targeter) 1071 if (!view_targeter)
1069 view_targeter = GetWidget()->GetRootView()->targeter(); 1072 view_targeter = GetWidget()->GetRootView()->targeter();
1070 CHECK(view_targeter); 1073 CHECK(view_targeter);
1071 return view_targeter; 1074 return view_targeter;
1072 } 1075 }
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after
2385 // Message the RootView to do the drag and drop. That way if we're removed 2388 // Message the RootView to do the drag and drop. That way if we're removed
2386 // the RootView can detect it and avoid calling us back. 2389 // the RootView can detect it and avoid calling us back.
2387 gfx::Point widget_location(event.location()); 2390 gfx::Point widget_location(event.location());
2388 ConvertPointToWidget(this, &widget_location); 2391 ConvertPointToWidget(this, &widget_location);
2389 widget->RunShellDrag(this, data, widget_location, drag_operations, source); 2392 widget->RunShellDrag(this, data, widget_location, drag_operations, source);
2390 // WARNING: we may have been deleted. 2393 // WARNING: we may have been deleted.
2391 return true; 2394 return true;
2392 } 2395 }
2393 2396
2394 } // namespace views 2397 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/test/x11_property_change_waiter.cc ('k') | ui/views/widget/desktop_aura/desktop_focus_rules_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698