Chromium Code Reviews| 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/cpu.h" | 8 #include "base/cpu.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 423 // swapped out renderers. | 423 // swapped out renderers. |
| 424 switch (msg.type()) { | 424 switch (msg.type()) { |
| 425 case ChromeViewHostMsg_Snapshot::ID: | 425 case ChromeViewHostMsg_Snapshot::ID: |
| 426 return true; | 426 return true; |
| 427 default: | 427 default: |
| 428 break; | 428 break; |
| 429 } | 429 } |
| 430 return false; | 430 return false; |
| 431 } | 431 } |
| 432 | 432 |
| 433 std::string ChromeContentClient::GetUserAgent() const { | 433 std::string ChromeContentClient::GetProduct(bool mobile_device) const { |
|
tony
2012/08/24 19:46:17
I like the rename to GetProduct, but do we need to
gone
2012/08/24 20:35:11
Did it thinking that we might want to be able to c
| |
| 434 chrome::VersionInfo version_info; | 434 chrome::VersionInfo version_info; |
| 435 std::string product("Chrome/"); | 435 std::string product("Chrome/"); |
| 436 product += version_info.is_valid() ? version_info.Version() : "0.0.0.0"; | 436 product += version_info.is_valid() ? version_info.Version() : "0.0.0.0"; |
| 437 if (mobile_device) { | |
| 438 product += " Mobile"; | |
| 439 } | |
| 440 return product; | |
| 441 } | |
| 442 | |
| 443 std::string ChromeContentClient::GetUserAgent() const { | |
| 444 bool mobile_device = false; | |
| 437 #if defined(OS_ANDROID) | 445 #if defined(OS_ANDROID) |
| 438 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 446 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 439 if (command_line->HasSwitch(switches::kUseMobileUserAgent)) { | 447 mobile_device = command_line->HasSwitch(switches::kUseMobileUserAgent); |
| 440 product += " Mobile"; | |
| 441 } | |
| 442 #endif | 448 #endif |
| 449 std::string product = GetProduct(mobile_device); | |
| 443 return webkit_glue::BuildUserAgentFromProduct(product); | 450 return webkit_glue::BuildUserAgentFromProduct(product); |
| 444 } | 451 } |
| 445 | 452 |
| 446 string16 ChromeContentClient::GetLocalizedString(int message_id) const { | 453 string16 ChromeContentClient::GetLocalizedString(int message_id) const { |
| 447 return l10n_util::GetStringUTF16(message_id); | 454 return l10n_util::GetStringUTF16(message_id); |
| 448 } | 455 } |
| 449 | 456 |
| 450 base::StringPiece ChromeContentClient::GetDataResource( | 457 base::StringPiece ChromeContentClient::GetDataResource( |
| 451 int resource_id, | 458 int resource_id, |
| 452 ui::ScaleFactor scale_factor) const { | 459 ui::ScaleFactor scale_factor) const { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 541 | 548 |
| 542 bool ChromeContentClient::GetBundledFieldTrialPepperFlash( | 549 bool ChromeContentClient::GetBundledFieldTrialPepperFlash( |
| 543 content::PepperPluginInfo* plugin, | 550 content::PepperPluginInfo* plugin, |
| 544 bool* override_npapi_flash) { | 551 bool* override_npapi_flash) { |
| 545 if (!ConductingPepperFlashFieldTrial()) | 552 if (!ConductingPepperFlashFieldTrial()) |
| 546 return false; | 553 return false; |
| 547 return GetBundledPepperFlash(plugin, override_npapi_flash); | 554 return GetBundledPepperFlash(plugin, override_npapi_flash); |
| 548 } | 555 } |
| 549 | 556 |
| 550 } // namespace chrome | 557 } // namespace chrome |
| OLD | NEW |