| 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 "chrome/common/chrome_content_client.h" | 5 #include "chrome/common/chrome_content_client.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 // swapped out renderers. | 360 // swapped out renderers. |
| 361 switch (msg.type()) { | 361 switch (msg.type()) { |
| 362 case ChromeViewHostMsg_Snapshot::ID: | 362 case ChromeViewHostMsg_Snapshot::ID: |
| 363 return true; | 363 return true; |
| 364 default: | 364 default: |
| 365 break; | 365 break; |
| 366 } | 366 } |
| 367 return false; | 367 return false; |
| 368 } | 368 } |
| 369 | 369 |
| 370 std::string ChromeContentClient::GetUserAgent(bool* overriding) const { | |
| 371 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUserAgent)) { | |
| 372 *overriding = true; | |
| 373 return CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | |
| 374 switches::kUserAgent); | |
| 375 } else { | |
| 376 *overriding = false; | |
| 377 chrome::VersionInfo version_info; | |
| 378 std::string product("Chrome/"); | |
| 379 product += version_info.is_valid() ? version_info.Version() : "0.0.0.0"; | |
| 380 return webkit_glue::BuildUserAgentFromProduct(product); | |
| 381 } | |
| 382 } | |
| 383 | |
| 384 string16 ChromeContentClient::GetLocalizedString(int message_id) const { | 370 string16 ChromeContentClient::GetLocalizedString(int message_id) const { |
| 385 return l10n_util::GetStringUTF16(message_id); | 371 return l10n_util::GetStringUTF16(message_id); |
| 386 } | 372 } |
| 387 | 373 |
| 388 base::StringPiece ChromeContentClient::GetDataResource(int resource_id) const { | 374 base::StringPiece ChromeContentClient::GetDataResource(int resource_id) const { |
| 389 return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); | 375 return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); |
| 390 } | 376 } |
| 391 | 377 |
| 392 #if defined(OS_WIN) | 378 #if defined(OS_WIN) |
| 393 bool ChromeContentClient::SandboxPlugin(CommandLine* command_line, | 379 bool ChromeContentClient::SandboxPlugin(CommandLine* command_line, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 DCHECK(sandbox_profile_resource_id); | 437 DCHECK(sandbox_profile_resource_id); |
| 452 if (sandbox_type == CHROME_SANDBOX_TYPE_NACL_LOADER) { | 438 if (sandbox_type == CHROME_SANDBOX_TYPE_NACL_LOADER) { |
| 453 *sandbox_profile_resource_id = IDR_NACL_SANDBOX_PROFILE; | 439 *sandbox_profile_resource_id = IDR_NACL_SANDBOX_PROFILE; |
| 454 return true; | 440 return true; |
| 455 } | 441 } |
| 456 return false; | 442 return false; |
| 457 } | 443 } |
| 458 #endif | 444 #endif |
| 459 | 445 |
| 460 } // namespace chrome | 446 } // namespace chrome |
| OLD | NEW |