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