Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: content/public/common/content_client.h

Issue 9623027: Move --user-agent overriding logic from chrome into content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: replace SetContentClient() with Initialize() Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_PUBLIC_COMMON_CONTENT_CLIENT_H_ 5 #ifndef CONTENT_PUBLIC_COMMON_CONTENT_CLIENT_H_
6 #define CONTENT_PUBLIC_COMMON_CONTENT_CLIENT_H_ 6 #define CONTENT_PUBLIC_COMMON_CONTENT_CLIENT_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 28 matching lines...) Expand all
39 namespace content { 39 namespace content {
40 40
41 class ContentBrowserClient; 41 class ContentBrowserClient;
42 class ContentClient; 42 class ContentClient;
43 class ContentPluginClient; 43 class ContentPluginClient;
44 class ContentRendererClient; 44 class ContentRendererClient;
45 class ContentUtilityClient; 45 class ContentUtilityClient;
46 struct GPUInfo; 46 struct GPUInfo;
47 struct PepperPluginInfo; 47 struct PepperPluginInfo;
48 48
49 // Setter and getter for the client. The client should be set early, before any 49 // Initializes the browser with a client and user agent string. This method
50 // content code is called. 50 // should be called early on before any other content code is called.
51 CONTENT_EXPORT void SetContentClient(ContentClient* client); 51 CONTENT_EXPORT void Initialize(ContentClient* client,
52 const std::string& user_agent);
53
54 // Uninitializes the browser by removing its reference to the client and
55 // resetting the user agent.
56 CONTENT_EXPORT void Uninitialize();
57
58 // Returns the client being used by the browser. Initialize() must be called
59 // prior to calling this method.
52 CONTENT_EXPORT ContentClient* GetContentClient(); 60 CONTENT_EXPORT ContentClient* GetContentClient();
53 61
54 // Returns the user agent string being used by the browser. SetContentClient() 62 // Returns the user agent string being used by the browser. Initialize() must
55 // must be called prior to calling this, and this routine must be used 63 // be called prior to calling this method.
56 // instead of webkit_glue::GetUserAgent() in order to ensure that we use 64 //
57 // the same user agent string everywhere. 65 // This routine must be used instead of webkit_glue::GetUserAgent() in order to
66 // ensure that we use the same user agent string everywhere.
67 //
58 // TODO(dpranke): This is caused by webkit_glue being a library that can 68 // TODO(dpranke): This is caused by webkit_glue being a library that can
59 // get linked into multiple linkable objects, causing us to have multiple 69 // get linked into multiple linkable objects, causing us to have multiple
60 // static values of the user agent. This will be fixed when we clean up 70 // static values of the user agent. This will be fixed when we clean up
61 // webkit_glue. 71 // webkit_glue.
62 CONTENT_EXPORT const std::string& GetUserAgent(const GURL& url); 72 CONTENT_EXPORT const std::string& GetUserAgent(const GURL& url);
63 73
64 // Returns the PPAPI global singleton. See webkit/plugins/ppapi/host_globals.h 74 // Returns the PPAPI global singleton. See webkit/plugins/ppapi/host_globals.h
65 // TODO(dpranke): Also needed since webkit_glue is a library. 75 // TODO(dpranke): Also needed since webkit_glue is a library.
66 CONTENT_EXPORT webkit::ppapi::HostGlobals* GetHostGlobals(); 76 CONTENT_EXPORT webkit::ppapi::HostGlobals* GetHostGlobals();
67 77
(...skipping 27 matching lines...) Expand all
95 webkit::npapi::PluginList* plugin_list) = 0; 105 webkit::npapi::PluginList* plugin_list) = 0;
96 106
97 // Returns true if the url has a scheme for WebUI. See also 107 // Returns true if the url has a scheme for WebUI. See also
98 // WebUIControllerFactory::UseWebUIForURL in the browser process. 108 // WebUIControllerFactory::UseWebUIForURL in the browser process.
99 virtual bool HasWebUIScheme(const GURL& url) const = 0; 109 virtual bool HasWebUIScheme(const GURL& url) const = 0;
100 110
101 // Returns whether the given message should be processed in the browser on 111 // Returns whether the given message should be processed in the browser on
102 // behalf of a swapped out renderer. 112 // behalf of a swapped out renderer.
103 virtual bool CanHandleWhileSwappedOut(const IPC::Message& msg) = 0; 113 virtual bool CanHandleWhileSwappedOut(const IPC::Message& msg) = 0;
104 114
105 // Returns the user agent and a flag indicating whether the returned
106 // string should always be used (if false, callers may override the
107 // value as needed to work around various user agent sniffing bugs).
108 virtual std::string GetUserAgent(bool *overriding) const = 0;
109
110 // Returns a string resource given its id. 115 // Returns a string resource given its id.
111 virtual string16 GetLocalizedString(int message_id) const = 0; 116 virtual string16 GetLocalizedString(int message_id) const = 0;
112 117
113 // Return the contents of a resource in a StringPiece given the resource id. 118 // Return the contents of a resource in a StringPiece given the resource id.
114 virtual base::StringPiece GetDataResource(int resource_id) const = 0; 119 virtual base::StringPiece GetDataResource(int resource_id) const = 0;
115 120
116 #if defined(OS_WIN) 121 #if defined(OS_WIN)
117 // Allows the embedder to sandbox a plugin, and apply a custom policy. 122 // Allows the embedder to sandbox a plugin, and apply a custom policy.
118 virtual bool SandboxPlugin(CommandLine* command_line, 123 virtual bool SandboxPlugin(CommandLine* command_line,
119 sandbox::TargetPolicy* policy) = 0; 124 sandbox::TargetPolicy* policy) = 0;
(...skipping 19 matching lines...) Expand all
139 ContentPluginClient* plugin_; 144 ContentPluginClient* plugin_;
140 // The embedder API for participating in renderer logic. 145 // The embedder API for participating in renderer logic.
141 ContentRendererClient* renderer_; 146 ContentRendererClient* renderer_;
142 // The embedder API for participating in utility logic. 147 // The embedder API for participating in utility logic.
143 ContentUtilityClient* utility_; 148 ContentUtilityClient* utility_;
144 }; 149 };
145 150
146 } // namespace content 151 } // namespace content
147 152
148 #endif // CONTENT_PUBLIC_COMMON_CONTENT_CLIENT_H_ 153 #endif // CONTENT_PUBLIC_COMMON_CONTENT_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698