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

Side by Side Diff: mojo/shell/public/cpp/application_delegate.h

Issue 1674903003: Extract shell methods from ApplicationImpl into a base class, and pass this to Initialize() instead. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojom
Patch Set: . Created 4 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 | « mojo/shell/public/cpp/BUILD.gn ('k') | mojo/shell/public/cpp/application_impl.h » ('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_SHELL_PUBLIC_CPP_APPLICATION_DELEGATE_H_ 5 #ifndef MOJO_SHELL_PUBLIC_CPP_APPLICATION_DELEGATE_H_
6 #define MOJO_SHELL_PUBLIC_CPP_APPLICATION_DELEGATE_H_ 6 #define MOJO_SHELL_PUBLIC_CPP_APPLICATION_DELEGATE_H_
7 7
8 #include <stdint.h>
8 #include <string> 9 #include <string>
9 10
10 #include "mojo/public/cpp/system/macros.h" 11 #include "mojo/public/cpp/system/macros.h"
11 12
12 namespace mojo { 13 namespace mojo {
13 14
14 class ApplicationConnection; 15 class ApplicationConnection;
15 class ApplicationImpl; 16 class ApplicationImpl;
17 class Shell;
16 18
17 // An abstract class that the application may subclass to control various 19 // An abstract class that the application may subclass to control various
18 // behaviors of ApplicationImpl. 20 // behaviors of ApplicationImpl.
19 class ApplicationDelegate { 21 class ApplicationDelegate {
20 public: 22 public:
21 ApplicationDelegate(); 23 ApplicationDelegate();
22 virtual ~ApplicationDelegate(); 24 virtual ~ApplicationDelegate();
23 25
24 // Called exactly once before any other method. 26 // Called exactly once before any other method.
25 virtual void Initialize(ApplicationImpl* app); 27 virtual void Initialize(Shell* app, const std::string& url, uint32_t id);
26 28
27 // Override this method to configure what services a connection supports when 29 // Override this method to configure what services a connection supports when
28 // being connected to from an app. 30 // being connected to from an app.
29 // Return false to reject the connection entirely. 31 // Return false to reject the connection entirely.
30 virtual bool AcceptConnection(ApplicationConnection* connection); 32 virtual bool AcceptConnection(ApplicationConnection* connection);
31 33
32 // Called when the shell connection has a connection error. 34 // Called when the shell connection has a connection error.
33 // 35 //
34 // Return true to shutdown the application. Return false to skip shutting 36 // Return true to shutdown the application. Return false to skip shutting
35 // down the connection, but user is then required to call 37 // down the connection, but user is then required to call
36 // ApplicationImpl::QuitNow() when done. 38 // ApplicationImpl::QuitNow() when done.
37 virtual bool ShellConnectionLost(); 39 virtual bool ShellConnectionLost();
38 40
39 // Called before ApplicationImpl::Terminate(). After returning from this call 41 // Called before ApplicationImpl::Terminate(). After returning from this call
40 // the delegate can no longer rely on the main run loop still running. 42 // the delegate can no longer rely on the main run loop still running.
41 virtual void Quit(); 43 virtual void Quit();
42 44
43 private: 45 private:
44 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationDelegate); 46 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationDelegate);
45 }; 47 };
46 48
47 } // namespace mojo 49 } // namespace mojo
48 50
49 #endif // MOJO_SHELL_PUBLIC_CPP_APPLICATION_DELEGATE_H_ 51 #endif // MOJO_SHELL_PUBLIC_CPP_APPLICATION_DELEGATE_H_
OLDNEW
« no previous file with comments | « mojo/shell/public/cpp/BUILD.gn ('k') | mojo/shell/public/cpp/application_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698