blob: 8b4dfd84451814abf806a82981de4b1e94e6530d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MOJO_SHELL_SHELL_IMPL_H_
#define MOJO_SHELL_SHELL_IMPL_H_
#include "base/callback.h"
#include "mojo/application/public/interfaces/application.mojom.h"
#include "mojo/application/public/interfaces/shell.mojom.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "mojo/shell/identity.h"
#include "url/gurl.h"
namespace mojo {
namespace shell {
class ApplicationManager;
class ShellImpl : public Shell {
public:
ShellImpl(ApplicationPtr application,
ApplicationManager* manager,
const Identity& resolved_identity,
const base::Closure& on_application_end);
~ShellImpl() override;
void InitializeApplication();
void ConnectToClient(const GURL& requested_url,
const GURL& requestor_url,
InterfaceRequest<ServiceProvider> services,
ServiceProviderPtr exposed_services);
Application* application() { return application_.get(); }
const Identity& identity() const { return identity_; }
base::Closure on_application_end() const { return on_application_end_; }
private:
// Shell implementation:
void ConnectToApplication(mojo::URLRequestPtr app_request,
InterfaceRequest<ServiceProvider> services,
ServiceProviderPtr exposed_services) override;
void QuitApplication() override;
void OnConnectionError();
void OnQuitRequestedResult(bool can_quit);
struct QueuedClientRequest {
QueuedClientRequest();
~QueuedClientRequest();
GURL requested_url;
GURL requestor_url;
InterfaceRequest<ServiceProvider> services;
ServiceProviderPtr exposed_services;
};
ApplicationManager* const manager_;
const Identity identity_;
base::Closure on_application_end_;
ApplicationPtr application_;
Binding<Shell> binding_;
bool queue_requests_;
std::vector<QueuedClientRequest*> queued_client_requests_;
DISALLOW_COPY_AND_ASSIGN(ShellImpl);
};
} // namespace shell
} // namespace mojo
#endif // MOJO_SHELL_SHELL_IMPL_H_
|