Refactor management of overview window copy lifetime into a separate class.
[chromium-blink-merge.git] / content / shell / browser / shell_content_browser_client.h
blobeb7bbe581baf525d2f0b95361ac94db657cd1332
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.
5 #ifndef CONTENT_SHELL_BROWSER_SHELL_CONTENT_BROWSER_CLIENT_H_
6 #define CONTENT_SHELL_BROWSER_SHELL_CONTENT_BROWSER_CLIENT_H_
8 #include <string>
10 #include "base/compiler_specific.h"
11 #include "base/files/file_path.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/platform_file.h"
14 #include "content/public/browser/content_browser_client.h"
15 #include "content/public/browser/notification_observer.h"
16 #include "content/public/browser/notification_registrar.h"
17 #include "content/shell/browser/shell_speech_recognition_manager_delegate.h"
19 namespace content {
21 class ShellBrowserContext;
22 class ShellBrowserMainParts;
23 class ShellResourceDispatcherHostDelegate;
25 class ShellContentBrowserClient : public ContentBrowserClient,
26 public NotificationObserver {
27 public:
28 // Gets the current instance.
29 static ShellContentBrowserClient* Get();
31 static void SetSwapProcessesForRedirect(bool swap);
33 ShellContentBrowserClient();
34 virtual ~ShellContentBrowserClient();
36 // ContentBrowserClient overrides.
37 virtual BrowserMainParts* CreateBrowserMainParts(
38 const MainFunctionParams& parameters) OVERRIDE;
39 virtual void RenderProcessHostCreated(RenderProcessHost* host) OVERRIDE;
40 virtual net::URLRequestContextGetter* CreateRequestContext(
41 BrowserContext* browser_context,
42 ProtocolHandlerMap* protocol_handlers) OVERRIDE;
43 virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
44 BrowserContext* browser_context,
45 const base::FilePath& partition_path,
46 bool in_memory,
47 ProtocolHandlerMap* protocol_handlers) OVERRIDE;
48 virtual bool IsHandledURL(const GURL& url) OVERRIDE;
49 virtual void AppendExtraCommandLineSwitches(CommandLine* command_line,
50 int child_process_id) OVERRIDE;
51 virtual void OverrideWebkitPrefs(RenderViewHost* render_view_host,
52 const GURL& url,
53 WebPreferences* prefs) OVERRIDE;
54 virtual void ResourceDispatcherHostCreated() OVERRIDE;
55 virtual AccessTokenStore* CreateAccessTokenStore() OVERRIDE;
56 virtual std::string GetDefaultDownloadName() OVERRIDE;
57 virtual bool SupportsBrowserPlugin(content::BrowserContext* browser_context,
58 const GURL& url) OVERRIDE;
59 virtual WebContentsViewDelegate* GetWebContentsViewDelegate(
60 WebContents* web_contents) OVERRIDE;
61 virtual QuotaPermissionContext* CreateQuotaPermissionContext() OVERRIDE;
62 virtual SpeechRecognitionManagerDelegate*
63 GetSpeechRecognitionManagerDelegate() OVERRIDE;
64 virtual net::NetLog* GetNetLog() OVERRIDE;
65 virtual bool ShouldSwapProcessesForRedirect(ResourceContext* resource_context,
66 const GURL& current_url,
67 const GURL& new_url) OVERRIDE;
69 #if defined(OS_POSIX) && !defined(OS_MACOSX)
70 virtual void GetAdditionalMappedFilesForChildProcess(
71 const CommandLine& command_line,
72 int child_process_id,
73 std::vector<content::FileDescriptorInfo>* mappings) OVERRIDE;
74 #endif
76 // NotificationObserver implementation.
77 virtual void Observe(int type,
78 const NotificationSource& source,
79 const NotificationDetails& details) OVERRIDE;
81 ShellBrowserContext* browser_context();
82 ShellBrowserContext* off_the_record_browser_context();
83 ShellResourceDispatcherHostDelegate* resource_dispatcher_host_delegate() {
84 return resource_dispatcher_host_delegate_.get();
86 ShellBrowserMainParts* shell_browser_main_parts() {
87 return shell_browser_main_parts_;
90 private:
91 ShellBrowserContext* ShellBrowserContextForBrowserContext(
92 BrowserContext* content_browser_context);
94 scoped_ptr<ShellResourceDispatcherHostDelegate>
95 resource_dispatcher_host_delegate_;
97 base::FilePath webkit_source_dir_;
99 ShellBrowserMainParts* shell_browser_main_parts_;
101 NotificationRegistrar registrar_;
104 } // namespace content
106 #endif // CONTENT_SHELL_BROWSER_SHELL_CONTENT_BROWSER_CLIENT_H_