| OLD | NEW |
| 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_DELEGATE_H_ | 5 #ifndef MOJO_PUBLIC_APPLICATION_APPLICATION_DELEGATE_H_ |
| 6 #define MOJO_PUBLIC_APPLICATION_APPLICATION_DELEGATE_H_ | 6 #define MOJO_PUBLIC_APPLICATION_APPLICATION_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "mojo/public/cpp/application/service_provider_impl.h" | 10 #include "mojo/public/cpp/application/service_provider_impl.h" |
| 11 #include "mojo/public/cpp/system/macros.h" | 11 #include "mojo/public/cpp/system/macros.h" |
| 12 | 12 |
| 13 namespace mojo { | 13 namespace mojo { |
| 14 | 14 |
| 15 class ApplicationConnection; | |
| 16 class ApplicationImpl; | 15 class ApplicationImpl; |
| 17 | 16 |
| 18 // An abstract class that the application may subclass to control various | 17 // An abstract class that the application may subclass to control various |
| 19 // behaviors of ApplicationImpl. | 18 // behaviors of ApplicationImpl. |
| 20 class ApplicationDelegate { | 19 class ApplicationDelegate { |
| 21 public: | 20 public: |
| 22 ApplicationDelegate(); | 21 ApplicationDelegate(); |
| 23 virtual ~ApplicationDelegate(); | 22 virtual ~ApplicationDelegate(); |
| 24 | 23 |
| 25 // Called exactly once before any other method. | 24 // Called exactly once before any other method. |
| 26 virtual void Initialize(ApplicationImpl* app); | 25 virtual void Initialize(ApplicationImpl* app); |
| 27 | 26 |
| 28 // Override this method to configure what services a connection supports when | 27 // Override this method to configure what services a connection supports when |
| 29 // being connected to from an app (|service_provider_impl| will never be | 28 // being connected to from an app (|service_provider_impl| will never be |
| 30 // null). Return false to reject the connection entirely. | 29 // null). Return false to reject the connection entirely. |
| 31 virtual bool ConfigureIncomingConnection( | 30 virtual bool ConfigureIncomingConnection( |
| 32 ServiceProviderImpl* service_provider_impl); | 31 ServiceProviderImpl* service_provider_impl); |
| 33 | 32 |
| 34 // Called before ApplicationImpl::Terminate(). After returning from this call | 33 // Called before ApplicationImpl::Terminate(). After returning from this call |
| 35 // the delegate can no longer rely on the main run loop still running. | 34 // the delegate can no longer rely on the main run loop still running. |
| 36 virtual void Quit(); | 35 virtual void Quit(); |
| 37 | 36 |
| 38 private: | 37 private: |
| 39 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationDelegate); | 38 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationDelegate); |
| 40 }; | 39 }; |
| 41 | 40 |
| 42 } // namespace mojo | 41 } // namespace mojo |
| 43 | 42 |
| 44 #endif // MOJO_PUBLIC_APPLICATION_APPLICATION_DELEGATE_H_ | 43 #endif // MOJO_PUBLIC_APPLICATION_APPLICATION_DELEGATE_H_ |
| OLD | NEW |