diff options
-rw-r--r-- | chrome/browser/chromeos/login/login_utils_browsertest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/rlz/rlz.cc | 88 | ||||
-rw-r--r-- | chrome/browser/rlz/rlz.h | 6 | ||||
-rw-r--r-- | chrome/browser/rlz/rlz_chromeos.cc | 20 | ||||
-rw-r--r-- | chrome/browser/rlz/rlz_ios.mm | 14 | ||||
-rw-r--r-- | chrome/browser/rlz/rlz_mac.cc | 20 | ||||
-rw-r--r-- | chrome/browser/rlz/rlz_unittest.cc | 58 | ||||
-rw-r--r-- | chrome/browser/rlz/rlz_win.cc | 20 | ||||
-rw-r--r-- | chrome/browser/search_engines/search_terms_data.cc | 4 | ||||
-rw-r--r-- | chrome/browser/search_engines/template_url_service.cc | 2 | ||||
-rw-r--r-- | chrome/browser/search_engines/template_url_unittest.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/browser_commands.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/startup/startup_browser_creator_impl.cc | 2 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 4 | ||||
-rw-r--r-- | rlz/lib/lib_values.cc | 7 | ||||
-rw-r--r-- | rlz/lib/rlz_enums.h | 5 | ||||
-rw-r--r-- | rlz/lib/rlz_lib.cc | 1 |
17 files changed, 151 insertions, 110 deletions
diff --git a/chrome/browser/chromeos/login/login_utils_browsertest.cc b/chrome/browser/chromeos/login/login_utils_browsertest.cc index 38e7288..2e3826c 100644 --- a/chrome/browser/chromeos/login/login_utils_browsertest.cc +++ b/chrome/browser/chromeos/login/login_utils_browsertest.cc @@ -586,7 +586,7 @@ TEST_F(LoginUtilsTest, RlzInitialized) { // RLZ value for homepage access point should have been initialized. base::string16 rlz_string; EXPECT_TRUE(RLZTracker::GetAccessPointRlz( - RLZTracker::CHROME_HOME_PAGE, &rlz_string)); + RLZTracker::ChromeHomePage(), &rlz_string)); EXPECT_EQ(base::string16(), rlz_string); } #endif diff --git a/chrome/browser/rlz/rlz.cc b/chrome/browser/rlz/rlz.cc index 4f0d182..63686b1 100644 --- a/chrome/browser/rlz/rlz.cc +++ b/chrome/browser/rlz/rlz.cc @@ -80,14 +80,14 @@ void RecordProductEvents(bool first_run, // Record the installation of chrome. We call this all the time but the rlz // lib should ignore all but the first one. rlz_lib::RecordProductEvent(rlz_lib::CHROME, - RLZTracker::CHROME_OMNIBOX, + RLZTracker::ChromeOmnibox(), rlz_lib::INSTALL); #if !defined(OS_IOS) rlz_lib::RecordProductEvent(rlz_lib::CHROME, - RLZTracker::CHROME_HOME_PAGE, + RLZTracker::ChromeHomePage(), rlz_lib::INSTALL); rlz_lib::RecordProductEvent(rlz_lib::CHROME, - RLZTracker::CHROME_APP_LIST, + RLZTracker::ChromeAppList(), rlz_lib::INSTALL); #endif // !defined(OS_IOS) @@ -95,7 +95,7 @@ void RecordProductEvents(bool first_run, // Do the initial event recording if is the first run or if we have an // empty rlz which means we haven't got a chance to do it. char omnibox_rlz[rlz_lib::kMaxRlzLength + 1]; - if (!rlz_lib::GetAccessPointRlz(RLZTracker::CHROME_OMNIBOX, omnibox_rlz, + if (!rlz_lib::GetAccessPointRlz(RLZTracker::ChromeOmnibox(), omnibox_rlz, rlz_lib::kMaxRlzLength)) { omnibox_rlz[0] = 0; } @@ -103,13 +103,13 @@ void RecordProductEvents(bool first_run, // Record if google is the initial search provider and/or home page. if ((first_run || omnibox_rlz[0] == 0) && is_google_default_search) { rlz_lib::RecordProductEvent(rlz_lib::CHROME, - RLZTracker::CHROME_OMNIBOX, + RLZTracker::ChromeOmnibox(), rlz_lib::SET_TO_GOOGLE); } #if !defined(OS_IOS) char homepage_rlz[rlz_lib::kMaxRlzLength + 1]; - if (!rlz_lib::GetAccessPointRlz(RLZTracker::CHROME_HOME_PAGE, homepage_rlz, + if (!rlz_lib::GetAccessPointRlz(RLZTracker::ChromeHomePage(), homepage_rlz, rlz_lib::kMaxRlzLength)) { homepage_rlz[0] = 0; } @@ -117,12 +117,12 @@ void RecordProductEvents(bool first_run, if ((first_run || homepage_rlz[0] == 0) && (is_google_homepage || is_google_in_startpages)) { rlz_lib::RecordProductEvent(rlz_lib::CHROME, - RLZTracker::CHROME_HOME_PAGE, + RLZTracker::ChromeHomePage(), rlz_lib::SET_TO_GOOGLE); } char app_list_rlz[rlz_lib::kMaxRlzLength + 1]; - if (!rlz_lib::GetAccessPointRlz(RLZTracker::CHROME_APP_LIST, app_list_rlz, + if (!rlz_lib::GetAccessPointRlz(RLZTracker::ChromeAppList(), app_list_rlz, rlz_lib::kMaxRlzLength)) { app_list_rlz[0] = 0; } @@ -130,7 +130,7 @@ void RecordProductEvents(bool first_run, // Record if google is the initial search provider and/or home page. if ((first_run || app_list_rlz[0] == 0) && is_google_default_search) { rlz_lib::RecordProductEvent(rlz_lib::CHROME, - RLZTracker::CHROME_APP_LIST, + RLZTracker::ChromeAppList(), rlz_lib::SET_TO_GOOGLE); } #endif // !defined(OS_IOS) @@ -140,7 +140,7 @@ void RecordProductEvents(bool first_run, // time but the rlz lib should ingore all but the first one. if (omnibox_used) { rlz_lib::RecordProductEvent(rlz_lib::CHROME, - RLZTracker::CHROME_OMNIBOX, + RLZTracker::ChromeOmnibox(), rlz_lib::FIRST_SEARCH); } @@ -149,7 +149,7 @@ void RecordProductEvents(bool first_run, // time but the rlz lib should ingore all but the first one. if (homepage_used || is_google_in_startpages) { rlz_lib::RecordProductEvent(rlz_lib::CHROME, - RLZTracker::CHROME_HOME_PAGE, + RLZTracker::ChromeHomePage(), rlz_lib::FIRST_SEARCH); } @@ -157,7 +157,7 @@ void RecordProductEvents(bool first_run, // time but the rlz lib should ingore all but the first one. if (app_list_used) { rlz_lib::RecordProductEvent(rlz_lib::CHROME, - RLZTracker::CHROME_APP_LIST, + RLZTracker::ChromeAppList(), rlz_lib::FIRST_SEARCH); } #endif // !defined(OS_IOS) @@ -166,10 +166,10 @@ void RecordProductEvents(bool first_run, bool SendFinancialPing(const std::string& brand, const base::string16& lang, const base::string16& referral) { - rlz_lib::AccessPoint points[] = {RLZTracker::CHROME_OMNIBOX, + rlz_lib::AccessPoint points[] = {RLZTracker::ChromeOmnibox(), #if !defined(OS_IOS) - RLZTracker::CHROME_HOME_PAGE, - RLZTracker::CHROME_APP_LIST, + RLZTracker::ChromeHomePage(), + RLZTracker::ChromeAppList(), #endif rlz_lib::NO_ACCESS_POINT}; std::string lang_ascii(base::UTF16ToASCII(lang)); @@ -188,42 +188,6 @@ bool SendFinancialPing(const std::string& brand, } // namespace -#if defined(OS_WIN) -// static -const rlz_lib::AccessPoint RLZTracker::CHROME_OMNIBOX = - rlz_lib::CHROME_OMNIBOX; -// static -const rlz_lib::AccessPoint RLZTracker::CHROME_HOME_PAGE = - rlz_lib::CHROME_HOME_PAGE; -// static -const rlz_lib::AccessPoint RLZTracker::CHROME_APP_LIST = - rlz_lib::CHROME_APP_LIST; -#elif defined(OS_IOS) -// static -const rlz_lib::AccessPoint RLZTracker::CHROME_OMNIBOX = - rlz_lib::CHROME_IOS_OMNIBOX; -#elif defined(OS_MACOSX) -// static -const rlz_lib::AccessPoint RLZTracker::CHROME_OMNIBOX = - rlz_lib::CHROME_MAC_OMNIBOX; -// static -const rlz_lib::AccessPoint RLZTracker::CHROME_HOME_PAGE = - rlz_lib::CHROME_MAC_HOME_PAGE; -// static -const rlz_lib::AccessPoint RLZTracker::CHROME_APP_LIST = - rlz_lib::CHROME_MAC_APP_LIST; -#elif defined(OS_CHROMEOS) -// static -const rlz_lib::AccessPoint RLZTracker::CHROME_OMNIBOX = - rlz_lib::CHROMEOS_OMNIBOX; -// static -const rlz_lib::AccessPoint RLZTracker::CHROME_HOME_PAGE = - rlz_lib::CHROMEOS_HOME_PAGE; -// static -const rlz_lib::AccessPoint RLZTracker::CHROME_APP_LIST = - rlz_lib::CHROMEOS_APP_LIST; -#endif - RLZTracker* RLZTracker::tracker_ = NULL; // static @@ -303,7 +267,7 @@ bool RLZTracker::InitRlzFromProfileDelayed(Profile* profile, // Prime the RLZ cache for the home page access point so that its avaiable // for the startup page if needed (i.e., when the startup page is set to // the home page). - GetAccessPointRlz(CHROME_HOME_PAGE, NULL); + GetAccessPointRlz(ChromeHomePage(), NULL); #endif // !defined(OS_IOS) return true; @@ -420,10 +384,10 @@ void RLZTracker::PingNowImpl() { } // Prime the RLZ cache for the access points we are interested in. - GetAccessPointRlz(RLZTracker::CHROME_OMNIBOX, NULL); + GetAccessPointRlz(RLZTracker::ChromeOmnibox(), NULL); #if !defined(OS_IOS) - GetAccessPointRlz(RLZTracker::CHROME_HOME_PAGE, NULL); - GetAccessPointRlz(RLZTracker::CHROME_APP_LIST, NULL); + GetAccessPointRlz(RLZTracker::ChromeHomePage(), NULL); + GetAccessPointRlz(RLZTracker::ChromeAppList(), NULL); #endif // !defined(OS_IOS) } @@ -450,7 +414,7 @@ void RLZTracker::Observe(int type, // there to keep the old behavior. if (!content::Details<OmniboxLog>(details).ptr()->is_popup_open) break; - RecordFirstSearch(CHROME_OMNIBOX); + RecordFirstSearch(ChromeOmnibox()); registrar_.Remove(this, chrome::NOTIFICATION_OMNIBOX_OPENED_URL, content::NotificationService::AllSources()); break; @@ -461,7 +425,7 @@ void RLZTracker::Observe(int type, if (entry != NULL && ((entry->GetTransitionType() & content::PAGE_TRANSITION_HOME_PAGE) != 0)) { - RecordFirstSearch(CHROME_HOME_PAGE); + RecordFirstSearch(ChromeHomePage()); registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_PENDING, content::NotificationService::AllSources()); } @@ -528,7 +492,7 @@ void RLZTracker::RecordFirstSearch(rlz_lib::AccessPoint point) { // attempt the ping. if (!RecordProductEvent(rlz_lib::CHROME, point, rlz_lib::FIRST_SEARCH)) *record_used = true; - else if (send_ping_immediately_ && point == CHROME_OMNIBOX) + else if (send_ping_immediately_ && point == ChromeOmnibox()) ScheduleDelayedInit(base::TimeDelta()); } @@ -545,12 +509,12 @@ bool RLZTracker::ScheduleRecordFirstSearch(rlz_lib::AccessPoint point) { } bool* RLZTracker::GetAccessPointRecord(rlz_lib::AccessPoint point) { - if (point == CHROME_OMNIBOX) + if (point == ChromeOmnibox()) return &omnibox_used_; #if !defined(OS_IOS) - if (point == CHROME_HOME_PAGE) + if (point == ChromeHomePage()) return &homepage_used_; - if (point == CHROME_APP_LIST) + if (point == ChromeAppList()) return &app_list_used_; #endif // !defined(OS_IOS) NOTREACHED(); @@ -668,6 +632,6 @@ void RLZTracker::EnableZeroDelayForTesting() { #if !defined(OS_IOS) // static void RLZTracker::RecordAppListSearch() { - GetInstance()->RecordFirstSearch(RLZTracker::CHROME_APP_LIST); + GetInstance()->RecordFirstSearch(RLZTracker::ChromeAppList()); } #endif diff --git a/chrome/browser/rlz/rlz.h b/chrome/browser/rlz/rlz.h index 7415c5f..b152bc2 100644 --- a/chrome/browser/rlz/rlz.h +++ b/chrome/browser/rlz/rlz.h @@ -60,10 +60,10 @@ class RLZTracker : public content::NotificationObserver { rlz_lib::Event event_id); // For the point parameter of RecordProductEvent. - static const rlz_lib::AccessPoint CHROME_OMNIBOX; - static const rlz_lib::AccessPoint CHROME_HOME_PAGE; + static rlz_lib::AccessPoint ChromeOmnibox(); #if !defined(OS_IOS) - static const rlz_lib::AccessPoint CHROME_APP_LIST; + static rlz_lib::AccessPoint ChromeHomePage(); + static rlz_lib::AccessPoint ChromeAppList(); #endif // Gets the HTTP header value that can be added to requests from the diff --git a/chrome/browser/rlz/rlz_chromeos.cc b/chrome/browser/rlz/rlz_chromeos.cc new file mode 100644 index 0000000..8f9a874 --- /dev/null +++ b/chrome/browser/rlz/rlz_chromeos.cc @@ -0,0 +1,20 @@ +// Copyright 2014 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 "chrome/browser/rlz/rlz.h" + +// static +rlz_lib::AccessPoint RLZTracker::ChromeOmnibox() { + return rlz_lib::CHROMEOS_OMNIBOX; +} + +// static +rlz_lib::AccessPoint RLZTracker::ChromeHomePage() { + return rlz_lib::CHROMEOS_HOME_PAGE; +} + +// static +rlz_lib::AccessPoint RLZTracker::ChromeAppList() { + return rlz_lib::CHROMEOS_APP_LIST; +} diff --git a/chrome/browser/rlz/rlz_ios.mm b/chrome/browser/rlz/rlz_ios.mm new file mode 100644 index 0000000..7af1f59 --- /dev/null +++ b/chrome/browser/rlz/rlz_ios.mm @@ -0,0 +1,14 @@ +// Copyright 2014 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 "chrome/browser/rlz/rlz.h" + +#import <UIKit/UIKit.h> + +// static +rlz_lib::AccessPoint RLZTracker::ChromeOmnibox() { + return UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone + ? rlz_lib::CHROME_IOS_OMNIBOX_MOBILE + : rlz_lib::CHROME_IOS_OMNIBOX_TABLET; +} diff --git a/chrome/browser/rlz/rlz_mac.cc b/chrome/browser/rlz/rlz_mac.cc new file mode 100644 index 0000000..d3e32a9 --- /dev/null +++ b/chrome/browser/rlz/rlz_mac.cc @@ -0,0 +1,20 @@ +// Copyright 2014 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 "chrome/browser/rlz/rlz.h" + +// static +rlz_lib::AccessPoint RLZTracker::ChromeOmnibox() { + return rlz_lib::CHROME_MAC_OMNIBOX; +} + +// static +rlz_lib::AccessPoint RLZTracker::ChromeHomePage() { + return rlz_lib::CHROME_MAC_HOME_PAGE; +} + +// static +rlz_lib::AccessPoint RLZTracker::ChromeAppList() { + return rlz_lib::CHROME_MAC_APP_LIST; +} diff --git a/chrome/browser/rlz/rlz_unittest.cc b/chrome/browser/rlz/rlz_unittest.cc index 2b09959..0256227 100644 --- a/chrome/browser/rlz/rlz_unittest.cc +++ b/chrome/browser/rlz/rlz_unittest.cc @@ -143,11 +143,11 @@ class TestRLZTracker : public RLZTracker { // Set new access points RLZ string, like the actual server ping would have // done. - rlz_lib::SetAccessPointRlz(RLZTracker::CHROME_OMNIBOX, + rlz_lib::SetAccessPointRlz(RLZTracker::ChromeOmnibox(), kNewOmniboxRlzString); - rlz_lib::SetAccessPointRlz(RLZTracker::CHROME_HOME_PAGE, + rlz_lib::SetAccessPointRlz(RLZTracker::ChromeHomePage(), kNewHomepageRlzString); - rlz_lib::SetAccessPointRlz(RLZTracker::CHROME_APP_LIST, + rlz_lib::SetAccessPointRlz(RLZTracker::ChromeAppList(), kNewAppListRlzString); return true; } @@ -352,7 +352,7 @@ const char kAppListFirstSearch[] = "CCF"; const base::TimeDelta kDelay = base::TimeDelta::FromMilliseconds(20); TEST_F(RlzLibTest, RecordProductEvent) { - RLZTracker::RecordProductEvent(rlz_lib::CHROME, RLZTracker::CHROME_OMNIBOX, + RLZTracker::RecordProductEvent(rlz_lib::CHROME, RLZTracker::ChromeOmnibox(), rlz_lib::FIRST_SEARCH); ExpectEventRecorded(kOmniboxFirstSearch, true); @@ -470,9 +470,9 @@ TEST_F(RlzLibTest, DelayedInitOnlyNoFirstRunNoRlzStringsGoogleAsStartup) { TEST_F(RlzLibTest, DelayedInitOnlyNoFirstRun) { // Set some dummy RLZ strings to simulate that we already ran before and // performed a successful ping to the RLZ server. - rlz_lib::SetAccessPointRlz(RLZTracker::CHROME_OMNIBOX, kOmniboxRlzString); - rlz_lib::SetAccessPointRlz(RLZTracker::CHROME_HOME_PAGE, kHomepageRlzString); - rlz_lib::SetAccessPointRlz(RLZTracker::CHROME_APP_LIST, kAppListRlzString); + rlz_lib::SetAccessPointRlz(RLZTracker::ChromeOmnibox(), kOmniboxRlzString); + rlz_lib::SetAccessPointRlz(RLZTracker::ChromeHomePage(), kHomepageRlzString); + rlz_lib::SetAccessPointRlz(RLZTracker::ChromeAppList(), kAppListRlzString); TestRLZTracker::InitRlzDelayed(false, false, kDelay, true, true, true); InvokeDelayedInit(); @@ -723,71 +723,73 @@ TEST_F(RlzLibTest, AppListUsageDoesNotSendPingWhenSendPingImmediately) { TEST_F(RlzLibTest, GetAccessPointRlzOnIoThread) { // Set dummy RLZ string. - rlz_lib::SetAccessPointRlz(RLZTracker::CHROME_OMNIBOX, kOmniboxRlzString); + rlz_lib::SetAccessPointRlz(RLZTracker::ChromeOmnibox(), kOmniboxRlzString); base::string16 rlz; tracker_.set_assume_not_ui_thread(true); - EXPECT_TRUE(RLZTracker::GetAccessPointRlz(RLZTracker::CHROME_OMNIBOX, &rlz)); + EXPECT_TRUE(RLZTracker::GetAccessPointRlz(RLZTracker::ChromeOmnibox(), &rlz)); EXPECT_STREQ(kOmniboxRlzString, base::UTF16ToUTF8(rlz).c_str()); } TEST_F(RlzLibTest, GetAccessPointRlzNotOnIoThread) { // Set dummy RLZ string. - rlz_lib::SetAccessPointRlz(RLZTracker::CHROME_OMNIBOX, kOmniboxRlzString); + rlz_lib::SetAccessPointRlz(RLZTracker::ChromeOmnibox(), kOmniboxRlzString); base::string16 rlz; tracker_.set_assume_not_ui_thread(false); - EXPECT_FALSE(RLZTracker::GetAccessPointRlz(RLZTracker::CHROME_OMNIBOX, &rlz)); + EXPECT_FALSE( + RLZTracker::GetAccessPointRlz(RLZTracker::ChromeOmnibox(), &rlz)); } TEST_F(RlzLibTest, GetAccessPointRlzIsCached) { // Set dummy RLZ string. - rlz_lib::SetAccessPointRlz(RLZTracker::CHROME_OMNIBOX, kOmniboxRlzString); + rlz_lib::SetAccessPointRlz(RLZTracker::ChromeOmnibox(), kOmniboxRlzString); base::string16 rlz; tracker_.set_assume_not_ui_thread(false); - EXPECT_FALSE(RLZTracker::GetAccessPointRlz(RLZTracker::CHROME_OMNIBOX, &rlz)); + EXPECT_FALSE( + RLZTracker::GetAccessPointRlz(RLZTracker::ChromeOmnibox(), &rlz)); tracker_.set_assume_not_ui_thread(true); - EXPECT_TRUE(RLZTracker::GetAccessPointRlz(RLZTracker::CHROME_OMNIBOX, &rlz)); + EXPECT_TRUE(RLZTracker::GetAccessPointRlz(RLZTracker::ChromeOmnibox(), &rlz)); EXPECT_STREQ(kOmniboxRlzString, base::UTF16ToUTF8(rlz).c_str()); tracker_.set_assume_not_ui_thread(false); - EXPECT_TRUE(RLZTracker::GetAccessPointRlz(RLZTracker::CHROME_OMNIBOX, &rlz)); + EXPECT_TRUE(RLZTracker::GetAccessPointRlz(RLZTracker::ChromeOmnibox(), &rlz)); EXPECT_STREQ(kOmniboxRlzString, base::UTF16ToUTF8(rlz).c_str()); } TEST_F(RlzLibTest, PingUpdatesRlzCache) { // Set dummy RLZ string. - rlz_lib::SetAccessPointRlz(RLZTracker::CHROME_OMNIBOX, kOmniboxRlzString); - rlz_lib::SetAccessPointRlz(RLZTracker::CHROME_HOME_PAGE, kHomepageRlzString); - rlz_lib::SetAccessPointRlz(RLZTracker::CHROME_APP_LIST, kAppListRlzString); + rlz_lib::SetAccessPointRlz(RLZTracker::ChromeOmnibox(), kOmniboxRlzString); + rlz_lib::SetAccessPointRlz(RLZTracker::ChromeHomePage(), kHomepageRlzString); + rlz_lib::SetAccessPointRlz(RLZTracker::ChromeAppList(), kAppListRlzString); base::string16 rlz; // Prime the cache. tracker_.set_assume_not_ui_thread(true); - EXPECT_TRUE(RLZTracker::GetAccessPointRlz(RLZTracker::CHROME_OMNIBOX, &rlz)); + EXPECT_TRUE(RLZTracker::GetAccessPointRlz(RLZTracker::ChromeOmnibox(), &rlz)); EXPECT_STREQ(kOmniboxRlzString, base::UTF16ToUTF8(rlz).c_str()); EXPECT_TRUE(RLZTracker::GetAccessPointRlz( - RLZTracker::CHROME_HOME_PAGE, &rlz)); + RLZTracker::ChromeHomePage(), &rlz)); EXPECT_STREQ(kHomepageRlzString, base::UTF16ToUTF8(rlz).c_str()); - EXPECT_TRUE(RLZTracker::GetAccessPointRlz(RLZTracker::CHROME_APP_LIST, &rlz)); + EXPECT_TRUE(RLZTracker::GetAccessPointRlz(RLZTracker::ChromeAppList(), &rlz)); EXPECT_STREQ(kAppListRlzString, base::UTF16ToUTF8(rlz).c_str()); // Make sure cache is valid. tracker_.set_assume_not_ui_thread(false); - EXPECT_TRUE(RLZTracker::GetAccessPointRlz(RLZTracker::CHROME_OMNIBOX, &rlz)); + EXPECT_TRUE(RLZTracker::GetAccessPointRlz(RLZTracker::ChromeOmnibox(), &rlz)); EXPECT_STREQ(kOmniboxRlzString, base::UTF16ToUTF8(rlz).c_str()); EXPECT_TRUE(RLZTracker::GetAccessPointRlz( - RLZTracker::CHROME_HOME_PAGE, &rlz)); + RLZTracker::ChromeHomePage(), &rlz)); EXPECT_STREQ(kHomepageRlzString, base::UTF16ToUTF8(rlz).c_str()); - EXPECT_TRUE(RLZTracker::GetAccessPointRlz(RLZTracker::CHROME_APP_LIST, &rlz)); + EXPECT_TRUE(RLZTracker::GetAccessPointRlz(RLZTracker::ChromeAppList(), &rlz)); EXPECT_STREQ(kAppListRlzString, base::UTF16ToUTF8(rlz).c_str()); // Perform ping. @@ -799,12 +801,12 @@ TEST_F(RlzLibTest, PingUpdatesRlzCache) { // Make sure cache is now updated. tracker_.set_assume_not_ui_thread(false); - EXPECT_TRUE(RLZTracker::GetAccessPointRlz(RLZTracker::CHROME_OMNIBOX, &rlz)); + EXPECT_TRUE(RLZTracker::GetAccessPointRlz(RLZTracker::ChromeOmnibox(), &rlz)); EXPECT_STREQ(kNewOmniboxRlzString, base::UTF16ToUTF8(rlz).c_str()); EXPECT_TRUE(RLZTracker::GetAccessPointRlz( - RLZTracker::CHROME_HOME_PAGE, &rlz)); + RLZTracker::ChromeHomePage(), &rlz)); EXPECT_STREQ(kNewHomepageRlzString, base::UTF16ToUTF8(rlz).c_str()); - EXPECT_TRUE(RLZTracker::GetAccessPointRlz(RLZTracker::CHROME_APP_LIST, &rlz)); + EXPECT_TRUE(RLZTracker::GetAccessPointRlz(RLZTracker::ChromeAppList(), &rlz)); EXPECT_STREQ(kNewAppListRlzString, base::UTF16ToUTF8(rlz).c_str()); } @@ -868,7 +870,7 @@ TEST_F(RlzLibTest, ReactivationOrganicOrganic) { #if defined(OS_CHROMEOS) TEST_F(RlzLibTest, ClearRlzState) { - RLZTracker::RecordProductEvent(rlz_lib::CHROME, RLZTracker::CHROME_OMNIBOX, + RLZTracker::RecordProductEvent(rlz_lib::CHROME, RLZTracker::ChromeOmnibox(), rlz_lib::FIRST_SEARCH); ExpectEventRecorded(kOmniboxFirstSearch, true); diff --git a/chrome/browser/rlz/rlz_win.cc b/chrome/browser/rlz/rlz_win.cc new file mode 100644 index 0000000..0f96858 --- /dev/null +++ b/chrome/browser/rlz/rlz_win.cc @@ -0,0 +1,20 @@ +// Copyright 2014 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 "chrome/browser/rlz/rlz.h" + +// static +rlz_lib::AccessPoint RLZTracker::ChromeOmnibox() { + return rlz_lib::CHROME_OMNIBOX; +} + +// static +rlz_lib::AccessPoint RLZTracker::ChromeHomePage() { + return rlz_lib::CHROME_HOME_PAGE; +} + +// static +rlz_lib::AccessPoint RLZTracker::ChromeAppList() { + return rlz_lib::CHROME_APP_LIST; +} diff --git a/chrome/browser/search_engines/search_terms_data.cc b/chrome/browser/search_engines/search_terms_data.cc index 77bf0919..dd0ce9c 100644 --- a/chrome/browser/search_engines/search_terms_data.cc +++ b/chrome/browser/search_engines/search_terms_data.cc @@ -125,10 +125,10 @@ base::string16 UIThreadSearchTermsData::GetRlzParameterValue( // This call will return false the first time(s) it is called until the // value has been cached. This normally would mean that at most one omnibox // search might not send the RLZ data but this is not really a problem. - rlz_lib::AccessPoint access_point = RLZTracker::CHROME_OMNIBOX; + rlz_lib::AccessPoint access_point = RLZTracker::ChromeOmnibox(); #if !defined(OS_IOS) if (from_app_list) - access_point = RLZTracker::CHROME_APP_LIST; + access_point = RLZTracker::ChromeAppList(); #endif RLZTracker::GetAccessPointRlz(access_point, &rlz_string); } diff --git a/chrome/browser/search_engines/template_url_service.cc b/chrome/browser/search_engines/template_url_service.cc index bc44c02..98b77dd 100644 --- a/chrome/browser/search_engines/template_url_service.cc +++ b/chrome/browser/search_engines/template_url_service.cc @@ -2042,7 +2042,7 @@ void TemplateURLService::ApplyDefaultSearchChange( GoogleURLTracker::RequestServerCheck(profile_, false); #if defined(ENABLE_RLZ) RLZTracker::RecordProductEvent(rlz_lib::CHROME, - RLZTracker::CHROME_OMNIBOX, + RLZTracker::ChromeOmnibox(), rlz_lib::SET_TO_GOOGLE); #endif } diff --git a/chrome/browser/search_engines/template_url_unittest.cc b/chrome/browser/search_engines/template_url_unittest.cc index 6eee23a..626b5eb 100644 --- a/chrome/browser/search_engines/template_url_unittest.cc +++ b/chrome/browser/search_engines/template_url_unittest.cc @@ -660,7 +660,7 @@ TEST_F(TemplateURLTest, RLZ) { std::string brand; if (google_util::GetBrand(&brand) && !brand.empty() && !google_util::IsOrganic(brand)) { - RLZTracker::GetAccessPointRlz(RLZTracker::CHROME_OMNIBOX, &rlz_string); + RLZTracker::GetAccessPointRlz(RLZTracker::ChromeOmnibox(), &rlz_string); } #elif defined(OS_ANDROID) SearchTermsDataAndroid::rlz_parameter_value_.Get() = @@ -690,7 +690,7 @@ TEST_F(TemplateURLTest, RLZFromAppList) { std::string brand; if (google_util::GetBrand(&brand) && !brand.empty() && !google_util::IsOrganic(brand)) { - RLZTracker::GetAccessPointRlz(RLZTracker::CHROME_APP_LIST, &rlz_string); + RLZTracker::GetAccessPointRlz(RLZTracker::ChromeAppList(), &rlz_string); } #endif diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc index 84149e4..d138558 100644 --- a/chrome/browser/ui/browser_commands.cc +++ b/chrome/browser/ui/browser_commands.cc @@ -446,7 +446,7 @@ void Home(Browser* browser, WindowOpenDisposition disposition) { if (google_util::IsGoogleHomePageUrl( GURL(pref_service->GetString(prefs::kHomePage)))) { extra_headers = RLZTracker::GetAccessPointHttpHeader( - RLZTracker::CHROME_HOME_PAGE); + RLZTracker::ChromeHomePage()); } } #endif // defined(ENABLE_RLZ) && !defined(OS_IOS) @@ -735,7 +735,7 @@ void BookmarkCurrentPage(Browser* browser) { case extensions::CommandService::PAGE_ACTION: browser->window()->ShowPageActionPopup(extension); return; - }; + } } BookmarkCurrentPageInternal(browser); diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl.cc b/chrome/browser/ui/startup/startup_browser_creator_impl.cc index 9ea079f..a811000 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_impl.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_impl.cc @@ -807,7 +807,7 @@ Browser* StartupBrowserCreatorImpl::OpenTabsInBrowser( #if defined(ENABLE_RLZ) && !defined(OS_IOS) if (process_startup && google_util::IsGoogleHomePageUrl(tabs[i].url)) { params.extra_headers = RLZTracker::GetAccessPointHttpHeader( - RLZTracker::CHROME_HOME_PAGE); + RLZTracker::ChromeHomePage()); } #endif // defined(ENABLE_RLZ) && !defined(OS_IOS) diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 96d7acd..afa76f1 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -1863,6 +1863,10 @@ 'browser/resources_util.cc', 'browser/resources_util.h', 'browser/rlz/rlz.cc', + 'browser/rlz/rlz_chromeos.cc', + 'browser/rlz/rlz_ios.mm', + 'browser/rlz/rlz_mac.cc', + 'browser/rlz/rlz_win.cc', 'browser/rlz/rlz.h', 'browser/safe_browsing/binary_feature_extractor_posix.cc', 'browser/safe_browsing/binary_feature_extractor_win.cc', diff --git a/rlz/lib/lib_values.cc b/rlz/lib/lib_values.cc index 80e987a..397668b 100644 --- a/rlz/lib/lib_values.cc +++ b/rlz/lib/lib_values.cc @@ -98,11 +98,8 @@ const char* GetAccessPointName(AccessPoint point) { case CHROMEOS_OMNIBOX: return "CA"; case CHROMEOS_HOME_PAGE: return "CB"; case CHROMEOS_APP_LIST: return "CC"; - case CHROME_IOS_OMNIBOX: return "C9"; - // Returns an invalid access point value here as this value does not - // correspond to a defined access point, but need to be defined for - // code that iterates over all values of rlz_lib::AccessPoint. - case CHROME_IOS_RESERVED: return "__"; + case CHROME_IOS_OMNIBOX_TABLET: return "C9"; + case CHROME_IOS_OMNIBOX_MOBILE: return "CD"; case CHROME_APP_LIST: return "C7"; case CHROME_MAC_APP_LIST: return "C8"; case UNDEFINED_AP_Q: return "RQ"; diff --git a/rlz/lib/rlz_enums.h b/rlz/lib/rlz_enums.h index e50ac2f..e976f86 100644 --- a/rlz/lib/rlz_enums.h +++ b/rlz/lib/rlz_enums.h @@ -62,8 +62,9 @@ enum AccessPoint { CHROMEOS_HOME_PAGE, // ChromeOS searches through Google as home page. CHROMEOS_APP_LIST, // ChromeOS searches through the app launcher search box. - CHROME_IOS_OMNIBOX, // Chrome searches through the address bar omnibox (iOS). - CHROME_IOS_RESERVED, // Reserved for Chrome on iOS. + // Chrome searches through the address bar omnibox (iOS) on tablet or phone. + CHROME_IOS_OMNIBOX_TABLET, + CHROME_IOS_OMNIBOX_MOBILE, CHROME_APP_LIST, // Chrome searches through the app launcher search box. CHROME_MAC_APP_LIST, // Chrome searches through the app launcher search box diff --git a/rlz/lib/rlz_lib.cc b/rlz/lib/rlz_lib.cc index 95e3e09..39bec27 100644 --- a/rlz/lib/rlz_lib.cc +++ b/rlz/lib/rlz_lib.cc @@ -30,7 +30,6 @@ bool IsAccessPointSupported(rlz_lib::AccessPoint point) { switch (point) { case rlz_lib::NO_ACCESS_POINT: case rlz_lib::LAST_ACCESS_POINT: - case rlz_lib::CHROME_IOS_RESERVED: case rlz_lib::MOBILE_IDLE_SCREEN_BLACKBERRY: case rlz_lib::MOBILE_IDLE_SCREEN_WINMOB: |