OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 SHELL_APPLICATION_MANAGER_SHELL_IMPL_H_ | 5 #ifndef SHELL_APPLICATION_MANAGER_SHELL_IMPL_H_ |
6 #define SHELL_APPLICATION_MANAGER_SHELL_IMPL_H_ | 6 #define SHELL_APPLICATION_MANAGER_SHELL_IMPL_H_ |
7 | 7 |
8 #include "mojo/public/cpp/bindings/binding.h" | 8 #include "mojo/public/cpp/bindings/binding.h" |
9 #include "mojo/public/cpp/bindings/error_handler.h" | 9 #include "mojo/public/cpp/bindings/error_handler.h" |
10 #include "mojo/public/interfaces/application/application.mojom.h" | 10 #include "mojo/public/interfaces/application/application.mojom.h" |
11 #include "mojo/public/interfaces/application/shell.mojom.h" | 11 #include "mojo/public/interfaces/application/shell.mojom.h" |
12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
13 | 13 |
14 namespace mojo { | 14 namespace mojo { |
15 class ApplicationManager; | 15 class ApplicationManager; |
16 | 16 |
17 class ShellImpl : public Shell, public ErrorHandler { | 17 class ShellImpl : public Shell, public ErrorHandler { |
18 public: | 18 public: |
19 ShellImpl(ScopedMessagePipeHandle handle, | 19 ShellImpl(InterfaceRequest<Shell> shell_request, |
20 ApplicationManager* manager, | 20 ApplicationManager* manager, |
21 const GURL& requested_url, | 21 const GURL& requested_url, |
22 const GURL& url); | 22 const GURL& url); |
23 | |
24 ShellImpl(ShellPtr* ptr, | |
25 ApplicationManager* manager, | |
26 const GURL& requested_url, | |
27 const GURL& url); | |
28 | 23 |
29 ~ShellImpl() override; | 24 ~ShellImpl() override; |
30 | 25 |
31 void ConnectToClient(const GURL& requestor_url, | 26 void ConnectToClient(const GURL& requestor_url, |
32 InterfaceRequest<ServiceProvider> services, | 27 InterfaceRequest<ServiceProvider> services, |
33 ServiceProviderPtr exposed_services); | 28 ServiceProviderPtr exposed_services); |
34 | 29 |
35 Application* client() { return binding_.client(); } | 30 Application* client() { return binding_.client(); } |
36 const GURL& url() const { return url_; } | 31 const GURL& url() const { return url_; } |
37 const GURL& requested_url() const { return requested_url_; } | 32 const GURL& requested_url() const { return requested_url_; } |
38 | 33 |
39 private: | 34 private: |
40 ShellImpl(ApplicationManager* manager, | |
41 const GURL& requested_url, | |
42 const GURL& url); | |
43 | |
44 // Shell implementation: | 35 // Shell implementation: |
45 void ConnectToApplication(const String& app_url, | 36 void ConnectToApplication(const String& app_url, |
46 InterfaceRequest<ServiceProvider> services, | 37 InterfaceRequest<ServiceProvider> services, |
47 ServiceProviderPtr exposed_services) override; | 38 ServiceProviderPtr exposed_services) override; |
48 | 39 |
49 // ErrorHandler implementation: | 40 // ErrorHandler implementation: |
50 void OnConnectionError() override; | 41 void OnConnectionError() override; |
51 | 42 |
52 ApplicationManager* const manager_; | 43 ApplicationManager* const manager_; |
53 const GURL requested_url_; | 44 const GURL requested_url_; |
54 const GURL url_; | 45 const GURL url_; |
55 Binding<Shell> binding_; | 46 Binding<Shell> binding_; |
56 | 47 |
57 DISALLOW_COPY_AND_ASSIGN(ShellImpl); | 48 DISALLOW_COPY_AND_ASSIGN(ShellImpl); |
58 }; | 49 }; |
59 | 50 |
60 } // namespace mojo | 51 } // namespace mojo |
61 | 52 |
62 #endif // SHELL_APPLICATION_MANAGER_SHELL_IMPL_H_ | 53 #endif // SHELL_APPLICATION_MANAGER_SHELL_IMPL_H_ |
OLD | NEW |