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

Side by Side Diff: blimp/client/core/contents/blimp_contents_manager.h

Issue 2299453002: Restrict number of BlimpContents to [0, 1] (Closed)
Patch Set: patch failure fix Created 4 years, 3 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 unified diff | Download patch
OLDNEW
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 "blimp/client/core/contents/blimp_contents_impl.h"
9 9
10 namespace blimp { 10 namespace blimp {
11 namespace client { 11 namespace client {
12 12
13 class TabControlFeature; 13 class TabControlFeature;
14 14
15 // BlimpContentsManager does the real work of creating BlimpContentsImpl, and 15 // BlimpContentsManager does the real work of creating BlimpContentsImpl, and
16 // then passes the ownership to the caller. It also owns the observers to 16 // then passes the ownership to the caller. It also owns the observers to
17 // monitor the life time of the contents it creates. 17 // monitor the life time of the contents it creates.
18 class BlimpContentsManager { 18 class BlimpContentsManager {
19 public: 19 public:
20 explicit BlimpContentsManager(ImeFeature* ime_feature, 20 explicit BlimpContentsManager(ImeFeature* ime_feature,
21 NavigationFeature* nav_feature, 21 NavigationFeature* nav_feature,
22 TabControlFeature* tab_control_feature); 22 TabControlFeature* tab_control_feature);
23 ~BlimpContentsManager(); 23 ~BlimpContentsManager();
24 24
25 // Builds a BlimpContentsImpl and notifies the engine. 25 // Builds a BlimpContentsImpl and notifies the engine.
26 // TODO(mlliu): Currently we want to have a single BlimpContents. If there is
27 // an existing contents, return nullptr (http://crbug.com/642558).
26 std::unique_ptr<BlimpContentsImpl> CreateBlimpContents(); 28 std::unique_ptr<BlimpContentsImpl> CreateBlimpContents();
27 29
28 // The caller can query the contents through its id. 30 // The caller can query the contents through its id.
29 BlimpContentsImpl* GetBlimpContents(int id); 31 BlimpContentsImpl* GetBlimpContents(int id);
30 32
31 private: 33 private:
32 class BlimpContentsDeletionObserver; 34 class BlimpContentsDeletionObserver;
33 friend class BlimpContentsDeletionObserver; 35 friend class BlimpContentsDeletionObserver;
34 36
35 // When creating the BlimpContentsImpl, an id is created for the content. 37 // When creating the BlimpContentsImpl, an id is created for the content.
(...skipping 12 matching lines...) Expand all
48 50
49 // BlimpContentsManager owns the BlimpContentsDeletionObserver for the 51 // BlimpContentsManager owns the BlimpContentsDeletionObserver for the
50 // contents it creates, with the content id being the key to help manage the 52 // contents it creates, with the content id being the key to help manage the
51 // lifetime of the observers. 53 // lifetime of the observers.
52 std::map<int, std::unique_ptr<BlimpContentsDeletionObserver>> observer_map_; 54 std::map<int, std::unique_ptr<BlimpContentsDeletionObserver>> observer_map_;
53 55
54 ImeFeature* ime_feature_; 56 ImeFeature* ime_feature_;
55 NavigationFeature* navigation_feature_; 57 NavigationFeature* navigation_feature_;
56 TabControlFeature* tab_control_feature_; 58 TabControlFeature* tab_control_feature_;
57 59
60 // TODO(mlliu): Currently we want to have a single BlimpContents. Remove this
61 // when it supports multiple tabs (http://crbug.com/642558).
62 bool tab_exists_ = false;
63
58 base::WeakPtrFactory<BlimpContentsManager> weak_ptr_factory_; 64 base::WeakPtrFactory<BlimpContentsManager> weak_ptr_factory_;
59 65
60 DISALLOW_COPY_AND_ASSIGN(BlimpContentsManager); 66 DISALLOW_COPY_AND_ASSIGN(BlimpContentsManager);
61 }; 67 };
62 68
63 } // namespace client 69 } // namespace client
64 } // namespace blimp 70 } // namespace blimp
65 71
66 #endif // BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_MANAGER_H_ 72 #endif // BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_MANAGER_H_
OLDNEW
« no previous file with comments | « blimp/client/core/blimp_client_context_impl.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