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

Side by Side Diff: components/undo/bookmark_undo_service.cc

Issue 1548203002: Convert Pass()→std::move() in //components/[n-z]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bad headers Created 4 years, 12 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/undo/bookmark_undo_service.h" 5 #include "components/undo/bookmark_undo_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <utility>
9 10
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "components/bookmarks/browser/bookmark_model.h" 12 #include "components/bookmarks/browser/bookmark_model.h"
12 #include "components/bookmarks/browser/bookmark_node_data.h" 13 #include "components/bookmarks/browser/bookmark_node_data.h"
13 #include "components/bookmarks/browser/bookmark_undo_provider.h" 14 #include "components/bookmarks/browser/bookmark_undo_provider.h"
14 #include "components/bookmarks/browser/bookmark_utils.h" 15 #include "components/bookmarks/browser/bookmark_utils.h"
15 #include "components/bookmarks/browser/scoped_group_bookmark_actions.h" 16 #include "components/bookmarks/browser/scoped_group_bookmark_actions.h"
16 #include "components/undo/undo_operation.h" 17 #include "components/undo/undo_operation.h"
17 #include "grit/components_strings.h" 18 #include "grit/components_strings.h"
18 19
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 BookmarkRemoveOperation::BookmarkRemoveOperation( 120 BookmarkRemoveOperation::BookmarkRemoveOperation(
120 BookmarkModel* model, 121 BookmarkModel* model,
121 BookmarkUndoProvider* undo_provider, 122 BookmarkUndoProvider* undo_provider,
122 const BookmarkNode* parent, 123 const BookmarkNode* parent,
123 int index, 124 int index,
124 scoped_ptr<BookmarkNode> node) 125 scoped_ptr<BookmarkNode> node)
125 : BookmarkUndoOperation(model), 126 : BookmarkUndoOperation(model),
126 undo_provider_(undo_provider), 127 undo_provider_(undo_provider),
127 parent_node_id_(parent->id()), 128 parent_node_id_(parent->id()),
128 index_(index), 129 index_(index),
129 node_(node.Pass()) { 130 node_(std::move(node)) {}
130 }
131 131
132 BookmarkRemoveOperation::~BookmarkRemoveOperation() { 132 BookmarkRemoveOperation::~BookmarkRemoveOperation() {
133 } 133 }
134 134
135 void BookmarkRemoveOperation::Undo() { 135 void BookmarkRemoveOperation::Undo() {
136 DCHECK(node_.get()); 136 DCHECK(node_.get());
137 137
138 const BookmarkNode* parent = bookmarks::GetBookmarkNodeByID( 138 const BookmarkNode* parent = bookmarks::GetBookmarkNodeByID(
139 bookmark_model(), parent_node_id_); 139 bookmark_model(), parent_node_id_);
140 DCHECK(parent); 140 DCHECK(parent);
141 141
142 undo_provider_->RestoreRemovedNode(parent, index_, node_.Pass()); 142 undo_provider_->RestoreRemovedNode(parent, index_, std::move(node_));
143 } 143 }
144 144
145 int BookmarkRemoveOperation::GetUndoLabelId() const { 145 int BookmarkRemoveOperation::GetUndoLabelId() const {
146 return IDS_BOOKMARK_BAR_UNDO_DELETE; 146 return IDS_BOOKMARK_BAR_UNDO_DELETE;
147 } 147 }
148 148
149 int BookmarkRemoveOperation::GetRedoLabelId() const { 149 int BookmarkRemoveOperation::GetRedoLabelId() const {
150 return IDS_BOOKMARK_BAR_REDO_ADD; 150 return IDS_BOOKMARK_BAR_REDO_ADD;
151 } 151 }
152 152
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 undo_manager_.RemoveAllOperations(); 359 undo_manager_.RemoveAllOperations();
360 } 360 }
361 361
362 void BookmarkUndoService::BookmarkNodeMoved(BookmarkModel* model, 362 void BookmarkUndoService::BookmarkNodeMoved(BookmarkModel* model,
363 const BookmarkNode* old_parent, 363 const BookmarkNode* old_parent,
364 int old_index, 364 int old_index,
365 const BookmarkNode* new_parent, 365 const BookmarkNode* new_parent,
366 int new_index) { 366 int new_index) {
367 scoped_ptr<UndoOperation> op(new BookmarkMoveOperation( 367 scoped_ptr<UndoOperation> op(new BookmarkMoveOperation(
368 model, old_parent, old_index, new_parent, new_index)); 368 model, old_parent, old_index, new_parent, new_index));
369 undo_manager()->AddUndoOperation(op.Pass()); 369 undo_manager()->AddUndoOperation(std::move(op));
370 } 370 }
371 371
372 void BookmarkUndoService::BookmarkNodeAdded(BookmarkModel* model, 372 void BookmarkUndoService::BookmarkNodeAdded(BookmarkModel* model,
373 const BookmarkNode* parent, 373 const BookmarkNode* parent,
374 int index) { 374 int index) {
375 scoped_ptr<UndoOperation> op( 375 scoped_ptr<UndoOperation> op(
376 new BookmarkAddOperation(model, parent, index)); 376 new BookmarkAddOperation(model, parent, index));
377 undo_manager()->AddUndoOperation(op.Pass()); 377 undo_manager()->AddUndoOperation(std::move(op));
378 } 378 }
379 379
380 void BookmarkUndoService::OnWillChangeBookmarkNode(BookmarkModel* model, 380 void BookmarkUndoService::OnWillChangeBookmarkNode(BookmarkModel* model,
381 const BookmarkNode* node) { 381 const BookmarkNode* node) {
382 scoped_ptr<UndoOperation> op(new BookmarkEditOperation(model, node)); 382 scoped_ptr<UndoOperation> op(new BookmarkEditOperation(model, node));
383 undo_manager()->AddUndoOperation(op.Pass()); 383 undo_manager()->AddUndoOperation(std::move(op));
384 } 384 }
385 385
386 void BookmarkUndoService::OnWillReorderBookmarkNode(BookmarkModel* model, 386 void BookmarkUndoService::OnWillReorderBookmarkNode(BookmarkModel* model,
387 const BookmarkNode* node) { 387 const BookmarkNode* node) {
388 scoped_ptr<UndoOperation> op(new BookmarkReorderOperation(model, node)); 388 scoped_ptr<UndoOperation> op(new BookmarkReorderOperation(model, node));
389 undo_manager()->AddUndoOperation(op.Pass()); 389 undo_manager()->AddUndoOperation(std::move(op));
390 } 390 }
391 391
392 void BookmarkUndoService::GroupedBookmarkChangesBeginning( 392 void BookmarkUndoService::GroupedBookmarkChangesBeginning(
393 BookmarkModel* model) { 393 BookmarkModel* model) {
394 undo_manager()->StartGroupingActions(); 394 undo_manager()->StartGroupingActions();
395 } 395 }
396 396
397 void BookmarkUndoService::GroupedBookmarkChangesEnded(BookmarkModel* model) { 397 void BookmarkUndoService::GroupedBookmarkChangesEnded(BookmarkModel* model) {
398 undo_manager()->EndGroupingActions(); 398 undo_manager()->EndGroupingActions();
399 } 399 }
400 400
401 void BookmarkUndoService::SetUndoProvider(BookmarkUndoProvider* undo_provider) { 401 void BookmarkUndoService::SetUndoProvider(BookmarkUndoProvider* undo_provider) {
402 undo_provider_ = undo_provider; 402 undo_provider_ = undo_provider;
403 } 403 }
404 404
405 void BookmarkUndoService::OnBookmarkNodeRemoved(BookmarkModel* model, 405 void BookmarkUndoService::OnBookmarkNodeRemoved(BookmarkModel* model,
406 const BookmarkNode* parent, 406 const BookmarkNode* parent,
407 int index, 407 int index,
408 scoped_ptr<BookmarkNode> node) { 408 scoped_ptr<BookmarkNode> node) {
409 DCHECK(undo_provider_); 409 DCHECK(undo_provider_);
410 scoped_ptr<UndoOperation> op(new BookmarkRemoveOperation( 410 scoped_ptr<UndoOperation> op(new BookmarkRemoveOperation(
411 model, undo_provider_, parent, index, node.Pass())); 411 model, undo_provider_, parent, index, std::move(node)));
412 undo_manager()->AddUndoOperation(op.Pass()); 412 undo_manager()->AddUndoOperation(std::move(op));
413 } 413 }
OLDNEW
« no previous file with comments | « components/translate/core/browser/translate_ui_delegate.cc ('k') | components/undo/undo_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698