OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_MANAGER_H_ | 5 #ifndef BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_MANAGER_H_ |
6 #define BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_MANAGER_H_ | 6 #define BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // pointer to the manager. The contents pointer is used to retrieve its id, | 55 // pointer to the manager. The contents pointer is used to retrieve its id, |
56 // which in turn is used to destroy the observer entry from the observer_map_ | 56 // which in turn is used to destroy the observer entry from the observer_map_ |
57 // and close the tab. | 57 // and close the tab. |
58 void OnContentsDestroyed(BlimpContents* contents); | 58 void OnContentsDestroyed(BlimpContents* contents); |
59 | 59 |
60 // Destroy the observer entry from the observer_map_ when a BlimpContentsImpl | 60 // Destroy the observer entry from the observer_map_ when a BlimpContentsImpl |
61 // is destroyed. | 61 // is destroyed. |
62 void EraseObserverFromMap(int id); | 62 void EraseObserverFromMap(int id); |
63 base::WeakPtr<BlimpContentsManager> GetWeakPtr(); | 63 base::WeakPtr<BlimpContentsManager> GetWeakPtr(); |
64 | 64 |
| 65 // The ID to use whenever a new BlimpContentsImpl is created. Incremented |
| 66 // after each use. |
| 67 int next_blimp_contents_id_ = 0; |
| 68 |
65 // BlimpContentsManager owns the BlimpContentsDeletionObserver for the | 69 // BlimpContentsManager owns the BlimpContentsDeletionObserver for the |
66 // contents it creates, with the content id being the key to help manage the | 70 // contents it creates, with the content id being the key to help manage the |
67 // lifetime of the observers. | 71 // lifetime of the observers. |
68 std::map<int, std::unique_ptr<BlimpContentsDeletionObserver>> observer_map_; | 72 std::map<int, std::unique_ptr<BlimpContentsDeletionObserver>> observer_map_; |
69 | 73 |
70 BlimpCompositorDependencies* blimp_compositor_dependencies_; | 74 BlimpCompositorDependencies* blimp_compositor_dependencies_; |
71 ImeFeature* ime_feature_; | 75 ImeFeature* ime_feature_; |
72 NavigationFeature* navigation_feature_; | 76 NavigationFeature* navigation_feature_; |
73 RenderWidgetFeature* render_widget_feature_; | 77 RenderWidgetFeature* render_widget_feature_; |
74 TabControlFeature* tab_control_feature_; | 78 TabControlFeature* tab_control_feature_; |
75 | 79 |
76 // TODO(mlliu): Currently we want to have a single BlimpContents. Remove this | 80 // TODO(mlliu): Currently we want to have a single BlimpContents. Remove this |
77 // when it supports multiple tabs (http://crbug.com/642558). | 81 // when it supports multiple tabs (http://crbug.com/642558). |
78 bool tab_exists_ = false; | 82 bool tab_exists_ = false; |
79 | 83 |
80 base::WeakPtrFactory<BlimpContentsManager> weak_ptr_factory_; | 84 base::WeakPtrFactory<BlimpContentsManager> weak_ptr_factory_; |
81 | 85 |
82 DISALLOW_COPY_AND_ASSIGN(BlimpContentsManager); | 86 DISALLOW_COPY_AND_ASSIGN(BlimpContentsManager); |
83 }; | 87 }; |
84 | 88 |
85 } // namespace client | 89 } // namespace client |
86 } // namespace blimp | 90 } // namespace blimp |
87 | 91 |
88 #endif // BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_MANAGER_H_ | 92 #endif // BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_MANAGER_H_ |
OLD | NEW |