| 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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 // swapped out renderers. | 352 // swapped out renderers. |
| 353 switch (msg.type()) { | 353 switch (msg.type()) { |
| 354 case ChromeViewHostMsg_Snapshot::ID: | 354 case ChromeViewHostMsg_Snapshot::ID: |
| 355 return true; | 355 return true; |
| 356 default: | 356 default: |
| 357 break; | 357 break; |
| 358 } | 358 } |
| 359 return false; | 359 return false; |
| 360 } | 360 } |
| 361 | 361 |
| 362 std::string ChromeContentClient::GetUserAgent(bool* overriding) const { | 362 std::string ChromeContentClient::GetUserAgent() const { |
| 363 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUserAgent)) { | 363 chrome::VersionInfo version_info; |
| 364 *overriding = true; | 364 std::string product("Chrome/"); |
| 365 return CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 365 product += version_info.is_valid() ? version_info.Version() : "0.0.0.0"; |
| 366 switches::kUserAgent); | 366 return webkit_glue::BuildUserAgentFromProduct(product); |
| 367 } else { | |
| 368 *overriding = false; | |
| 369 chrome::VersionInfo version_info; | |
| 370 std::string product("Chrome/"); | |
| 371 product += version_info.is_valid() ? version_info.Version() : "0.0.0.0"; | |
| 372 return webkit_glue::BuildUserAgentFromProduct(product); | |
| 373 } | |
| 374 } | 367 } |
| 375 | 368 |
| 376 string16 ChromeContentClient::GetLocalizedString(int message_id) const { | 369 string16 ChromeContentClient::GetLocalizedString(int message_id) const { |
| 377 return l10n_util::GetStringUTF16(message_id); | 370 return l10n_util::GetStringUTF16(message_id); |
| 378 } | 371 } |
| 379 | 372 |
| 380 base::StringPiece ChromeContentClient::GetDataResource(int resource_id) const { | 373 base::StringPiece ChromeContentClient::GetDataResource(int resource_id) const { |
| 381 return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); | 374 return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); |
| 382 } | 375 } |
| 383 | 376 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 DCHECK(sandbox_profile_resource_id); | 462 DCHECK(sandbox_profile_resource_id); |
| 470 if (sandbox_type == CHROME_SANDBOX_TYPE_NACL_LOADER) { | 463 if (sandbox_type == CHROME_SANDBOX_TYPE_NACL_LOADER) { |
| 471 *sandbox_profile_resource_id = IDR_NACL_SANDBOX_PROFILE; | 464 *sandbox_profile_resource_id = IDR_NACL_SANDBOX_PROFILE; |
| 472 return true; | 465 return true; |
| 473 } | 466 } |
| 474 return false; | 467 return false; |
| 475 } | 468 } |
| 476 #endif | 469 #endif |
| 477 | 470 |
| 478 } // namespace chrome | 471 } // namespace chrome |
| OLD | NEW |