Chromium Code Reviews| Index: blimp/client/core/contents/blimp_contents_manager.h |
| diff --git a/blimp/client/core/contents/blimp_contents_manager.h b/blimp/client/core/contents/blimp_contents_manager.h |
| index ea70960ffbccffc7eb48072e9d5784c2de681fab..ffd11dd3fed8fea43309bcb70c8c6bda6969b816 100644 |
| --- a/blimp/client/core/contents/blimp_contents_manager.h |
| +++ b/blimp/client/core/contents/blimp_contents_manager.h |
| @@ -10,14 +10,17 @@ |
| namespace blimp { |
| namespace client { |
| +class TabControlFeature; |
| + |
| // BlimpContentsManager does the real work of creating BlimpContentsImpl, and |
| // then passes the ownership to the caller. It also owns the observers to |
| // monitor the life time of the contents it creates. |
| class BlimpContentsManager { |
| public: |
| - BlimpContentsManager(); |
| + explicit BlimpContentsManager(TabControlFeature* tab_control_feature); |
| ~BlimpContentsManager(); |
| + // Create a new BlimpContentsImpl, owns it, and create a tab for it. |
|
David Trainor- moved to gerrit
2016/08/19 20:55:05
This comment is a bit confusing. This class doesn
Menglin
2016/08/19 21:33:02
Done.
|
| std::unique_ptr<BlimpContentsImpl> CreateBlimpContents(); |
| // The caller can query the contents through its id. |
| @@ -30,8 +33,14 @@ class BlimpContentsManager { |
| // When creating the BlimpContentsImpl, an id is created for the content. |
| int CreateBlimpContentsId(); |
| - // When a BlimpContentsImpl is destroyed, its observer is able to retrieve the |
| - // id, and use this to destroy the observer entry from the observer_map_. |
| + // When a BlimpContentsImpl is destroyed, its observer will pass the contents |
| + // pointer to the manager. The contents pointer is used to retrieve its id, |
| + // which in turn is used to destroy the observer entry from the observer_map_ |
| + // and close the tab. |
| + void OnContentsDestroyed(BlimpContents* contents); |
| + |
| + // Destroy the observer entry from the observer_map_ when a BlimpContentsImpl |
| + // is destroyed. |
| void EraseObserverFromMap(int id); |
| base::WeakPtr<BlimpContentsManager> GetWeakPtr(); |
| @@ -40,6 +49,8 @@ class BlimpContentsManager { |
| // lifetime of the observers. |
| std::map<int, std::unique_ptr<BlimpContentsDeletionObserver>> observer_map_; |
| + TabControlFeature* tab_control_feature_ = nullptr; |
| + |
| base::WeakPtrFactory<BlimpContentsManager> weak_ptr_factory_; |
| DISALLOW_COPY_AND_ASSIGN(BlimpContentsManager); |