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

Side by Side Diff: ui/views/controls/textfield/textfield_model.h

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
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 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_MODEL_H_ 5 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_MODEL_H_
6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_MODEL_H_ 6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_MODEL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <list> 10 #include <list>
11 #include <memory>
11 #include <vector> 12 #include <vector>
12 13
13 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/strings/string16.h" 16 #include "base/strings/string16.h"
17 #include "ui/base/ime/composition_text.h" 17 #include "ui/base/ime/composition_text.h"
18 #include "ui/gfx/render_text.h" 18 #include "ui/gfx/render_text.h"
19 #include "ui/gfx/text_constants.h" 19 #include "ui/gfx/text_constants.h"
20 #include "ui/views/views_export.h" 20 #include "ui/views/views_export.h"
21 21
22 namespace views { 22 namespace views {
23 23
24 namespace internal { 24 namespace internal {
25 // Internal Edit class that keeps track of edits for undo/redo. 25 // Internal Edit class that keeps track of edits for undo/redo.
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 const base::string16& new_text, 261 const base::string16& new_text,
262 size_t new_text_insert_at, 262 size_t new_text_insert_at,
263 size_t new_cursor_pos); 263 size_t new_cursor_pos);
264 264
265 void ClearComposition(); 265 void ClearComposition();
266 266
267 // The TextfieldModel::Delegate instance should be provided by the owner. 267 // The TextfieldModel::Delegate instance should be provided by the owner.
268 Delegate* delegate_; 268 Delegate* delegate_;
269 269
270 // The stylized text, cursor, selection, and the visual layout model. 270 // The stylized text, cursor, selection, and the visual layout model.
271 scoped_ptr<gfx::RenderText> render_text_; 271 std::unique_ptr<gfx::RenderText> render_text_;
272 272
273 // The composition range. 273 // The composition range.
274 gfx::Range composition_range_; 274 gfx::Range composition_range_;
275 275
276 typedef std::list<internal::Edit*> EditHistory; 276 typedef std::list<internal::Edit*> EditHistory;
277 EditHistory edit_history_; 277 EditHistory edit_history_;
278 278
279 // An iterator that points to the current edit that can be undone. 279 // An iterator that points to the current edit that can be undone.
280 // This iterator moves from the |end()|, meaining no edit to undo, 280 // This iterator moves from the |end()|, meaining no edit to undo,
281 // to the last element (one before |end()|), meaning no edit to redo. 281 // to the last element (one before |end()|), meaning no edit to redo.
282 // 282 //
283 // There is no edit to undo (== end()) when: 283 // There is no edit to undo (== end()) when:
284 // 1) in initial state. (nothing to undo) 284 // 1) in initial state. (nothing to undo)
285 // 2) very 1st edit is undone. 285 // 2) very 1st edit is undone.
286 // 3) all edit history is removed. 286 // 3) all edit history is removed.
287 // There is no edit to redo (== last element or no element) when: 287 // There is no edit to redo (== last element or no element) when:
288 // 1) in initial state. (nothing to redo) 288 // 1) in initial state. (nothing to redo)
289 // 2) new edit is added. (redo history is cleared) 289 // 2) new edit is added. (redo history is cleared)
290 // 3) redone all undone edits. 290 // 3) redone all undone edits.
291 EditHistory::iterator current_edit_; 291 EditHistory::iterator current_edit_;
292 292
293 DISALLOW_COPY_AND_ASSIGN(TextfieldModel); 293 DISALLOW_COPY_AND_ASSIGN(TextfieldModel);
294 }; 294 };
295 295
296 } // namespace views 296 } // namespace views
297 297
298 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_MODEL_H_ 298 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_MODEL_H_
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/textfield.cc ('k') | ui/views/controls/textfield/textfield_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698