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