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 <map> | 8 #include <map> |
| 9 #include <vector> |
9 | 10 |
10 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
11 #include "blimp/client/core/contents/blimp_contents_impl.h" | 12 #include "blimp/client/core/contents/blimp_contents_impl.h" |
12 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
13 | 14 |
14 namespace blimp { | 15 namespace blimp { |
15 namespace client { | 16 namespace client { |
16 | 17 |
17 class BlimpCompositorDependencies; | 18 class BlimpCompositorDependencies; |
18 class BlimpContents; | 19 class BlimpContents; |
(...skipping 18 matching lines...) Expand all Loading... |
37 | 38 |
38 // Builds a BlimpContentsImpl and notifies the engine. | 39 // Builds a BlimpContentsImpl and notifies the engine. |
39 // TODO(mlliu): Currently we want to have a single BlimpContents. If there is | 40 // TODO(mlliu): Currently we want to have a single BlimpContents. If there is |
40 // an existing contents, return nullptr (http://crbug.com/642558). | 41 // an existing contents, return nullptr (http://crbug.com/642558). |
41 std::unique_ptr<BlimpContentsImpl> CreateBlimpContents( | 42 std::unique_ptr<BlimpContentsImpl> CreateBlimpContents( |
42 gfx::NativeWindow window); | 43 gfx::NativeWindow window); |
43 | 44 |
44 // The caller can query the contents through its id. | 45 // The caller can query the contents through its id. |
45 BlimpContentsImpl* GetBlimpContents(int id); | 46 BlimpContentsImpl* GetBlimpContents(int id); |
46 | 47 |
| 48 // Returns a vector of the currently active BlimpContentsImpls. There is no |
| 49 // guarantee for the lifetime of these pointers after this stack frame. |
| 50 std::vector<BlimpContentsImpl*> GetAllActiveBlimpContents(); |
| 51 |
47 private: | 52 private: |
48 class BlimpContentsDeletionObserver; | 53 class BlimpContentsDeletionObserver; |
49 friend class BlimpContentsDeletionObserver; | 54 friend class BlimpContentsDeletionObserver; |
50 | 55 |
51 // When creating the BlimpContentsImpl, an id is created for the content. | 56 // When creating the BlimpContentsImpl, an id is created for the content. |
52 int CreateBlimpContentsId(); | 57 int CreateBlimpContentsId(); |
53 | 58 |
54 // When a BlimpContentsImpl is destroyed, its observer will pass the contents | 59 // When a BlimpContentsImpl is destroyed, its observer will pass the contents |
55 // pointer to the manager. The contents pointer is used to retrieve its id, | 60 // pointer to the manager. The contents pointer is used to retrieve its id, |
56 // which in turn is used to destroy the observer entry from the observer_map_ | 61 // which in turn is used to destroy the observer entry from the observer_map_ |
(...skipping 26 matching lines...) Expand all Loading... |
83 | 88 |
84 base::WeakPtrFactory<BlimpContentsManager> weak_ptr_factory_; | 89 base::WeakPtrFactory<BlimpContentsManager> weak_ptr_factory_; |
85 | 90 |
86 DISALLOW_COPY_AND_ASSIGN(BlimpContentsManager); | 91 DISALLOW_COPY_AND_ASSIGN(BlimpContentsManager); |
87 }; | 92 }; |
88 | 93 |
89 } // namespace client | 94 } // namespace client |
90 } // namespace blimp | 95 } // namespace blimp |
91 | 96 |
92 #endif // BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_MANAGER_H_ | 97 #endif // BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_MANAGER_H_ |
OLD | NEW |