diff options
-rw-r--r-- | build/common.gypi | 14 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_function_registry.cc | 2 | ||||
-rw-r--r-- | chrome/browser/rlz/rlz.h | 4 | ||||
-rw-r--r-- | chrome/browser/rlz/rlz_extension_api.h | 4 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 4 | ||||
-rw-r--r-- | chrome/chrome_tests.gypi | 8 | ||||
-rw-r--r-- | rlz/lib/rlz_lib.cc | 6 | ||||
-rw-r--r-- | rlz/lib/rlz_lib.h | 8 | ||||
-rw-r--r-- | rlz/lib/rlz_value_store.h | 2 | ||||
-rw-r--r-- | rlz/rlz.gyp | 7 |
10 files changed, 33 insertions, 26 deletions
diff --git a/build/common.gypi b/build/common.gypi index af5674a..d017bee 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -380,9 +380,6 @@ # gyp will remove duplicate flags, causing isolate.py to be confused. 'test_isolation_outdir%': '<(PRODUCT_DIR)/isolate', - # Force rlz to use chrome's networking stack. - 'force_rlz_use_chrome_net%': 1, - 'sas_dll_path%': '<(DEPTH)/third_party/platformsdk_win7/files/redist/x86', 'wix_path%': '<(DEPTH)/third_party/wix', @@ -655,7 +652,6 @@ 'enable_printing%': '<(enable_printing)', 'enable_captive_portal_detection%': '<(enable_captive_portal_detection)', 'disable_ftp_support%': '<(disable_ftp_support)', - 'force_rlz_use_chrome_net%': '<(force_rlz_use_chrome_net)', 'enable_task_manager%': '<(enable_task_manager)', 'sas_dll_path%': '<(sas_dll_path)', 'wix_path%': '<(wix_path)', @@ -911,6 +907,9 @@ 'windows_sdk_default_path': '<(DEPTH)/third_party/platformsdk_win8/files', 'directx_sdk_default_path': '<(DEPTH)/third_party/directxsdk/files', + # Whether rlz is enabled. + 'enable_rlz%': 0, + 'conditions': [ ['OS=="win" and "<!(python <(DEPTH)/build/dir_exists.py <(windows_sdk_default_path))"=="True"', { 'windows_sdk_path%': '<(windows_sdk_default_path)', @@ -1392,6 +1391,11 @@ # Keep the code under #ifndef NVALGRIND. 'release_valgrind_build': 1, }], + + # Enable RLZ on Win and Mac. + ['branding=="Chrome" and (OS=="win" or OS=="mac")', { + 'enable_rlz%': 1, + }], ], # List of default apps to install in new profiles. The first list contains @@ -1526,7 +1530,7 @@ ], }, }], - ['branding=="Chrome" and (OS=="win" or OS=="mac")', { + ['enable_rlz==1', { 'defines': ['ENABLE_RLZ'], }], ['component=="shared_library"', { diff --git a/chrome/browser/extensions/extension_function_registry.cc b/chrome/browser/extensions/extension_function_registry.cc index 4309cdc..ca558ff 100644 --- a/chrome/browser/extensions/extension_function_registry.cc +++ b/chrome/browser/extensions/extension_function_registry.cc @@ -223,7 +223,7 @@ void ExtensionFunctionRegistry::ResetFunctions() { RegisterFunction<extensions::MetricsRecordLongTimeFunction>(); // RLZ. -#if defined(OS_WIN) || defined(OS_MACOSX) +#if defined(ENABLE_RLZ) RegisterFunction<RlzRecordProductEventFunction>(); RegisterFunction<RlzGetAccessPointRlzFunction>(); RegisterFunction<RlzSendFinancialPingFunction>(); diff --git a/chrome/browser/rlz/rlz.h b/chrome/browser/rlz/rlz.h index 64b8854..0dea1f5 100644 --- a/chrome/browser/rlz/rlz.h +++ b/chrome/browser/rlz/rlz.h @@ -7,7 +7,7 @@ #include "build/build_config.h" -#if defined(OS_WIN) || defined(OS_MACOSX) +#if defined(ENABLE_RLZ) #include <map> #include <string> @@ -166,6 +166,6 @@ class RLZTracker : public content::NotificationObserver { DISALLOW_COPY_AND_ASSIGN(RLZTracker); }; -#endif // defined(OS_WIN) || defined(OS_MACOSX) +#endif // defined(ENABLE_RLZ) #endif // CHROME_BROWSER_RLZ_RLZ_H_ diff --git a/chrome/browser/rlz/rlz_extension_api.h b/chrome/browser/rlz/rlz_extension_api.h index f640c6d..47c7940 100644 --- a/chrome/browser/rlz/rlz_extension_api.h +++ b/chrome/browser/rlz/rlz_extension_api.h @@ -7,7 +7,7 @@ #include "build/build_config.h" -#if defined(OS_WIN) || defined(OS_MACOSX) +#if defined(ENABLE_RLZ) #include "base/memory/scoped_ptr.h" #include "chrome/browser/extensions/extension_function.h" @@ -72,6 +72,6 @@ class RlzClearProductStateFunction : public SyncExtensionFunction { virtual bool RunImpl() OVERRIDE; }; -#endif // defined(OS_WIN) || defined(OS_MACOSX) +#endif // defined(ENABLE_RLZ) #endif // CHROME_BROWSER_RLZ_RLZ_EXTENSION_API_H_ diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index a3c73ea..2e53b38 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -2653,11 +2653,11 @@ '../third_party/GTM/Foundation', ], }], - ['OS=="win" or OS=="mac"', { + ['enable_rlz==1', { 'dependencies': [ '../rlz/rlz.gyp:rlz_lib', ], - }, { # 'OS!="win" and OS!="mac" + }, { # enable_rlz!=1 'sources/': [ # Exclude all of rlz. ['exclude', '^browser/rlz/'], diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 3b6a106..6e66284 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -2522,10 +2522,14 @@ }], ['OS!="win" and OS!="mac"', { 'sources!': [ - 'browser/rlz/rlz_unittest.cc', '../skia/ext/platform_canvas_unittest.cc', ], }], + ['enable_rlz==0', { + 'sources!': [ + 'browser/rlz/rlz_unittest.cc', + ], + }], ['OS=="win" and component!="shared_library"', { # Unit_tests pdb files can get too big when incremental linking is # on, disabling for this target. @@ -3426,7 +3430,7 @@ 'browser/ui/gtk/view_id_util_browsertest.cc', ], }], - ['OS!="win" and OS!="mac"', { + ['enable_rlz==0', { 'sources!': [ 'browser/rlz/rlz_extension_apitest.cc', ], diff --git a/rlz/lib/rlz_lib.cc b/rlz/lib/rlz_lib.cc index a613876..8a1b729 100644 --- a/rlz/lib/rlz_lib.cc +++ b/rlz/lib/rlz_lib.cc @@ -84,7 +84,7 @@ bool IsGoodRlzChar(const char ch) { // reasonable size. It also assumes that normalized_rlz is at least // kMaxRlzLength+1 long. void NormalizeRlz(const char* raw_rlz, char* normalized_rlz) { - int index = 0; + size_t index = 0; for (; raw_rlz[index] != 0 && index < rlz_lib::kMaxRlzLength; ++index) { char current = raw_rlz[index]; if (IsGoodRlzChar(current)) { @@ -551,8 +551,8 @@ bool ParsePingResponse(Product product, const char* response) { std::string rlz_value(response_line.substr(separator_index + 2)); TrimWhitespaceASCII(rlz_value, TRIM_LEADING, &rlz_value); - int rlz_length = rlz_value.find_first_of("\r\n "); - if (rlz_length < 0) + size_t rlz_length = rlz_value.find_first_of("\r\n "); + if (rlz_length == std::string::npos) rlz_length = rlz_value.size(); if (rlz_length > kMaxRlzLength) diff --git a/rlz/lib/rlz_lib.h b/rlz/lib/rlz_lib.h index 9d4cf3b..1f8be5c 100644 --- a/rlz/lib/rlz_lib.h +++ b/rlz/lib/rlz_lib.h @@ -55,14 +55,14 @@ namespace rlz_lib { class ScopedRlzValueStoreLock; // The maximum length of an access points RLZ in bytes. -const int kMaxRlzLength = 64; +const size_t kMaxRlzLength = 64; // The maximum length of an access points RLZ in bytes. -const int kMaxDccLength = 128; +const size_t kMaxDccLength = 128; // The maximum length of a CGI string in bytes. -const int kMaxCgiLength = 2048; +const size_t kMaxCgiLength = 2048; // The maximum length of a ping response we will parse in bytes. If the response // is bigger, please break it up into separate calls. -const int kMaxPingResponseLength = 0x4000; // 16K +const size_t kMaxPingResponseLength = 0x4000; // 16K #if defined(RLZ_NETWORK_IMPLEMENTATION_CHROME_NET) // Set the URLRequestContextGetter used by SendFinancialPing(). The IO message diff --git a/rlz/lib/rlz_value_store.h b/rlz/lib/rlz_value_store.h index f45ac25..ab7279a 100644 --- a/rlz/lib/rlz_value_store.h +++ b/rlz/lib/rlz_value_store.h @@ -98,7 +98,7 @@ class ScopedRlzValueStoreLock { scoped_ptr<RlzValueStore> store_; #if defined(OS_WIN) LibMutex lock_; -#else +#elif defined(OS_MACOSX) base::mac::ScopedNSAutoreleasePool autorelease_pool_; #endif }; diff --git a/rlz/rlz.gyp b/rlz/rlz.gyp index 5284134..123eaa0 100644 --- a/rlz/rlz.gyp +++ b/rlz/rlz.gyp @@ -6,12 +6,11 @@ 'variables': { 'chromium_code': 1, 'variables': { - # Set force_rlz_use_chrome_net to 1 to use chrome's network stack instead - # of win inet. - 'force_rlz_use_chrome_net%': 0, + # Force rlz to use chrome's networking stack. + 'force_rlz_use_chrome_net%': 1, }, 'conditions': [ - ['force_rlz_use_chrome_net or OS=="mac"', { + ['force_rlz_use_chrome_net or OS!="win"', { 'rlz_use_chrome_net%': 1, }, { 'rlz_use_chrome_net%': 0, |