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

Side by Side Diff: webkit/glue/webkit_glue.cc

Issue 1560027: Refactor FileVersionInfo into an interface with platform implementations. (Closed)
Patch Set: comments Created 10 years, 8 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 | « webkit/glue/webkit_glue.h ('k') | webkit/glue/webkit_glue.gypi » ('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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 "webkit/glue/webkit_glue.h" 5 #include "webkit/glue/webkit_glue.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <objidl.h> 8 #include <objidl.h>
9 #include <mlang.h> 9 #include <mlang.h>
10 #elif defined(OS_POSIX) && !defined(OS_MACOSX) 10 #elif defined(OS_POSIX) && !defined(OS_MACOSX)
11 #include <sys/utsname.h> 11 #include <sys/utsname.h>
12 #endif 12 #endif
13 13
14 #include "base/file_version_info.h"
15 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/scoped_ptr.h"
16 #include "base/singleton.h" 16 #include "base/singleton.h"
17 #include "base/string_piece.h" 17 #include "base/string_piece.h"
18 #include "base/string_util.h" 18 #include "base/string_util.h"
19 #include "base/sys_info.h" 19 #include "base/sys_info.h"
20 #include "base/sys_string_conversions.h" 20 #include "base/sys_string_conversions.h"
21 #include "base/utf_string_conversions.h" 21 #include "base/utf_string_conversions.h"
22 #include "net/base/escape.h" 22 #include "net/base/escape.h"
23 #include "skia/ext/platform_canvas.h" 23 #include "skia/ext/platform_canvas.h"
24 #if defined(OS_MACOSX) 24 #if defined(OS_MACOSX)
25 #include "skia/ext/skia_utils_mac.h" 25 #include "skia/ext/skia_utils_mac.h"
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 #endif 411 #endif
412 412
413 const char kUserAgentSecurity = 'U'; // "US" strength encryption 413 const char kUserAgentSecurity = 'U'; // "US" strength encryption
414 414
415 // TODO(port): figure out correct locale 415 // TODO(port): figure out correct locale
416 const char kUserAgentLocale[] = "en-US"; 416 const char kUserAgentLocale[] = "en-US";
417 417
418 // Get the product name and version, and replace Safari's Version/X string 418 // Get the product name and version, and replace Safari's Version/X string
419 // with it. This is done to expose our product name in a manner that is 419 // with it. This is done to expose our product name in a manner that is
420 // maximally compatible with Safari, we hope!! 420 // maximally compatible with Safari, we hope!!
421 std::string product; 421 std::string product = mimic_chrome1 ? kChrome1ProductString
422 422 : GetProductVersion();
423 if (mimic_chrome1) {
424 product = kChrome1ProductString;
425 } else {
426 scoped_ptr<FileVersionInfo> version_info(
427 FileVersionInfo::CreateFileVersionInfoForCurrentModule());
428 if (version_info.get()) {
429 product = "Chrome/" + WideToASCII(version_info->product_version());
430 } else {
431 DLOG(WARNING) << "Unknown product version";
432 product = "Chrome/0.0.0.0";
433 }
434 }
435 423
436 // Derived from Safari's UA string. 424 // Derived from Safari's UA string.
437 StringAppendF( 425 StringAppendF(
438 result, 426 result,
439 "Mozilla/5.0 (%s; %c; %s; %s) AppleWebKit/%d.%d" 427 "Mozilla/5.0 (%s; %c; %s; %s) AppleWebKit/%d.%d"
440 " (KHTML, like Gecko) %s Safari/%d.%d", 428 " (KHTML, like Gecko) %s Safari/%d.%d",
441 mimic_windows ? "Windows" : kUserAgentPlatform, 429 mimic_windows ? "Windows" : kUserAgentPlatform,
442 kUserAgentSecurity, 430 kUserAgentSecurity,
443 ((mimic_windows ? "Windows " : "") + BuildOSCpuInfo()).c_str(), 431 ((mimic_windows ? "Windows " : "") + BuildOSCpuInfo()).c_str(),
444 kUserAgentLocale, 432 kUserAgentLocale,
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 516
529 bool IsMediaCacheEnabled() { 517 bool IsMediaCacheEnabled() {
530 return g_enable_media_cache; 518 return g_enable_media_cache;
531 } 519 }
532 520
533 void SetMediaCacheEnabled(bool enabled) { 521 void SetMediaCacheEnabled(bool enabled) {
534 g_enable_media_cache = enabled; 522 g_enable_media_cache = enabled;
535 } 523 }
536 524
537 } // namespace webkit_glue 525 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « webkit/glue/webkit_glue.h ('k') | webkit/glue/webkit_glue.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698