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 "blimp/client/core/contents/blimp_contents_impl.h" | 8 #include "blimp/client/core/contents/blimp_contents_impl.h" |
9 | 9 |
10 namespace blimp { | 10 namespace blimp { |
11 namespace client { | 11 namespace client { |
12 | 12 |
13 class TabControlFeature; | 13 class TabControlFeature; |
14 | 14 |
15 // BlimpContentsManager does the real work of creating BlimpContentsImpl, and | 15 // BlimpContentsManager does the real work of creating BlimpContentsImpl, and |
16 // then passes the ownership to the caller. It also owns the observers to | 16 // then passes the ownership to the caller. It also owns the observers to |
17 // monitor the life time of the contents it creates. | 17 // monitor the life time of the contents it creates. |
18 class BlimpContentsManager { | 18 class BlimpContentsManager { |
19 public: | 19 public: |
20 explicit BlimpContentsManager(TabControlFeature* tab_control_feature); | 20 explicit BlimpContentsManager(ImeFeature* ime_feature, |
| 21 NavigationFeature* nav_feature, |
| 22 TabControlFeature* tab_control_feature); |
21 ~BlimpContentsManager(); | 23 ~BlimpContentsManager(); |
22 | 24 |
23 // Builds a BlimpContentsImpl and notifies the engine. | 25 // Builds a BlimpContentsImpl and notifies the engine. |
24 std::unique_ptr<BlimpContentsImpl> CreateBlimpContents(); | 26 std::unique_ptr<BlimpContentsImpl> CreateBlimpContents(); |
25 | 27 |
26 // The caller can query the contents through its id. | 28 // The caller can query the contents through its id. |
27 BlimpContentsImpl* GetBlimpContents(int id); | 29 BlimpContentsImpl* GetBlimpContents(int id); |
28 | 30 |
29 private: | 31 private: |
30 class BlimpContentsDeletionObserver; | 32 class BlimpContentsDeletionObserver; |
(...skipping 11 matching lines...) Expand all Loading... |
42 // Destroy the observer entry from the observer_map_ when a BlimpContentsImpl | 44 // Destroy the observer entry from the observer_map_ when a BlimpContentsImpl |
43 // is destroyed. | 45 // is destroyed. |
44 void EraseObserverFromMap(int id); | 46 void EraseObserverFromMap(int id); |
45 base::WeakPtr<BlimpContentsManager> GetWeakPtr(); | 47 base::WeakPtr<BlimpContentsManager> GetWeakPtr(); |
46 | 48 |
47 // BlimpContentsManager owns the BlimpContentsDeletionObserver for the | 49 // BlimpContentsManager owns the BlimpContentsDeletionObserver for the |
48 // contents it creates, with the content id being the key to help manage the | 50 // contents it creates, with the content id being the key to help manage the |
49 // lifetime of the observers. | 51 // lifetime of the observers. |
50 std::map<int, std::unique_ptr<BlimpContentsDeletionObserver>> observer_map_; | 52 std::map<int, std::unique_ptr<BlimpContentsDeletionObserver>> observer_map_; |
51 | 53 |
52 TabControlFeature* tab_control_feature_ = nullptr; | 54 ImeFeature* ime_feature_; |
| 55 NavigationFeature* navigation_feature_; |
| 56 TabControlFeature* tab_control_feature_; |
53 | 57 |
54 base::WeakPtrFactory<BlimpContentsManager> weak_ptr_factory_; | 58 base::WeakPtrFactory<BlimpContentsManager> weak_ptr_factory_; |
55 | 59 |
56 DISALLOW_COPY_AND_ASSIGN(BlimpContentsManager); | 60 DISALLOW_COPY_AND_ASSIGN(BlimpContentsManager); |
57 }; | 61 }; |
58 | 62 |
59 } // namespace client | 63 } // namespace client |
60 } // namespace blimp | 64 } // namespace blimp |
61 | 65 |
62 #endif // BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_MANAGER_H_ | 66 #endif // BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_MANAGER_H_ |
OLD | NEW |