1// Copyright 2013 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_SHELL_BROWSER_SHELL_BROWSER_MAIN_PARTS_H_
6#define CONTENT_SHELL_BROWSER_SHELL_BROWSER_MAIN_PARTS_H_
7
8#include "base/basictypes.h"
9#include "base/memory/scoped_ptr.h"
10#include "content/public/browser/browser_main_parts.h"
11#include "content/public/common/main_function_params.h"
12
13#if defined(OS_ANDROID)
14namespace breakpad {
15class CrashDumpManager;
16}
17#endif
18
19namespace base {
20class Thread;
21}
22
23namespace net {
24class NetLog;
25}
26
27namespace content {
28
29class ShellBrowserContext;
30class ShellDevToolsDelegate;
31class ShellPluginServiceFilter;
32
33class ShellBrowserMainParts : public BrowserMainParts {
34 public:
35  explicit ShellBrowserMainParts(const MainFunctionParams& parameters);
36  virtual ~ShellBrowserMainParts();
37
38  // BrowserMainParts overrides.
39  virtual void PreEarlyInitialization() OVERRIDE;
40  virtual void PreMainMessageLoopStart() OVERRIDE;
41  virtual void PostMainMessageLoopStart() OVERRIDE;
42  virtual void PreMainMessageLoopRun() OVERRIDE;
43  virtual bool MainMessageLoopRun(int* result_code) OVERRIDE;
44  virtual void PostMainMessageLoopRun() OVERRIDE;
45
46  ShellDevToolsDelegate* devtools_delegate() {
47    return devtools_delegate_.get();
48  }
49
50  ShellBrowserContext* browser_context() { return browser_context_.get(); }
51  ShellBrowserContext* off_the_record_browser_context() {
52    return off_the_record_browser_context_.get();
53  }
54
55  net::NetLog* net_log() { return net_log_.get(); }
56
57 private:
58#if defined(OS_ANDROID)
59  scoped_ptr<breakpad::CrashDumpManager> crash_dump_manager_;
60#endif
61  scoped_ptr<net::NetLog> net_log_;
62  scoped_ptr<ShellBrowserContext> browser_context_;
63  scoped_ptr<ShellBrowserContext> off_the_record_browser_context_;
64
65  // For running content_browsertests.
66  const MainFunctionParams parameters_;
67  bool run_message_loop_;
68
69  scoped_ptr<ShellDevToolsDelegate> devtools_delegate_;
70#if defined(ENABLE_PLUGINS)
71  scoped_ptr<ShellPluginServiceFilter> plugin_service_filter_;
72#endif
73
74  DISALLOW_COPY_AND_ASSIGN(ShellBrowserMainParts);
75};
76
77}  // namespace content
78
79#endif  // CONTENT_SHELL_BROWSER_SHELL_BROWSER_MAIN_PARTS_H_
80