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

Side by Side Diff: content/browser/web_contents/aura/gesture_nav_simple.cc

Issue 1874893002: Convert //content/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/web_contents/aura/gesture_nav_simple.h" 5 #include "content/browser/web_contents/aura/gesture_nav_simple.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "cc/layers/layer.h" 10 #include "cc/layers/layer.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 OverscrollMode mode) { 44 OverscrollMode mode) {
45 return mode == (base::i18n::IsRTL() ? OVERSCROLL_WEST : OVERSCROLL_EAST) && 45 return mode == (base::i18n::IsRTL() ? OVERSCROLL_WEST : OVERSCROLL_EAST) &&
46 controller.CanGoBack(); 46 controller.CanGoBack();
47 } 47 }
48 48
49 // An animation observers that deletes itself and a pointer after the end of the 49 // An animation observers that deletes itself and a pointer after the end of the
50 // animation. 50 // animation.
51 template <class T> 51 template <class T>
52 class DeleteAfterAnimation : public ui::ImplicitAnimationObserver { 52 class DeleteAfterAnimation : public ui::ImplicitAnimationObserver {
53 public: 53 public:
54 explicit DeleteAfterAnimation(scoped_ptr<T> object) 54 explicit DeleteAfterAnimation(std::unique_ptr<T> object)
55 : object_(std::move(object)) {} 55 : object_(std::move(object)) {}
56 56
57 private: 57 private:
58 friend class base::DeleteHelper<DeleteAfterAnimation<T> >; 58 friend class base::DeleteHelper<DeleteAfterAnimation<T> >;
59 59
60 ~DeleteAfterAnimation() override {} 60 ~DeleteAfterAnimation() override {}
61 61
62 // ui::ImplicitAnimationObserver: 62 // ui::ImplicitAnimationObserver:
63 void OnImplicitAnimationsCompleted() override { 63 void OnImplicitAnimationsCompleted() override {
64 // Deleting an observer when a ScopedLayerAnimationSettings is iterating 64 // Deleting an observer when a ScopedLayerAnimationSettings is iterating
65 // over them can cause a crash (which can happen during tests). So instead, 65 // over them can cause a crash (which can happen during tests). So instead,
66 // schedule this observer to be deleted soon. 66 // schedule this observer to be deleted soon.
67 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this); 67 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this);
68 } 68 }
69 69
70 scoped_ptr<T> object_; 70 std::unique_ptr<T> object_;
71 DISALLOW_COPY_AND_ASSIGN(DeleteAfterAnimation); 71 DISALLOW_COPY_AND_ASSIGN(DeleteAfterAnimation);
72 }; 72 };
73 73
74 } // namespace 74 } // namespace
75 75
76 // A layer delegate that paints the shield with the arrow in it. 76 // A layer delegate that paints the shield with the arrow in it.
77 class ArrowLayerDelegate : public ui::LayerDelegate { 77 class ArrowLayerDelegate : public ui::LayerDelegate {
78 public: 78 public:
79 explicit ArrowLayerDelegate(int resource_id) 79 explicit ArrowLayerDelegate(int resource_id)
80 : image_(GetContentClient()->GetNativeImageNamed(resource_id)), 80 : image_(GetContentClient()->GetNativeImageNamed(resource_id)),
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 clip_layer_->SetBounds(window->layer()->bounds()); 234 clip_layer_->SetBounds(window->layer()->bounds());
235 clip_layer_->SetMasksToBounds(true); 235 clip_layer_->SetMasksToBounds(true);
236 clip_layer_->Add(arrow_.get()); 236 clip_layer_->Add(arrow_.get());
237 237
238 ui::Layer* parent = window->layer()->parent(); 238 ui::Layer* parent = window->layer()->parent();
239 parent->Add(clip_layer_.get()); 239 parent->Add(clip_layer_.get());
240 parent->StackAtTop(clip_layer_.get()); 240 parent->StackAtTop(clip_layer_.get());
241 } 241 }
242 242
243 } // namespace content 243 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698