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

Side by Side Diff: ui/views/border.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/views/border.h ('k') | ui/views/bubble/bubble_border.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/views/border.h" 5 #include "ui/views/border.h"
6 6
7 #include <memory>
8
7 #include "base/logging.h" 9 #include "base/logging.h"
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/ptr_util.h"
10 #include "third_party/skia/include/core/SkPaint.h" 12 #include "third_party/skia/include/core/SkPaint.h"
11 #include "ui/gfx/canvas.h" 13 #include "ui/gfx/canvas.h"
12 #include "ui/gfx/geometry/rect_f.h" 14 #include "ui/gfx/geometry/rect_f.h"
13 #include "ui/views/painter.h" 15 #include "ui/views/painter.h"
14 #include "ui/views/view.h" 16 #include "ui/views/view.h"
15 17
16 namespace views { 18 namespace views {
17 19
18 namespace { 20 namespace {
19 21
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 class BorderPainter : public Border { 140 class BorderPainter : public Border {
139 public: 141 public:
140 BorderPainter(Painter* painter, const gfx::Insets& insets); 142 BorderPainter(Painter* painter, const gfx::Insets& insets);
141 143
142 // Overridden from Border: 144 // Overridden from Border:
143 void Paint(const View& view, gfx::Canvas* canvas) override; 145 void Paint(const View& view, gfx::Canvas* canvas) override;
144 gfx::Insets GetInsets() const override; 146 gfx::Insets GetInsets() const override;
145 gfx::Size GetMinimumSize() const override; 147 gfx::Size GetMinimumSize() const override;
146 148
147 private: 149 private:
148 scoped_ptr<Painter> painter_; 150 std::unique_ptr<Painter> painter_;
149 const gfx::Insets insets_; 151 const gfx::Insets insets_;
150 152
151 DISALLOW_COPY_AND_ASSIGN(BorderPainter); 153 DISALLOW_COPY_AND_ASSIGN(BorderPainter);
152 }; 154 };
153 155
154 BorderPainter::BorderPainter(Painter* painter, const gfx::Insets& insets) 156 BorderPainter::BorderPainter(Painter* painter, const gfx::Insets& insets)
155 : painter_(painter), 157 : painter_(painter),
156 insets_(insets) { 158 insets_(insets) {
157 DCHECK(painter); 159 DCHECK(painter);
158 } 160 }
(...skipping 12 matching lines...) Expand all
171 173
172 } // namespace 174 } // namespace
173 175
174 Border::Border() { 176 Border::Border() {
175 } 177 }
176 178
177 Border::~Border() { 179 Border::~Border() {
178 } 180 }
179 181
180 // static 182 // static
181 scoped_ptr<Border> Border::NullBorder() { 183 std::unique_ptr<Border> Border::NullBorder() {
182 return nullptr; 184 return nullptr;
183 } 185 }
184 186
185 // static 187 // static
186 scoped_ptr<Border> Border::CreateSolidBorder(int thickness, SkColor color) { 188 std::unique_ptr<Border> Border::CreateSolidBorder(int thickness,
187 return make_scoped_ptr(new SolidSidedBorder(gfx::Insets(thickness), color)); 189 SkColor color) {
190 return base::WrapUnique(new SolidSidedBorder(gfx::Insets(thickness), color));
188 } 191 }
189 192
190 // static 193 // static
191 scoped_ptr<Border> Border::CreateEmptyBorder(const gfx::Insets& insets) { 194 std::unique_ptr<Border> Border::CreateEmptyBorder(const gfx::Insets& insets) {
192 return make_scoped_ptr(new EmptyBorder(insets)); 195 return base::WrapUnique(new EmptyBorder(insets));
193 } 196 }
194 197
195 // static 198 // static
196 scoped_ptr<Border> Border::CreateRoundedRectBorder(int thickness, 199 std::unique_ptr<Border> Border::CreateRoundedRectBorder(int thickness,
197 int corner_radius, 200 int corner_radius,
198 SkColor color) { 201 SkColor color) {
199 return make_scoped_ptr( 202 return base::WrapUnique(
200 new RoundedRectBorder(thickness, corner_radius, color)); 203 new RoundedRectBorder(thickness, corner_radius, color));
201 } 204 }
202 205
203 // static 206 // static
204 scoped_ptr<Border> Border::CreateEmptyBorder(int top, 207 std::unique_ptr<Border> Border::CreateEmptyBorder(int top,
205 int left, 208 int left,
206 int bottom, 209 int bottom,
207 int right) { 210 int right) {
208 return CreateEmptyBorder(gfx::Insets(top, left, bottom, right)); 211 return CreateEmptyBorder(gfx::Insets(top, left, bottom, right));
209 } 212 }
210 213
211 // static 214 // static
212 scoped_ptr<Border> Border::CreateSolidSidedBorder(int top, 215 std::unique_ptr<Border> Border::CreateSolidSidedBorder(int top,
213 int left, 216 int left,
214 int bottom, 217 int bottom,
215 int right, 218 int right,
216 SkColor color) { 219 SkColor color) {
217 return make_scoped_ptr(new SolidSidedBorder( 220 return base::WrapUnique(
218 gfx::Insets(top, left, bottom, right), color)); 221 new SolidSidedBorder(gfx::Insets(top, left, bottom, right), color));
219 } 222 }
220 223
221 // static 224 // static
222 scoped_ptr<Border> Border::CreateBorderPainter(Painter* painter, 225 std::unique_ptr<Border> Border::CreateBorderPainter(Painter* painter,
223 const gfx::Insets& insets) { 226 const gfx::Insets& insets) {
224 return make_scoped_ptr(new BorderPainter(painter, insets)); 227 return base::WrapUnique(new BorderPainter(painter, insets));
225 } 228 }
226 229
227 } // namespace views 230 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/border.h ('k') | ui/views/bubble/bubble_border.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698