| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 VIEWS_FOCUS_VIEW_STORAGE_H_ | 5 #ifndef VIEWS_FOCUS_VIEW_STORAGE_H_ |
| 6 #define VIEWS_FOCUS_VIEW_STORAGE_H_ | 6 #define VIEWS_FOCUS_VIEW_STORAGE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "views/view.h" | 10 #include "views/view.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // Associates |view| with the specified |storage_id|. | 32 // Associates |view| with the specified |storage_id|. |
| 33 void StoreView(int storage_id, View* view); | 33 void StoreView(int storage_id, View* view); |
| 34 | 34 |
| 35 // Returns the view associated with |storage_id| if any, NULL otherwise. | 35 // Returns the view associated with |storage_id| if any, NULL otherwise. |
| 36 View* RetrieveView(int storage_id); | 36 View* RetrieveView(int storage_id); |
| 37 | 37 |
| 38 // Removes the view associated with |storage_id| if any. | 38 // Removes the view associated with |storage_id| if any. |
| 39 void RemoveView(int storage_id); | 39 void RemoveView(int storage_id); |
| 40 | 40 |
| 41 // Notifies the ViewStorage that a view was removed from its parent somewhere. | 41 // Notifies the ViewStorage that a view was removed from its parent somewhere. |
| 42 void ViewRemoved(View* parent, View* removed); | 42 void ViewRemoved(View* removed); |
| 43 | 43 |
| 44 #ifdef UNIT_TEST | 44 #ifdef UNIT_TEST |
| 45 size_t view_count() const { return view_to_ids_.size(); } | 45 size_t view_count() const { return view_to_ids_.size(); } |
| 46 #endif | 46 #endif |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 friend struct DefaultSingletonTraits<ViewStorage>; | 49 friend struct DefaultSingletonTraits<ViewStorage>; |
| 50 | 50 |
| 51 ViewStorage(); | 51 ViewStorage(); |
| 52 ~ViewStorage(); | 52 ~ViewStorage(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 63 | 63 |
| 64 // Association View to id, used to speed up view notification removal. | 64 // Association View to id, used to speed up view notification removal. |
| 65 std::map<View*, std::vector<int>*> view_to_ids_; | 65 std::map<View*, std::vector<int>*> view_to_ids_; |
| 66 | 66 |
| 67 DISALLOW_COPY_AND_ASSIGN(ViewStorage); | 67 DISALLOW_COPY_AND_ASSIGN(ViewStorage); |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 } // namespace views | 70 } // namespace views |
| 71 | 71 |
| 72 #endif // VIEWS_FOCUS_VIEW_STORAGE_H_ | 72 #endif // VIEWS_FOCUS_VIEW_STORAGE_H_ |
| OLD | NEW |