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 EXTENSIONS_SHELL_APP_SHELL_MAIN_DELEGATE_H_ | 5 #ifndef EXTENSIONS_SHELL_APP_SHELL_MAIN_DELEGATE_H_ |
6 #define EXTENSIONS_SHELL_APP_SHELL_MAIN_DELEGATE_H_ | 6 #define EXTENSIONS_SHELL_APP_SHELL_MAIN_DELEGATE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> |
9 | 10 |
10 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/scoped_vector.h" | |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "content/public/app/content_main_delegate.h" | 14 #include "content/public/app/content_main_delegate.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 class ContentBrowserClient; | 17 class ContentBrowserClient; |
18 class ContentClient; | 18 class ContentClient; |
19 class ContentRendererClient; | 19 class ContentRendererClient; |
20 } | 20 } |
21 | 21 |
22 namespace extensions { | 22 namespace extensions { |
23 | 23 |
24 class ShellMainDelegate : public content::ContentMainDelegate { | 24 class ShellMainDelegate : public content::ContentMainDelegate { |
25 public: | 25 public: |
26 ShellMainDelegate(); | 26 ShellMainDelegate(); |
27 ~ShellMainDelegate() override; | 27 ~ShellMainDelegate() override; |
28 | 28 |
29 // ContentMainDelegate implementation: | 29 // ContentMainDelegate implementation: |
30 bool BasicStartupComplete(int* exit_code) override; | 30 bool BasicStartupComplete(int* exit_code) override; |
31 void PreSandboxStartup() override; | 31 void PreSandboxStartup() override; |
32 content::ContentBrowserClient* CreateContentBrowserClient() override; | 32 content::ContentBrowserClient* CreateContentBrowserClient() override; |
33 content::ContentRendererClient* CreateContentRendererClient() override; | 33 content::ContentRendererClient* CreateContentRendererClient() override; |
34 content::ContentUtilityClient* CreateContentUtilityClient() override; | 34 content::ContentUtilityClient* CreateContentUtilityClient() override; |
35 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) | 35 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
36 void ZygoteStarting( | 36 void ZygoteStarting(std::vector<std::unique_ptr<content::ZygoteForkDelegate>>* |
37 ScopedVector<content::ZygoteForkDelegate>* delegates) override; | 37 delegates) override; |
38 #endif | 38 #endif |
39 | 39 |
40 protected: | 40 protected: |
41 // The created object is owned by this object. | 41 // The created object is owned by this object. |
42 virtual content::ContentClient* CreateContentClient(); | 42 virtual content::ContentClient* CreateContentClient(); |
43 virtual content::ContentBrowserClient* CreateShellContentBrowserClient(); | 43 virtual content::ContentBrowserClient* CreateShellContentBrowserClient(); |
44 virtual content::ContentRendererClient* CreateShellContentRendererClient(); | 44 virtual content::ContentRendererClient* CreateShellContentRendererClient(); |
45 virtual content::ContentUtilityClient* CreateShellContentUtilityClient(); | 45 virtual content::ContentUtilityClient* CreateShellContentUtilityClient(); |
46 | 46 |
47 // Initializes the resource bundle and resources.pak. | 47 // Initializes the resource bundle and resources.pak. |
48 virtual void InitializeResourceBundle(); | 48 virtual void InitializeResourceBundle(); |
49 | 49 |
50 private: | 50 private: |
51 // |process_type| is zygote, renderer, utility, etc. Returns true if the | 51 // |process_type| is zygote, renderer, utility, etc. Returns true if the |
52 // process needs data from resources.pak. | 52 // process needs data from resources.pak. |
53 static bool ProcessNeedsResourceBundle(const std::string& process_type); | 53 static bool ProcessNeedsResourceBundle(const std::string& process_type); |
54 | 54 |
55 std::unique_ptr<content::ContentClient> content_client_; | 55 std::unique_ptr<content::ContentClient> content_client_; |
56 std::unique_ptr<content::ContentBrowserClient> browser_client_; | 56 std::unique_ptr<content::ContentBrowserClient> browser_client_; |
57 std::unique_ptr<content::ContentRendererClient> renderer_client_; | 57 std::unique_ptr<content::ContentRendererClient> renderer_client_; |
58 std::unique_ptr<content::ContentUtilityClient> utility_client_; | 58 std::unique_ptr<content::ContentUtilityClient> utility_client_; |
59 | 59 |
60 DISALLOW_COPY_AND_ASSIGN(ShellMainDelegate); | 60 DISALLOW_COPY_AND_ASSIGN(ShellMainDelegate); |
61 }; | 61 }; |
62 | 62 |
63 } // namespace extensions | 63 } // namespace extensions |
64 | 64 |
65 #endif // EXTENSIONS_SHELL_APP_SHELL_MAIN_DELEGATE_H_ | 65 #endif // EXTENSIONS_SHELL_APP_SHELL_MAIN_DELEGATE_H_ |
OLD | NEW |