| Index: content/public/common/content_client.cc
|
| diff --git a/content/public/common/content_client.cc b/content/public/common/content_client.cc
|
| index 9558e2ddd700566e0593dbc85c6afe1031c50758..18b207ed9c255d686d74c95dc31a1e2787709cc8 100644
|
| --- a/content/public/common/content_client.cc
|
| +++ b/content/public/common/content_client.cc
|
| @@ -6,6 +6,7 @@
|
|
|
| #include "base/logging.h"
|
| #include "base/string_piece.h"
|
| +#include "base/string_util.h"
|
| #include "webkit/glue/webkit_glue.h"
|
| #include "webkit/plugins/ppapi/host_globals.h"
|
|
|
| @@ -13,24 +14,20 @@ namespace content {
|
|
|
| static ContentClient* g_client;
|
|
|
| -void SetContentClient(ContentClient* client) {
|
| +void Initialize(ContentClient* client, const std::string& user_agent) {
|
| + DCHECK(client);
|
| g_client = client;
|
| + webkit_glue::SetUserAgent(user_agent, false);
|
| +}
|
|
|
| - // TODO(dpranke): Doing real work (calling webkit_glue::SetUserAgent)
|
| - // inside what looks like a function that initializes a global is a
|
| - // bit odd, but we need to make sure this is done before
|
| - // webkit_glue::GetUserAgent() is called (so that the UA doesn't change).
|
| - //
|
| - // It would be cleaner if we could rename this to something like a
|
| - // content::Initialize(). Maybe we can merge this into ContentMain() somehow?
|
| - if (client) {
|
| - bool custom = false;
|
| - std::string ua = client->GetUserAgent(&custom);
|
| - webkit_glue::SetUserAgent(ua, custom);
|
| - }
|
| +void Uninitialize() {
|
| + DCHECK(g_client);
|
| + g_client = NULL;
|
| + webkit_glue::SetUserAgent(EmptyString(), false);
|
| }
|
|
|
| ContentClient* GetContentClient() {
|
| + DCHECK(g_client);
|
| return g_client;
|
| }
|
|
|
|
|