| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/public/common/content_client.h" | 5 #include "content/public/common/content_client.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_piece.h" | 8 #include "base/string_piece.h" |
| 9 #include "ui/gfx/image/image.h" | 9 #include "ui/gfx/image/image.h" |
| 10 #include "webkit/user_agent/user_agent.h" |
| 11 |
| 12 #if !defined(OS_IOS) |
| 10 #include "webkit/plugins/ppapi/host_globals.h" | 13 #include "webkit/plugins/ppapi/host_globals.h" |
| 11 #include "webkit/user_agent/user_agent.h" | 14 #endif |
| 12 | 15 |
| 13 namespace content { | 16 namespace content { |
| 14 | 17 |
| 15 static ContentClient* g_client; | 18 static ContentClient* g_client; |
| 16 | 19 |
| 17 void SetContentClient(ContentClient* client) { | 20 void SetContentClient(ContentClient* client) { |
| 18 g_client = client; | 21 g_client = client; |
| 19 | 22 |
| 20 // Set the default user agent as provided by the client. We need to make | 23 // Set the default user agent as provided by the client. We need to make |
| 21 // sure this is done before webkit_glue::GetUserAgent() is called (so that | 24 // sure this is done before webkit_glue::GetUserAgent() is called (so that |
| 22 // the UA doesn't change). | 25 // the UA doesn't change). |
| 23 if (client) { | 26 if (client) { |
| 24 webkit_glue::SetUserAgent(client->GetUserAgent(), false); | 27 webkit_glue::SetUserAgent(client->GetUserAgent(), false); |
| 25 } | 28 } |
| 26 } | 29 } |
| 27 | 30 |
| 28 ContentClient* GetContentClient() { | 31 ContentClient* GetContentClient() { |
| 29 return g_client; | 32 return g_client; |
| 30 } | 33 } |
| 31 | 34 |
| 32 const std::string& GetUserAgent(const GURL& url) { | 35 const std::string& GetUserAgent(const GURL& url) { |
| 33 DCHECK(g_client); | 36 DCHECK(g_client); |
| 34 return webkit_glue::GetUserAgent(url); | 37 return webkit_glue::GetUserAgent(url); |
| 35 } | 38 } |
| 36 | 39 |
| 37 webkit::ppapi::HostGlobals* GetHostGlobals() { | 40 webkit::ppapi::HostGlobals* GetHostGlobals() { |
| 41 #if defined(OS_IOS) |
| 42 return NULL; |
| 43 #else |
| 38 return webkit::ppapi::HostGlobals::Get(); | 44 return webkit::ppapi::HostGlobals::Get(); |
| 45 #endif |
| 39 } | 46 } |
| 40 | 47 |
| 41 ContentClient::ContentClient() | 48 ContentClient::ContentClient() |
| 42 : browser_(NULL), plugin_(NULL), renderer_(NULL), utility_(NULL) { | 49 : browser_(NULL), plugin_(NULL), renderer_(NULL), utility_(NULL) { |
| 43 } | 50 } |
| 44 | 51 |
| 45 ContentClient::~ContentClient() { | 52 ContentClient::~ContentClient() { |
| 46 } | 53 } |
| 47 | 54 |
| 48 bool ContentClient::HasWebUIScheme(const GURL& url) const { | 55 bool ContentClient::HasWebUIScheme(const GURL& url) const { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 int* sandbox_profile_resource_id) const { | 96 int* sandbox_profile_resource_id) const { |
| 90 return false; | 97 return false; |
| 91 } | 98 } |
| 92 | 99 |
| 93 std::string ContentClient::GetCarbonInterposePath() const { | 100 std::string ContentClient::GetCarbonInterposePath() const { |
| 94 return std::string(); | 101 return std::string(); |
| 95 } | 102 } |
| 96 #endif | 103 #endif |
| 97 | 104 |
| 98 } // namespace content | 105 } // namespace content |
| OLD | NEW |