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

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

Issue 18055008: Expose "Chrome" as accessible product name. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: add dcheck Created 7 years, 5 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
« no previous file with comments | « chrome/common/chrome_content_client.h ('k') | chrome/common/chrome_version_info.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 return true; 380 return true;
381 #else 381 #else
382 return false; 382 return false;
383 #endif // FLAPPER_AVAILABLE 383 #endif // FLAPPER_AVAILABLE
384 } 384 }
385 385
386 } // namespace 386 } // namespace
387 387
388 namespace chrome { 388 namespace chrome {
389 389
390 std::string ChromeContentClient::GetProductImpl() {
391 chrome::VersionInfo version_info;
392 std::string product("Chrome/");
393 product += version_info.is_valid() ? version_info.Version() : "0.0.0.0";
394 return product;
395 }
396
397 void ChromeContentClient::SetActiveURL(const GURL& url) { 390 void ChromeContentClient::SetActiveURL(const GURL& url) {
398 child_process_logging::SetActiveURL(url); 391 child_process_logging::SetActiveURL(url);
399 } 392 }
400 393
401 void ChromeContentClient::SetGpuInfo(const gpu::GPUInfo& gpu_info) { 394 void ChromeContentClient::SetGpuInfo(const gpu::GPUInfo& gpu_info) {
402 child_process_logging::SetGpuInfo(gpu_info); 395 child_process_logging::SetGpuInfo(gpu_info);
403 } 396 }
404 397
405 void ChromeContentClient::AddPepperPlugins( 398 void ChromeContentClient::AddPepperPlugins(
406 std::vector<content::PepperPluginInfo>* plugins) { 399 std::vector<content::PepperPluginInfo>* plugins) {
(...skipping 25 matching lines...) Expand all
432 425
433 bool ChromeContentClient::CanHandleWhileSwappedOut( 426 bool ChromeContentClient::CanHandleWhileSwappedOut(
434 const IPC::Message& msg) { 427 const IPC::Message& msg) {
435 // Any Chrome-specific messages (apart from those listed in 428 // Any Chrome-specific messages (apart from those listed in
436 // CanSendWhileSwappedOut) that must be handled by the browser when sent from 429 // CanSendWhileSwappedOut) that must be handled by the browser when sent from
437 // swapped out renderers. 430 // swapped out renderers.
438 return false; 431 return false;
439 } 432 }
440 433
441 std::string ChromeContentClient::GetProduct() const { 434 std::string ChromeContentClient::GetProduct() const {
442 return GetProductImpl(); 435 chrome::VersionInfo version_info;
436 return version_info.is_valid() ?
437 version_info.ProductNameAndVersionForUserAgent() : std::string();
443 } 438 }
444 439
445 std::string ChromeContentClient::GetUserAgent() const { 440 std::string ChromeContentClient::GetUserAgent() const {
446 std::string product = GetProduct(); 441 std::string product = GetProduct();
447 #if defined(OS_ANDROID) 442 #if defined(OS_ANDROID)
448 CommandLine* command_line = CommandLine::ForCurrentProcess(); 443 CommandLine* command_line = CommandLine::ForCurrentProcess();
449 if (command_line->HasSwitch(switches::kUseMobileUserAgent)) 444 if (command_line->HasSwitch(switches::kUseMobileUserAgent))
450 product += " Mobile"; 445 product += " Mobile";
451 #endif 446 #endif
452 return webkit_glue::BuildUserAgentFromProduct(product); 447 return webkit_glue::BuildUserAgentFromProduct(product);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 } 490 }
496 return false; 491 return false;
497 } 492 }
498 493
499 std::string ChromeContentClient::GetCarbonInterposePath() const { 494 std::string ChromeContentClient::GetCarbonInterposePath() const {
500 return std::string(kInterposeLibraryPath); 495 return std::string(kInterposeLibraryPath);
501 } 496 }
502 #endif 497 #endif
503 498
504 } // namespace chrome 499 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/common/chrome_content_client.h ('k') | chrome/common/chrome_version_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698