1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_CONTENT_BROWSER_CLIENT_H_
#define CONTENT_BROWSER_CONTENT_BROWSER_CLIENT_H_
#pragma once
#include <string>
#include "content/common/content_client.h"
class BrowserRenderProcessHost;
class CommandLine;
class GURL;
class Profile;
class RenderViewHost;
class TabContents;
class WorkerProcessHost;
namespace net {
class CookieList;
class CookieOptions;
}
namespace content {
class ResourceContext;
class WebUIFactory;
// Embedder API for participating in browser logic.
class ContentBrowserClient {
public:
// Notifies that a new RenderHostView has been created.
virtual void RenderViewHostCreated(RenderViewHost* render_view_host);
// Initialize a RenderViewHost before its CreateRenderView method is called.
virtual void PreCreateRenderView(RenderViewHost* render_view_host,
Profile* profile,
const GURL& url);
// Notifies that a BrowserRenderProcessHost has been created. This is called
// before the content layer adds its own BrowserMessageFilters, so that the
// embedder's IPC filters have priority.
virtual void BrowserRenderProcessHostCreated(BrowserRenderProcessHost* host);
// Notifies that a WorkerProcessHost has been created.
virtual void WorkerProcessHostCreated(WorkerProcessHost* host);
// Gets the WebUIFactory which will be responsible for generating WebUIs.
virtual WebUIFactory* GetWebUIFactory();
// Get the effective URL for the given actual URL, to allow an embedder to
// group different url schemes in the same SiteInstance.
virtual GURL GetEffectiveURL(Profile* profile, const GURL& url);
// See RenderViewHostDelegate's comment.
virtual GURL GetAlternateErrorPageURL(const TabContents* tab);
// See CharacterEncoding's comment.
virtual std::string GetCanonicalEncodingNameByAliasName(
const std::string& alias_name);
// Allows the embedder to pass extra command line flags.
// switches::kProcessType will already be set at this point.
virtual void AppendExtraCommandLineSwitches(CommandLine* command_line,
int child_process_id);
// Returns the locale used by the application.
virtual std::string GetApplicationLocale();
// Allow the embedder to control if an AppCache can be used for the given url.
// This is called on the IO thread.
virtual bool AllowAppCache(const GURL& manifest_url,
const content::ResourceContext& context);
// Allow the embedder to control if the given cookie can be read.
// This is called on the IO thread.
virtual bool AllowGetCookie(const GURL& url,
const GURL& first_party,
const net::CookieList& cookie_list,
const content::ResourceContext& context,
int render_process_id,
int render_view_id);
// Allow the embedder to control if the given cookie can be set.
// This is called on the IO thread.
virtual bool AllowSetCookie(const GURL& url,
const GURL& first_party,
const std::string& cookie_line,
const content::ResourceContext& context,
int render_process_id,
int render_view_id,
net::CookieOptions* options);
#if defined(OS_LINUX)
// Can return an optional fd for crash handling, otherwise returns -1.
virtual int GetCrashSignalFD(const std::string& process_type);
#endif
};
} // namespace content
#endif // CONTENT_BROWSER_CONTENT_BROWSER_CLIENT_H_
|