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

Side by Side Diff: chrome/common/chrome_content_client.cc

Issue 10854251: Allow the creation of partially spoofed user agents (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebasing Created 8 years, 4 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
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/common/chrome_content_client.h ('k') | content/browser/android/content_view_core_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698