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

Side by Side Diff: shell/application_manager/shell_impl.h

Issue 983113002: ApplicationManager: Use callback to get notified on application shutdown. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 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
OLDNEW
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 "base/callback.h"
8 #include "mojo/public/cpp/bindings/binding.h" 9 #include "mojo/public/cpp/bindings/binding.h"
9 #include "mojo/public/cpp/bindings/error_handler.h" 10 #include "mojo/public/cpp/bindings/error_handler.h"
10 #include "mojo/public/interfaces/application/application.mojom.h" 11 #include "mojo/public/interfaces/application/application.mojom.h"
11 #include "mojo/public/interfaces/application/shell.mojom.h" 12 #include "mojo/public/interfaces/application/shell.mojom.h"
12 #include "url/gurl.h" 13 #include "url/gurl.h"
13 14
14 namespace mojo { 15 namespace mojo {
15 namespace shell { 16 namespace shell {
16 17
17 class ApplicationManager; 18 class ApplicationManager;
18 19
19 class ShellImpl : public Shell, public ErrorHandler { 20 class ShellImpl : public Shell, public ErrorHandler {
20 public: 21 public:
21 ShellImpl(ApplicationPtr application, 22 ShellImpl(ApplicationPtr application,
22 ApplicationManager* manager, 23 ApplicationManager* manager,
23 // The original URL that was first requested, before any resolution. 24 const GURL& url_,
24 const GURL& original_url, 25 const base::Closure& on_application_end);
25 const GURL& resolved_url);
26 26
27 ~ShellImpl() override; 27 ~ShellImpl() override;
28 28
29 void InitializeApplication(Array<String> args); 29 void InitializeApplication(Array<String> args);
30 30
31 void ConnectToClient(const GURL& requested_url, 31 void ConnectToClient(const GURL& requested_url,
32 const GURL& requestor_url, 32 const GURL& requestor_url,
33 InterfaceRequest<ServiceProvider> services, 33 InterfaceRequest<ServiceProvider> services,
34 ServiceProviderPtr exposed_services); 34 ServiceProviderPtr exposed_services);
35 35
36 Application* application() { return application_.get(); } 36 Application* application() { return application_.get(); }
37 const GURL& url() const { return url_; } 37 const GURL& url() const { return url_; }
38 const GURL& requested_url() const { return requested_url_; } 38 base::Closure on_application_end() const { return on_application_end_; }
39 39
40 private: 40 private:
41 // Shell implementation: 41 // Shell implementation:
42 void ConnectToApplication(const String& app_url, 42 void ConnectToApplication(const String& app_url,
43 InterfaceRequest<ServiceProvider> services, 43 InterfaceRequest<ServiceProvider> services,
44 ServiceProviderPtr exposed_services) override; 44 ServiceProviderPtr exposed_services) override;
45 45
46 // ErrorHandler implementation: 46 // ErrorHandler implementation:
47 void OnConnectionError() override; 47 void OnConnectionError() override;
48 48
49 ApplicationManager* const manager_; 49 ApplicationManager* const manager_;
50 const GURL requested_url_;
51 const GURL url_; 50 const GURL url_;
51 base::Closure on_application_end_;
52 ApplicationPtr application_; 52 ApplicationPtr application_;
53 Binding<Shell> binding_; 53 Binding<Shell> binding_;
54 54
55 DISALLOW_COPY_AND_ASSIGN(ShellImpl); 55 DISALLOW_COPY_AND_ASSIGN(ShellImpl);
56 }; 56 };
57 57
58 } // namespace shell 58 } // namespace shell
59 } // namespace mojo 59 } // namespace mojo
60 60
61 #endif // SHELL_APPLICATION_MANAGER_SHELL_IMPL_H_ 61 #endif // SHELL_APPLICATION_MANAGER_SHELL_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698