OLD | NEW |
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> | 7 #include <utility> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "components/strings/grit/components_strings.h" |
12 #include "components/undo/undo_manager_observer.h" | 13 #include "components/undo/undo_manager_observer.h" |
13 #include "components/undo/undo_operation.h" | 14 #include "components/undo/undo_operation.h" |
14 #include "grit/components_strings.h" | |
15 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 // Maximum number of changes that can be undone. | 19 // Maximum number of changes that can be undone. |
20 const size_t kMaxUndoGroups = 100; | 20 const size_t kMaxUndoGroups = 100; |
21 | 21 |
22 } // namespace | 22 } // namespace |
23 | 23 |
24 // UndoGroup ------------------------------------------------------------------ | 24 // UndoGroup ------------------------------------------------------------------ |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // Limit the number of undo levels so the undo stack does not grow unbounded. | 192 // Limit the number of undo levels so the undo stack does not grow unbounded. |
193 if (GetActiveUndoGroup()->size() > kMaxUndoGroups) | 193 if (GetActiveUndoGroup()->size() > kMaxUndoGroups) |
194 GetActiveUndoGroup()->erase(GetActiveUndoGroup()->begin()); | 194 GetActiveUndoGroup()->erase(GetActiveUndoGroup()->begin()); |
195 | 195 |
196 NotifyOnUndoManagerStateChange(); | 196 NotifyOnUndoManagerStateChange(); |
197 } | 197 } |
198 | 198 |
199 std::vector<std::unique_ptr<UndoGroup>>* UndoManager::GetActiveUndoGroup() { | 199 std::vector<std::unique_ptr<UndoGroup>>* UndoManager::GetActiveUndoGroup() { |
200 return performing_undo_ ? &redo_actions_ : &undo_actions_; | 200 return performing_undo_ ? &redo_actions_ : &undo_actions_; |
201 } | 201 } |
OLD | NEW |