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

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: Reverted last patch set because of #ifdefed command line flag Created 8 years, 3 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() const {
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 return product;
438 }
439
440 std::string ChromeContentClient::GetUserAgent() const {
441 std::string product = GetProduct();
437 #if defined(OS_ANDROID) 442 #if defined(OS_ANDROID)
438 CommandLine* command_line = CommandLine::ForCurrentProcess(); 443 CommandLine* command_line = CommandLine::ForCurrentProcess();
439 if (command_line->HasSwitch(switches::kUseMobileUserAgent)) { 444 if (command_line->HasSwitch(switches::kUseMobileUserAgent))
440 product += " Mobile"; 445 product += " Mobile";
441 }
442 #endif 446 #endif
443 return webkit_glue::BuildUserAgentFromProduct(product); 447 return webkit_glue::BuildUserAgentFromProduct(product);
444 } 448 }
445 449
446 string16 ChromeContentClient::GetLocalizedString(int message_id) const { 450 string16 ChromeContentClient::GetLocalizedString(int message_id) const {
447 return l10n_util::GetStringUTF16(message_id); 451 return l10n_util::GetStringUTF16(message_id);
448 } 452 }
449 453
450 base::StringPiece ChromeContentClient::GetDataResource( 454 base::StringPiece ChromeContentClient::GetDataResource(
451 int resource_id, 455 int resource_id,
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 545
542 bool ChromeContentClient::GetBundledFieldTrialPepperFlash( 546 bool ChromeContentClient::GetBundledFieldTrialPepperFlash(
543 content::PepperPluginInfo* plugin, 547 content::PepperPluginInfo* plugin,
544 bool* override_npapi_flash) { 548 bool* override_npapi_flash) {
545 if (!ConductingPepperFlashFieldTrial()) 549 if (!ConductingPepperFlashFieldTrial())
546 return false; 550 return false;
547 return GetBundledPepperFlash(plugin, override_npapi_flash); 551 return GetBundledPepperFlash(plugin, override_npapi_flash);
548 } 552 }
549 553
550 } // namespace chrome 554 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698