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..77f1bfd4ed804bbbc110671c66e846c0f80f6018 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(); |
+ // Builds a BlimpContentsImpl and notifies the engine. |
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); |