| 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/system/macros.h" | 10 #include "mojo/public/cpp/system/macros.h" |
| 11 | 11 |
| 12 namespace mojo { | 12 namespace mojo { |
| 13 | 13 |
| 14 class ApplicationConnection; | 14 class ApplicationConnection; |
| 15 class ApplicationImpl; | 15 class ApplicationImpl; |
| 16 | 16 |
| 17 // An abstract class that the application may subclass to control various | 17 // An abstract class that the application may subclass to control various |
| 18 // behaviors of ApplicationImpl. | 18 // behaviors of ApplicationImpl. |
| 19 class ApplicationDelegate { | 19 class ApplicationDelegate { |
| 20 public: | 20 public: |
| 21 ApplicationDelegate(); | 21 ApplicationDelegate(); |
| 22 virtual ~ApplicationDelegate(); | 22 virtual ~ApplicationDelegate(); |
| 23 | 23 |
| 24 // Called exactly once before any other method. | 24 // Called exactly once before any other method. |
| 25 virtual void Initialize(ApplicationImpl* app); | 25 virtual void Initialize(ApplicationImpl* app); |
| 26 | 26 |
| 27 // Override this method to configure what services a connection supports when | 27 // Override this method to configure what services a connection supports when |
| 28 // being connected to from an app. | 28 // being connected to from an app. |
| 29 // |url| is the URL that was requested by the remote application, after all |
| 30 // resolutions, mappings, and redirects. |
| 29 // Return false to reject the connection entirely. | 31 // Return false to reject the connection entirely. |
| 30 virtual bool ConfigureIncomingConnection(ApplicationConnection* connection); | 32 virtual bool ConfigureIncomingConnection(ApplicationConnection* connection, |
| 33 const std::string& url); |
| 31 | 34 |
| 32 // Override this method to configure what services a connection supports when | 35 // Override this method to configure what services a connection supports when |
| 33 // connecting to another app. | 36 // connecting to another app. |
| 34 // Return false to reject the connection entirely. | 37 // Return false to reject the connection entirely. |
| 35 virtual bool ConfigureOutgoingConnection(ApplicationConnection* connection); | 38 virtual bool ConfigureOutgoingConnection(ApplicationConnection* connection); |
| 36 | 39 |
| 37 // Called before ApplicationImpl::Terminate(). After returning from this call | 40 // Called before ApplicationImpl::Terminate(). After returning from this call |
| 38 // the delegate can no longer rely on the main run loop still running. | 41 // the delegate can no longer rely on the main run loop still running. |
| 39 virtual void Quit(); | 42 virtual void Quit(); |
| 40 | 43 |
| 41 private: | 44 private: |
| 42 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationDelegate); | 45 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationDelegate); |
| 43 }; | 46 }; |
| 44 | 47 |
| 45 } // namespace mojo | 48 } // namespace mojo |
| 46 | 49 |
| 47 #endif // MOJO_PUBLIC_APPLICATION_APPLICATION_DELEGATE_H_ | 50 #endif // MOJO_PUBLIC_APPLICATION_APPLICATION_DELEGATE_H_ |
| OLD | NEW |