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

Side by Side Diff: mojo/services/view_manager/view_manager_init_service_impl.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_IMPL_H_ 5 #ifndef MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_INIT_SERVICE_IMPL_H_
6 #define MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_INIT_SERVICE_IMPL_H_ 6 #define MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_INIT_SERVICE_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_vector.h"
13 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" 12 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h"
14 #include "mojo/services/view_manager/root_node_manager.h" 13 #include "mojo/services/view_manager/root_node_manager.h"
15 #include "mojo/services/view_manager/view_manager_export.h" 14 #include "mojo/services/view_manager/view_manager_export.h"
16 15
17 namespace mojo { 16 namespace mojo {
18 17
19 class ApplicationConnection; 18 class ApplicationConnection;
20 class ServiceProvider;
21 19
22 namespace service { 20 namespace service {
23 21
24 class ViewManagerInitServiceContext; 22 class ViewManagerInitServiceContext;
25 23
26 #if defined(OS_WIN) 24 #if defined(OS_WIN)
27 // Equivalent of NON_EXPORTED_BASE which does not work with the template snafu 25 // Equivalent of NON_EXPORTED_BASE which does not work with the template snafu
28 // below. 26 // below.
29 #pragma warning(push) 27 #pragma warning(push)
30 #pragma warning(disable : 4275) 28 #pragma warning(disable : 4275)
31 #endif 29 #endif
32 30
33 // Used to create the initial ViewManagerClient. Doesn't initiate the Connect() 31 // Used to create the initial ViewManagerClient. Doesn't initiate the Connect()
34 // until the WindowTreeHost has been created. 32 // until the WindowTreeHost has been created.
35 class MOJO_VIEW_MANAGER_EXPORT ViewManagerInitServiceImpl 33 class MOJO_VIEW_MANAGER_EXPORT ViewManagerInitServiceImpl
36 : public InterfaceImpl<ViewManagerInitService> { 34 : public InterfaceImpl<ViewManagerInitService> {
37 public: 35 public:
38 ViewManagerInitServiceImpl(ApplicationConnection* connection, 36 ViewManagerInitServiceImpl(ApplicationConnection* connection,
39 ViewManagerInitServiceContext* context); 37 ViewManagerInitServiceContext* context);
40 virtual ~ViewManagerInitServiceImpl(); 38 virtual ~ViewManagerInitServiceImpl();
41 39
42 void OnNativeViewportDeleted();
43
44 void OnRootViewManagerWindowTreeHostCreated();
45
46 private: 40 private:
47 struct ConnectParams {
48 ConnectParams();
49 ~ConnectParams();
50
51 std::string url;
52 InterfaceRequest<ServiceProvider> service_provider;
53 Callback<void(bool)> callback;
54 };
55
56 void MaybeEmbed();
57
58 // ViewManagerInitService overrides: 41 // ViewManagerInitService overrides:
59 virtual void Embed(const String& url, 42 virtual void Embed(const String& url,
60 ServiceProviderPtr service_provider, 43 ServiceProviderPtr service_provider,
61 const Callback<void(bool)>& callback) OVERRIDE; 44 const Callback<void(bool)>& callback) OVERRIDE;
62 45
63 ViewManagerInitServiceContext* context_; 46 ViewManagerInitServiceContext* context_;
64 47
65 ServiceProvider* service_provider_;
66
67 // Stores information about inbound calls to Embed() pending execution on
68 // the window tree host being ready to use.
69 ScopedVector<ConnectParams> connect_params_;
70
71 bool is_tree_host_ready_;
72
73 DISALLOW_COPY_AND_ASSIGN(ViewManagerInitServiceImpl); 48 DISALLOW_COPY_AND_ASSIGN(ViewManagerInitServiceImpl);
74 }; 49 };
75 50
76 #if defined(OS_WIN) 51 #if defined(OS_WIN)
77 #pragma warning(pop) 52 #pragma warning(pop)
78 #endif 53 #endif
79 54
80 } // namespace service 55 } // namespace service
81 } // namespace mojo 56 } // namespace mojo
82 57
83 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_INIT_SERVICE_IMPL_H_ 58 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_INIT_SERVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698