| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "content/common/content_client.h" | 5 #include "content/common/content_client.h" |
| 6 | 6 |
| 7 #include "base/string_piece.h" | 7 #include "base/string_piece.h" |
| 8 #include "webkit/glue/webkit_glue.h" | |
| 9 | 8 |
| 10 namespace content { | 9 namespace content { |
| 11 | 10 |
| 12 static ContentClient* g_client; | 11 static ContentClient* g_client; |
| 13 | 12 |
| 14 void SetContentClient(ContentClient* client) { | 13 void SetContentClient(ContentClient* client) { |
| 15 g_client = client; | 14 g_client = client; |
| 16 | |
| 17 // TODO(dpranke): Doing real work (calling webkit_glue::SetUserAgent) | |
| 18 // inside what looks like a function that initializes a global is a | |
| 19 // bit odd, but we need to make sure this is done before | |
| 20 // webkit_glue::GetUserAgent() is called (so that the UA doesn't change). | |
| 21 // | |
| 22 // It would be cleaner if we could rename this to something like a | |
| 23 // content::Initialize(). Maybe we can merge this into ContentMain() somehow? | |
| 24 if (client) { | |
| 25 bool custom = false; | |
| 26 std::string ua = client->GetUserAgent(&custom); | |
| 27 webkit_glue::SetUserAgent(ua, custom); | |
| 28 } | |
| 29 } | 15 } |
| 30 | 16 |
| 31 ContentClient* GetContentClient() { | 17 ContentClient* GetContentClient() { |
| 32 return g_client; | 18 return g_client; |
| 33 } | 19 } |
| 34 | 20 |
| 35 ContentClient::ContentClient() | 21 ContentClient::ContentClient() |
| 36 : browser_(NULL), plugin_(NULL), renderer_(NULL), utility_(NULL) { | 22 : browser_(NULL), plugin_(NULL), renderer_(NULL), utility_(NULL) { |
| 37 } | 23 } |
| 38 | 24 |
| 39 ContentClient::~ContentClient() { | 25 ContentClient::~ContentClient() { |
| 40 } | 26 } |
| 41 | 27 |
| 42 } // namespace content | 28 } // namespace content |
| OLD | NEW |