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

Side by Side Diff: content/common/content_client.cc

Issue 8002003: Revert "Remove webkit_glue::BuildUserAgent(), change the contract in webkit_glue" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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
« no previous file with comments | « content/common/content_client.h ('k') | content/renderer/renderer_glue.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
OLDNEW
« no previous file with comments | « content/common/content_client.h ('k') | content/renderer/renderer_glue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698