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" |
8 | 9 |
9 namespace content { | 10 namespace content { |
10 | 11 |
11 static ContentClient* g_client; | 12 static ContentClient* g_client; |
12 | 13 |
13 void SetContentClient(ContentClient* client) { | 14 void SetContentClient(ContentClient* client) { |
14 g_client = client; | 15 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 } |
15 } | 29 } |
16 | 30 |
17 ContentClient* GetContentClient() { | 31 ContentClient* GetContentClient() { |
18 return g_client; | 32 return g_client; |
19 } | 33 } |
20 | 34 |
21 ContentClient::ContentClient() | 35 ContentClient::ContentClient() |
22 : browser_(NULL), plugin_(NULL), renderer_(NULL), utility_(NULL) { | 36 : browser_(NULL), plugin_(NULL), renderer_(NULL), utility_(NULL) { |
23 } | 37 } |
24 | 38 |
25 ContentClient::~ContentClient() { | 39 ContentClient::~ContentClient() { |
26 } | 40 } |
27 | 41 |
28 } // namespace content | 42 } // namespace content |
OLD | NEW |