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

Side by Side Diff: mojo/public/cpp/application/application_impl.h

Issue 905583002: Pass the final URL an app was loaded from to the app in Initialize(). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: o Created 5 years, 10 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
« no previous file with comments | « examples/python/__mojo__.py ('k') | mojo/public/cpp/application/lib/application_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_PUBLIC_APPLICATION_APPLICATION_IMPL_H_ 5 #ifndef MOJO_PUBLIC_APPLICATION_APPLICATION_IMPL_H_
6 #define MOJO_PUBLIC_APPLICATION_APPLICATION_IMPL_H_ 6 #define MOJO_PUBLIC_APPLICATION_APPLICATION_IMPL_H_
7 #include <vector> 7 #include <vector>
8 8
9 #include "mojo/public/cpp/application/application_connection.h" 9 #include "mojo/public/cpp/application/application_connection.h"
10 #include "mojo/public/cpp/application/lib/service_connector.h" 10 #include "mojo/public/cpp/application/lib/service_connector.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // 51 //
52 // 52 //
53 class ApplicationImpl : public Application { 53 class ApplicationImpl : public Application {
54 public: 54 public:
55 ApplicationImpl(ApplicationDelegate* delegate, 55 ApplicationImpl(ApplicationDelegate* delegate,
56 InterfaceRequest<Application> request); 56 InterfaceRequest<Application> request);
57 ~ApplicationImpl() override; 57 ~ApplicationImpl() override;
58 58
59 Shell* shell() const { return shell_.get(); } 59 Shell* shell() const { return shell_.get(); }
60 60
61 const std::string& url() const { return url_; }
62
61 // Returns any initial configuration arguments, passed by the Shell. 63 // Returns any initial configuration arguments, passed by the Shell.
62 const std::vector<std::string>& args() const { return args_; } 64 const std::vector<std::string>& args() const { return args_; }
63 bool HasArg(const std::string& arg) const; 65 bool HasArg(const std::string& arg) const;
64 66
65 // Establishes a new connection to an application. Caller does not own. 67 // Establishes a new connection to an application. Caller does not own.
66 ApplicationConnection* ConnectToApplication(const String& application_url); 68 ApplicationConnection* ConnectToApplication(const String& application_url);
67 69
68 // Connect to application identified by |application_url| and connect to the 70 // Connect to application identified by |application_url| and connect to the
69 // service implementation of the interface identified by |Interface|. 71 // service implementation of the interface identified by |Interface|.
70 template <typename Interface> 72 template <typename Interface>
71 void ConnectToService(const std::string& application_url, 73 void ConnectToService(const std::string& application_url,
72 InterfacePtr<Interface>* ptr) { 74 InterfacePtr<Interface>* ptr) {
73 ConnectToApplication(application_url)->ConnectToService(ptr); 75 ConnectToApplication(application_url)->ConnectToService(ptr);
74 } 76 }
75 77
76 // Application implementation. 78 // Application implementation.
77 void Initialize(ShellPtr shell, Array<String> args) override; 79 void Initialize(ShellPtr shell,
80 Array<String> args,
81 const mojo::String& url) override;
78 82
79 // Block until the Application is initialized, if it is not already. 83 // Block until the Application is initialized, if it is not already.
80 void WaitForInitialize(); 84 void WaitForInitialize();
81 85
82 // Unbinds the Shell and Application connections. Can be used to re-bind the 86 // Unbinds the Shell and Application connections. Can be used to re-bind the
83 // handles to another implementation of ApplicationImpl, for instance when 87 // handles to another implementation of ApplicationImpl, for instance when
84 // running apptests. 88 // running apptests.
85 void UnbindConnections(InterfaceRequest<Application>* application_request, 89 void UnbindConnections(InterfaceRequest<Application>* application_request,
86 ShellPtr* shell); 90 ShellPtr* shell);
87 91
(...skipping 18 matching lines...) Expand all
106 void RequestQuit() override; 110 void RequestQuit() override;
107 111
108 typedef std::vector<internal::ServiceRegistry*> ServiceRegistryList; 112 typedef std::vector<internal::ServiceRegistry*> ServiceRegistryList;
109 113
110 ServiceRegistryList incoming_service_registries_; 114 ServiceRegistryList incoming_service_registries_;
111 ServiceRegistryList outgoing_service_registries_; 115 ServiceRegistryList outgoing_service_registries_;
112 ApplicationDelegate* delegate_; 116 ApplicationDelegate* delegate_;
113 Binding<Application> binding_; 117 Binding<Application> binding_;
114 ShellPtr shell_; 118 ShellPtr shell_;
115 ShellPtrWatcher* shell_watch_; 119 ShellPtrWatcher* shell_watch_;
120 std::string url_;
116 std::vector<std::string> args_; 121 std::vector<std::string> args_;
117 122
118 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); 123 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl);
119 }; 124 };
120 125
121 } // namespace mojo 126 } // namespace mojo
122 127
123 #endif // MOJO_PUBLIC_APPLICATION_APPLICATION_IMPL_H_ 128 #endif // MOJO_PUBLIC_APPLICATION_APPLICATION_IMPL_H_
OLDNEW
« no previous file with comments | « examples/python/__mojo__.py ('k') | mojo/public/cpp/application/lib/application_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698