15f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved.
25d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// found in the LICENSE file.
45d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
55f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#ifndef EXTENSIONS_SHELL_APP_SHELL_MAIN_DELEGATE_H_
65f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#define EXTENSIONS_SHELL_APP_SHELL_MAIN_DELEGATE_H_
75d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
85d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "base/compiler_specific.h"
95d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "base/memory/scoped_ptr.h"
105d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "content/public/app/content_main_delegate.h"
115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
12cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)namespace content {
13cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)class BrowserContext;
14cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)class ContentBrowserClient;
15cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)class ContentClient;
16cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)class ContentRendererClient;
17cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)}
185d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
195f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)namespace extensions {
20cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)class ShellBrowserMainDelegate;
215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class ShellMainDelegate : public content::ContentMainDelegate {
235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) public:
245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  ShellMainDelegate();
255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual ~ShellMainDelegate();
265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // ContentMainDelegate implementation:
285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual bool BasicStartupComplete(int* exit_code) OVERRIDE;
295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual void PreSandboxStartup() OVERRIDE;
305d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual content::ContentBrowserClient* CreateContentBrowserClient() OVERRIDE;
315d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual content::ContentRendererClient* CreateContentRendererClient()
325d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      OVERRIDE;
331320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
3403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)  virtual void ZygoteStarting(
3503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)      ScopedVector<content::ZygoteForkDelegate>* delegates) OVERRIDE;
361320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#endif
375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
38cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) protected:
39116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  // The created object is owned by this object.
4003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)  virtual content::ContentClient* CreateContentClient();
41116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  virtual content::ContentBrowserClient* CreateShellContentBrowserClient();
4203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)  virtual content::ContentRendererClient* CreateShellContentRendererClient();
43f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)
44116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  // Initializes the resource bundle and resources.pak.
45116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  virtual void InitializeResourceBundle();
46116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
475d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) private:
485d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // |process_type| is zygote, renderer, utility, etc. Returns true if the
495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // process needs data from resources.pak.
505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  static bool ProcessNeedsResourceBundle(const std::string& process_type);
515d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
52cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  scoped_ptr<content::ContentClient> content_client_;
53cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  scoped_ptr<content::ContentBrowserClient> browser_client_;
54cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  scoped_ptr<content::ContentRendererClient> renderer_client_;
555d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
565d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(ShellMainDelegate);
575d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)};
585d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
595f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)}  // namespace extensions
605d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
615f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#endif  // EXTENSIONS_SHELL_APP_SHELL_MAIN_DELEGATE_H_
62