Chromium Code Reviews| 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): It's ugly to call webkit_glue::SetUserAgent here, but | |
|
jam
2011/09/21 21:27:36
nit: reading this, it's not clear why is it ugly?
| |
| 18 // we need to make sure this is done before webkit_glue::GetUserAgent() | |
| 19 // is called (so that the UA doesn't change). It would be cleaner if | |
| 20 // we could replace SetContentClient() with a content::Initialize() | |
| 21 // (so that it was clear we were doing more than setting a global). | |
| 22 // Maybe we can merge this into ContentMain() somehow? | |
| 23 if (client) { | |
| 24 bool custom = false; | |
| 25 std::string ua; | |
| 26 ua = client->GetUserAgent(&custom); | |
|
Evan Martin
2011/09/21 20:27:24
can merge this with the above line, if you want
Dirk Pranke
2011/09/21 21:02:35
Will do.
| |
| 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 |