| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 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 CONTENT_APP_CONTENT_MAIN_DELEGATE_H_ | |
| 6 #define CONTENT_APP_CONTENT_MAIN_DELEGATE_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <string> | |
| 10 | |
| 11 #include "build/build_config.h" | |
| 12 #include "content/common/content_export.h" | |
| 13 | |
| 14 struct MainFunctionParams; | |
| 15 class ZygoteForkDelegate; | |
| 16 | |
| 17 namespace content { | |
| 18 | |
| 19 class CONTENT_EXPORT ContentMainDelegate { | |
| 20 public: | |
| 21 virtual ~ContentMainDelegate(); | |
| 22 | |
| 23 // Tells the embedder that the absolute basic startup has been done, i.e. it's | |
| 24 // now safe to create singletons and check the command line. Return true if | |
| 25 // the process should exit afterwards, and if so, |exit_code| should be set. | |
| 26 // This is the place for embedder to do the things that must happen at the | |
| 27 // start. Most of its startup code should be in the methods below. | |
| 28 virtual bool BasicStartupComplete(int* exit_code); | |
| 29 | |
| 30 // This is where the embedder puts all of its startup code that needs to run | |
| 31 // before the sandbox is engaged. | |
| 32 virtual void PreSandboxStartup(); | |
| 33 | |
| 34 // This is where the embedder can add startup code to run after the sandbox | |
| 35 // has been initialized. | |
| 36 virtual void SandboxInitialized(const std::string& process_type); | |
| 37 | |
| 38 // Asks the embedder to start a process that content doesn't know about. | |
| 39 virtual int RunProcess(const std::string& process_type, | |
| 40 const MainFunctionParams& main_function_params); | |
| 41 | |
| 42 // Called right before the process exits. | |
| 43 virtual void ProcessExiting(const std::string& process_type); | |
| 44 | |
| 45 #if defined(OS_MACOSX) | |
| 46 // Returns true if the process registers with the system monitor, so that we | |
| 47 // can allocate an IO port for it before the sandbox is initialized. Embedders | |
| 48 // are called only for process types that content doesn't know about. | |
| 49 virtual bool ProcessRegistersWithSystemProcess( | |
| 50 const std::string& process_type); | |
| 51 | |
| 52 // Used to determine if we should send the mach port to the parent process or | |
| 53 // not. The embedder usually sends it for all child processes, use this to | |
| 54 // override this behavior. | |
| 55 virtual bool ShouldSendMachPort(const std::string& process_type); | |
| 56 | |
| 57 // Allows the embedder to override initializing the sandbox. This is needed | |
| 58 // because some processes might not want to enable it right away or might not | |
| 59 // want it at all. | |
| 60 virtual bool DelaySandboxInitialization(const std::string& process_type); | |
| 61 | |
| 62 #elif defined(OS_POSIX) | |
| 63 // Tells the embedder that the zygote process is starting, and allows it to | |
| 64 // specify a zygote delegate if it wishes. | |
| 65 virtual ZygoteForkDelegate* ZygoteStarting(); | |
| 66 | |
| 67 // Called every time the zygote process forks. | |
| 68 virtual void ZygoteForked(); | |
| 69 #endif // OS_MACOSX | |
| 70 }; | |
| 71 | |
| 72 } // namespace content | |
| 73 | |
| 74 #endif // CONTENT_APP_CONTENT_MAIN_DELEGATE_H_ | |
| OLD | NEW |