| OLD | NEW | 
|---|
|  | (Empty) | 
| 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 |  | 
| 3 // found in the LICENSE file. |  | 
| 4 |  | 
| 5 #ifndef MOJO_SHELL_PUBLIC_CPP_APPLICATION_DELEGATE_H_ |  | 
| 6 #define MOJO_SHELL_PUBLIC_CPP_APPLICATION_DELEGATE_H_ |  | 
| 7 |  | 
| 8 #include <stdint.h> |  | 
| 9 #include <string> |  | 
| 10 |  | 
| 11 #include "mojo/public/cpp/system/macros.h" |  | 
| 12 |  | 
| 13 namespace mojo { |  | 
| 14 |  | 
| 15 class ApplicationConnection; |  | 
| 16 class ApplicationImpl; |  | 
| 17 class Shell; |  | 
| 18 |  | 
| 19 // An abstract class that the application may subclass to control various |  | 
| 20 // behaviors of ApplicationImpl. |  | 
| 21 class ApplicationDelegate { |  | 
| 22  public: |  | 
| 23   ApplicationDelegate(); |  | 
| 24   virtual ~ApplicationDelegate(); |  | 
| 25 |  | 
| 26   // Called exactly once before any other method. |  | 
| 27   virtual void Initialize(Shell* app, const std::string& url, uint32_t id); |  | 
| 28 |  | 
| 29   // Override this method to configure what services a connection supports when |  | 
| 30   // being connected to from an app. |  | 
| 31   // Return false to reject the connection entirely. |  | 
| 32   virtual bool AcceptConnection(ApplicationConnection* connection); |  | 
| 33 |  | 
| 34   // Called when the shell connection has a connection error. |  | 
| 35   // |  | 
| 36   // Return true to shutdown the application. Return false to skip shutting |  | 
| 37   // down the connection, but user is then required to call |  | 
| 38   // ApplicationImpl::QuitNow() when done. |  | 
| 39   virtual bool ShellConnectionLost(); |  | 
| 40 |  | 
| 41   // Called before ApplicationImpl::Terminate(). After returning from this call |  | 
| 42   // the delegate can no longer rely on the main run loop still running. |  | 
| 43   virtual void Quit(); |  | 
| 44 |  | 
| 45  private: |  | 
| 46   MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationDelegate); |  | 
| 47 }; |  | 
| 48 |  | 
| 49 }  // namespace mojo |  | 
| 50 |  | 
| 51 #endif  // MOJO_SHELL_PUBLIC_CPP_APPLICATION_DELEGATE_H_ |  | 
| OLD | NEW | 
|---|