Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Unified Diff: blimp/client/core/contents/blimp_contents_manager.h

Issue 2255533002: Add TabControlFeature to BlimpClientContextImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync to head Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
« no previous file with comments | « blimp/client/core/contents/blimp_contents_impl_unittest.cc ('k') | blimp/client/core/contents/blimp_contents_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698