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

Side by Side Diff: mojo/services/view_manager/view_manager_init_service_context.h

Issue 463523003: Fix an issue with view manager init service where you had to retain a connection to the init servic… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_INIT_SERVICE_CONTEXT_H_ 5 #ifndef MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_INIT_SERVICE_CONTEXT_H_
6 #define MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_INIT_SERVICE_CONTEXT_H_ 6 #define MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_INIT_SERVICE_CONTEXT_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/scoped_vector.h"
11 #include "mojo/public/cpp/application/application_connection.h" 12 #include "mojo/public/cpp/application/application_connection.h"
12 #include "mojo/public/cpp/application/application_delegate.h" 13 #include "mojo/public/cpp/application/application_delegate.h"
13 #include "mojo/services/view_manager/root_view_manager_delegate.h" 14 #include "mojo/services/view_manager/root_view_manager_delegate.h"
14 #include "mojo/services/view_manager/view_manager_export.h" 15 #include "mojo/services/view_manager/view_manager_export.h"
15 16
16 namespace mojo { 17 namespace mojo {
17 namespace service { 18 namespace service {
18 19
19 class RootNodeManager; 20 class RootNodeManager;
20 class ViewManagerInitServiceImpl; 21 class ViewManagerInitServiceImpl;
21 22
22 // State shared between all ViewManagerInitService impls. 23 // State shared between all ViewManagerInitService impls.
23 class MOJO_VIEW_MANAGER_EXPORT ViewManagerInitServiceContext 24 class MOJO_VIEW_MANAGER_EXPORT ViewManagerInitServiceContext
24 : public RootViewManagerDelegate { 25 : public RootViewManagerDelegate {
25 public: 26 public:
26 ViewManagerInitServiceContext(); 27 ViewManagerInitServiceContext();
27 virtual ~ViewManagerInitServiceContext(); 28 virtual ~ViewManagerInitServiceContext();
28 29
29 void AddConnection(ViewManagerInitServiceImpl* connection); 30 void AddConnection(ViewManagerInitServiceImpl* connection);
30 void RemoveConnection(ViewManagerInitServiceImpl* connection); 31 void RemoveConnection(ViewManagerInitServiceImpl* connection);
31 32
32 void ConfigureIncomingConnection(ApplicationConnection* connection); 33 void ConfigureIncomingConnection(ApplicationConnection* connection);
33 34
35 void Embed(const String& url,
36 ServiceProviderPtr service_provider,
37 const Callback<void(bool)>& callback);
38
34 RootNodeManager* root_node_manager() { return root_node_manager_.get(); } 39 RootNodeManager* root_node_manager() { return root_node_manager_.get(); }
35 40
36 bool is_tree_host_ready() const { return is_tree_host_ready_; } 41 bool is_tree_host_ready() const { return is_tree_host_ready_; }
37 42
38 private: 43 private:
39 typedef std::vector<ViewManagerInitServiceImpl*> Connections; 44 typedef std::vector<ViewManagerInitServiceImpl*> Connections;
40 45
46 struct ConnectParams {
47 ConnectParams();
48 ~ConnectParams();
49
50 std::string url;
51 InterfaceRequest<ServiceProvider> service_provider;
52 Callback<void(bool)> callback;
53 };
54
41 // RootViewManagerDelegate overrides: 55 // RootViewManagerDelegate overrides:
42 virtual void OnRootViewManagerWindowTreeHostCreated() OVERRIDE; 56 virtual void OnRootViewManagerWindowTreeHostCreated() OVERRIDE;
43 57
44 void OnNativeViewportDeleted(); 58 void OnNativeViewportDeleted();
45 59
60 void MaybeEmbed();
61
46 scoped_ptr<RootNodeManager> root_node_manager_; 62 scoped_ptr<RootNodeManager> root_node_manager_;
47 Connections connections_; 63 Connections connections_;
48 64
65 // Stores information about inbound calls to Embed() pending execution on
66 // the window tree host being ready to use.
67 ScopedVector<ConnectParams> connect_params_;
68
49 bool is_tree_host_ready_; 69 bool is_tree_host_ready_;
50 70
71 bool deleting_connection_;
72
51 DISALLOW_COPY_AND_ASSIGN(ViewManagerInitServiceContext); 73 DISALLOW_COPY_AND_ASSIGN(ViewManagerInitServiceContext);
52 }; 74 };
53 75
54 } // namespace service 76 } // namespace service
55 } // namespace mojo 77 } // namespace mojo
56 78
57 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_INIT_SERVICE_CONTEXT_H_ 79 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_INIT_SERVICE_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698