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

Side by Side Diff: components/undo/undo_manager.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/undo_manager.h" 5 #include "components/undo/undo_manager.h"
6 6
7 #include <utility>
8
7 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
8 #include "base/logging.h" 10 #include "base/logging.h"
9 #include "components/undo/undo_manager_observer.h" 11 #include "components/undo/undo_manager_observer.h"
10 #include "components/undo/undo_operation.h" 12 #include "components/undo/undo_operation.h"
11 #include "grit/components_strings.h" 13 #include "grit/components_strings.h"
12 #include "ui/base/l10n/l10n_util.h" 14 #include "ui/base/l10n/l10n_util.h"
13 15
14 namespace { 16 namespace {
15 17
16 // Maximum number of changes that can be undone. 18 // Maximum number of changes that can be undone.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 83 }
82 84
83 void UndoManager::AddUndoOperation(scoped_ptr<UndoOperation> operation) { 85 void UndoManager::AddUndoOperation(scoped_ptr<UndoOperation> operation) {
84 if (IsUndoTrakingSuspended()) { 86 if (IsUndoTrakingSuspended()) {
85 RemoveAllOperations(); 87 RemoveAllOperations();
86 operation.reset(); 88 operation.reset();
87 return; 89 return;
88 } 90 }
89 91
90 if (group_actions_count_) { 92 if (group_actions_count_) {
91 pending_grouped_action_->AddOperation(operation.Pass()); 93 pending_grouped_action_->AddOperation(std::move(operation));
92 } else { 94 } else {
93 UndoGroup* new_action = new UndoGroup(); 95 UndoGroup* new_action = new UndoGroup();
94 new_action->AddOperation(operation.Pass()); 96 new_action->AddOperation(std::move(operation));
95 AddUndoGroup(new_action); 97 AddUndoGroup(new_action);
96 } 98 }
97 } 99 }
98 100
99 void UndoManager::StartGroupingActions() { 101 void UndoManager::StartGroupingActions() {
100 if (!group_actions_count_) 102 if (!group_actions_count_)
101 pending_grouped_action_.reset(new UndoGroup()); 103 pending_grouped_action_.reset(new UndoGroup());
102 ++group_actions_count_; 104 ++group_actions_count_;
103 } 105 }
104 106
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 // Limit the number of undo levels so the undo stack does not grow unbounded. 217 // Limit the number of undo levels so the undo stack does not grow unbounded.
216 if (GetActiveUndoGroup()->size() > kMaxUndoGroups) 218 if (GetActiveUndoGroup()->size() > kMaxUndoGroups)
217 GetActiveUndoGroup()->erase(GetActiveUndoGroup()->begin()); 219 GetActiveUndoGroup()->erase(GetActiveUndoGroup()->begin());
218 220
219 NotifyOnUndoManagerStateChange(); 221 NotifyOnUndoManagerStateChange();
220 } 222 }
221 223
222 ScopedVector<UndoGroup>* UndoManager::GetActiveUndoGroup() { 224 ScopedVector<UndoGroup>* UndoManager::GetActiveUndoGroup() {
223 return performing_undo_ ? &redo_actions_ : &undo_actions_; 225 return performing_undo_ ? &redo_actions_ : &undo_actions_;
224 } 226 }
OLDNEW
« no previous file with comments | « components/undo/bookmark_undo_service.cc ('k') | components/update_client/action_update_check.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698