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 "chrome/browser/undo/undo_manager.h" | 5 #include "chrome/browser/undo/undo_manager.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "chrome/browser/undo/undo_manager_observer.h" | 9 #include "chrome/browser/undo/undo_manager_observer.h" |
10 #include "chrome/browser/undo/undo_operation.h" | 10 #include "chrome/browser/undo/undo_operation.h" |
11 #include "chrome/grit/generated_resources.h" | 11 #include "grit/components_strings.h" |
12 #include "ui/base/l10n/l10n_util.h" | 12 #include "ui/base/l10n/l10n_util.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 // Maximum number of changes that can be undone. | 16 // Maximum number of changes that can be undone. |
17 const size_t kMaxUndoGroups = 100; | 17 const size_t kMaxUndoGroups = 100; |
18 | 18 |
19 } // namespace | 19 } // namespace |
20 | 20 |
21 // UndoGroup ------------------------------------------------------------------ | 21 // UndoGroup ------------------------------------------------------------------ |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 // Limit the number of undo levels so the undo stack does not grow unbounded. | 215 // Limit the number of undo levels so the undo stack does not grow unbounded. |
216 if (GetActiveUndoGroup()->size() > kMaxUndoGroups) | 216 if (GetActiveUndoGroup()->size() > kMaxUndoGroups) |
217 GetActiveUndoGroup()->erase(GetActiveUndoGroup()->begin()); | 217 GetActiveUndoGroup()->erase(GetActiveUndoGroup()->begin()); |
218 | 218 |
219 NotifyOnUndoManagerStateChange(); | 219 NotifyOnUndoManagerStateChange(); |
220 } | 220 } |
221 | 221 |
222 ScopedVector<UndoGroup>* UndoManager::GetActiveUndoGroup() { | 222 ScopedVector<UndoGroup>* UndoManager::GetActiveUndoGroup() { |
223 return performing_undo_ ? &redo_actions_ : &undo_actions_; | 223 return performing_undo_ ? &redo_actions_ : &undo_actions_; |
224 } | 224 } |
OLD | NEW |