summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsdefresne@chromium.org <sdefresne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-23 15:09:38 +0000
committersdefresne@chromium.org <sdefresne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-23 15:09:38 +0000
commitd2d743972bef83f5241f02765aa0f3e3a50d43bd (patch)
tree6d0b3dae3184a4f0c7476117158c91656c06db05
parent7d75c2f4b67f8b64e49ec02cd31821ddcabc92cd (diff)
downloadchromium_src-d2d743972bef83f5241f02765aa0f3e3a50d43bd.zip
chromium_src-d2d743972bef83f5241f02765aa0f3e3a50d43bd.tar.gz
chromium_src-d2d743972bef83f5241f02765aa0f3e3a50d43bd.tar.bz2
Implements RLZ lib for iOS
Use the OS X implementation of the RlzValueStore and derive the machine identifier from -[UIDevice identifierForVendor]. BUG=309629 Review URL: https://codereview.chromium.org/29873005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@230429 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/rlz/rlz.cc10
-rw-r--r--rlz/ios/lib/machine_id_ios.cc17
-rw-r--r--rlz/lib/lib_values.cc4
-rw-r--r--rlz/lib/rlz_enums.h5
-rw-r--r--rlz/rlz.gyp10
5 files changed, 42 insertions, 4 deletions
diff --git a/chrome/browser/rlz/rlz.cc b/chrome/browser/rlz/rlz.cc
index dfad491..8738b17 100644
--- a/chrome/browser/rlz/rlz.cc
+++ b/chrome/browser/rlz/rlz.cc
@@ -144,6 +144,13 @@ const rlz_lib::AccessPoint RLZTracker::CHROME_OMNIBOX =
// static
const rlz_lib::AccessPoint RLZTracker::CHROME_HOME_PAGE =
rlz_lib::CHROME_HOME_PAGE;
+#elif defined(OS_IOS)
+// static
+const rlz_lib::AccessPoint RLZTracker::CHROME_OMNIBOX =
+ rlz_lib::CHROME_IOS_OMNIBOX;
+// static
+const rlz_lib::AccessPoint RLZTracker::CHROME_HOME_PAGE =
+ rlz_lib::CHROME_IOS_HOME_PAGE;
#elif defined(OS_MACOSX)
// static
const rlz_lib::AccessPoint RLZTracker::CHROME_OMNIBOX =
@@ -228,6 +235,8 @@ bool RLZTracker::InitRlzFromProfileDelayed(Profile* profile,
GURL(pref_service->GetString(prefs::kHomePage)));
bool is_google_in_startpages = false;
+#if !defined(OS_IOS)
+ // iOS does not have a notion of startpages.
SessionStartupPref session_startup_prefs =
StartupBrowserCreator::GetSessionStartupPref(
*CommandLine::ForCurrentProcess(), profile);
@@ -237,6 +246,7 @@ bool RLZTracker::InitRlzFromProfileDelayed(Profile* profile,
session_startup_prefs.urls.end(),
google_util::IsGoogleHomePageUrl) > 0;
}
+#endif
if (!InitRlzDelayed(first_run, send_ping_immediately, delay,
is_google_default_search, is_google_homepage,
diff --git a/rlz/ios/lib/machine_id_ios.cc b/rlz/ios/lib/machine_id_ios.cc
new file mode 100644
index 0000000..3440978
--- /dev/null
+++ b/rlz/ios/lib/machine_id_ios.cc
@@ -0,0 +1,17 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/ios/device_util.h"
+#include "base/strings/string16.h"
+#include "base/strings/utf_string_conversions.h"
+
+namespace rlz_lib {
+
+bool GetRawMachineId(string16* data, int* more_data) {
+ *data = ASCIIToUTF16(ios::device_util::GetDeviceIdentifier(NULL));
+ *more_data = 1;
+ return true;
+}
+
+} // namespace rlz_lib
diff --git a/rlz/lib/lib_values.cc b/rlz/lib/lib_values.cc
index c4ef460..8874a29 100644
--- a/rlz/lib/lib_values.cc
+++ b/rlz/lib/lib_values.cc
@@ -98,8 +98,8 @@ const char* GetAccessPointName(AccessPoint point) {
case CHROMEOS_OMNIBOX: return "CA";
case CHROMEOS_HOME_PAGE: return "CB";
case CHROMEOS_RESERVED: return "CC";
- case UNDEFINED_AP_M: return "RM";
- case UNDEFINED_AP_N: return "RN";
+ case CHROME_IOS_OMNIBOX: return "RM";
+ case CHROME_IOS_HOME_PAGE: return "RN";
case UNDEFINED_AP_O: return "RO";
case UNDEFINED_AP_P: return "RP";
case UNDEFINED_AP_Q: return "RQ";
diff --git a/rlz/lib/rlz_enums.h b/rlz/lib/rlz_enums.h
index 0fd0513..08d8bbb 100644
--- a/rlz/lib/rlz_enums.h
+++ b/rlz/lib/rlz_enums.h
@@ -62,11 +62,12 @@ enum AccessPoint {
CHROMEOS_HOME_PAGE, // ChromeOS searches through Google as home page.
CHROMEOS_RESERVED, // Reserved for ChromeOS.
+ CHROME_IOS_OMNIBOX, // Chrome searches through the address bar omnibox (iOS).
+ CHROME_IOS_HOME_PAGE,// Chrome searches through Google as home page (iOS).
+
// Unclaimed access points - should be used first before creating new APs.
// Please also make sure you re-name the enum before using an unclaimed value;
// this acts as a check to ensure we don't have collisions.
- UNDEFINED_AP_M,
- UNDEFINED_AP_N,
UNDEFINED_AP_O,
UNDEFINED_AP_P,
UNDEFINED_AP_Q,
diff --git a/rlz/rlz.gyp b/rlz/rlz.gyp
index c38c4ff..18637058 100644
--- a/rlz/rlz.gyp
+++ b/rlz/rlz.gyp
@@ -34,6 +34,7 @@
'chromeos/lib/machine_id_chromeos.cc',
'chromeos/lib/rlz_value_store_chromeos.cc',
'chromeos/lib/rlz_value_store_chromeos.h',
+ 'ios/lib/machine_id_ios.cc',
'lib/assert.cc',
'lib/assert.h',
'lib/crc32.h',
@@ -97,6 +98,15 @@
},
}],
],
+ 'target_conditions': [
+ # Need 'target_conditions' to override default filename_rules to include
+ # the files on iOS.
+ ['OS=="ios"', {
+ 'sources/': [
+ ['include', '^mac/lib/rlz_value_store_mac\\.'],
+ ],
+ }],
+ ],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [ 4267, ],
},