Skip to content

Commit

Permalink
Revert "Componentize chrome/browser/rlz"
Browse files Browse the repository at this point in the history
This reverts commit 311a465 / #338040,
https://codereview.chromium.org/1212163011/.  The change broke tests in official
builds (http://crbug.com/508659).

BUG=504841, 508148, 508659
TBR=sdefresne@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1229933005 .

Cr-Commit-Position: refs/heads/master@{#338150}
  • Loading branch information
nico committed Jul 9, 2015
1 parent 3a37e07 commit 66706d2
Show file tree
Hide file tree
Showing 38 changed files with 548 additions and 1,130 deletions.
13 changes: 3 additions & 10 deletions build/common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -1494,7 +1494,6 @@

# Whether we are using the rlz library or not. Platforms like Android send
# rlz codes for searches but do not use the library.
'enable_rlz_support%': 0,
'enable_rlz%': 0,

# Turns on the i18n support in V8.
Expand Down Expand Up @@ -2321,15 +2320,9 @@
'release_valgrind_build': 1,
}],

# RLZ library is used on Win, Mac, iOS and ChromeOS.
['OS=="win" or OS=="mac" or OS=="ios" or chromeos==1', {
'enable_rlz_support%': 1,
'conditions': [
# RLZ is enabled for "Chrome" builds.
['branding=="Chrome"', {
'enable_rlz%': 1,
}],
],
# Enable RLZ on Win, Mac, iOS and ChromeOS.
['branding=="Chrome" and (OS=="win" or OS=="mac" or OS=="ios" or chromeos==1)', {
'enable_rlz%': 1,
}],

# Set default compiler flags depending on ARM version.
Expand Down
3 changes: 1 addition & 2 deletions build/config/features.gni
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ win_pdf_metafile_for_printing = true

# Whether we are using the rlz library or not. Platforms like Android send
# rlz codes for searches but do not use the library.
enable_rlz_support = is_win || is_mac || is_ios || is_chromeos
enable_rlz = is_chrome_branded && enable_rlz_support
enable_rlz = is_chrome_branded && (is_win || is_mac || is_ios || is_chromeos)

enable_settings_app = enable_app_list && !is_chromeos

Expand Down
18 changes: 3 additions & 15 deletions chrome/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,9 @@ source_set("browser") {
}

if (enable_rlz) {
deps += [ ":rlz" ]
sources +=
rebase_path(gypi_values.chrome_browser_rlz_sources, ".", "//chrome")
deps += [ "//rlz:rlz_lib" ]
}

# TODO(GYP)
Expand Down Expand Up @@ -1195,17 +1197,3 @@ source_set("test_support") {
]
}
}

if (enable_rlz_support) {
source_set("rlz") {
sources =
rebase_path(gypi_values.chrome_browser_rlz_sources, ".", "//chrome")
deps = [
"//components/google/core/browser",
"//components/omnibox/browser",
"//components/rlz",
"//components/search_engines",
"//rlz:rlz_lib",
]
}
}
1 change: 0 additions & 1 deletion chrome/browser/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ include_rules = [
"+components/query_parser",
"+components/rappor",
"+components/renderer_context_menu",
"+components/rlz",
"+components/safe_json",
"+components/search",
"+components/search_engines",
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/browser_shutdown.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#endif

#if defined(ENABLE_RLZ)
#include "components/rlz/rlz_tracker.h"
#include "chrome/browser/rlz/rlz.h"
#endif

#if defined(OS_CHROMEOS)
Expand Down Expand Up @@ -192,7 +192,7 @@ bool ShutdownPreThreadsStop() {
#if defined(ENABLE_RLZ)
// Cleanup any statics created by RLZ. Must be done before NotificationService
// is destroyed.
rlz::RLZTracker::CleanupRlz();
RLZTracker::CleanupRlz();
#endif

return restart_last_session;
Expand Down
14 changes: 4 additions & 10 deletions chrome/browser/chrome_browser_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,7 @@
#endif // defined(ENABLE_PRINT_PREVIEW) && !defined(OFFICIAL_BUILD)

#if defined(ENABLE_RLZ)
#include "chrome/browser/rlz/chrome_rlz_tracker_delegate.h"
#include "components/rlz/rlz_tracker.h"
#include "chrome/browser/rlz/rlz.h"
#endif // defined(ENABLE_RLZ)

#if defined(ENABLE_WEBRTC)
Expand Down Expand Up @@ -1452,14 +1451,9 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
pref_service->GetInteger(first_run::GetPingDelayPrefName().c_str());
// Negative ping delay means to send ping immediately after a first search is
// recorded.
rlz::RLZTracker::SetRlzDelegate(
make_scoped_ptr(new ChromeRLZTrackerDelegate));
rlz::RLZTracker::InitRlzDelayed(
first_run::IsChromeFirstRun(), ping_delay < 0,
base::TimeDelta::FromMilliseconds(abs(ping_delay)),
ChromeRLZTrackerDelegate::IsGoogleDefaultSearch(profile_),
ChromeRLZTrackerDelegate::IsGoogleHomePage(profile_),
ChromeRLZTrackerDelegate::IsGoogleInStartpages(profile_));
RLZTracker::InitRlzFromProfileDelayed(
profile_, first_run::IsChromeFirstRun(), ping_delay < 0,
base::TimeDelta::FromMilliseconds(abs(ping_delay)));
#endif // defined(ENABLE_RLZ) && !defined(OS_CHROMEOS)

// Configure modules that need access to resources.
Expand Down
5 changes: 1 addition & 4 deletions chrome/browser/chromeos/chrome_browser_main_chromeos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
#include "chrome/browser/net/chrome_network_delegate.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/rlz/rlz.h"
#include "chrome/browser/ui/ash/network_connect_delegate_chromeos.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
Expand Down Expand Up @@ -128,10 +129,6 @@
#include "ui/base/touch/touch_device.h"
#include "ui/events/event_utils.h"

#if defined(ENABLE_RLZ)
#include "components/rlz/rlz_tracker.h"
#endif

// Exclude X11 dependents for ozone
#if defined(USE_X11)
#include "chrome/browser/chromeos/device_uma.h"
Expand Down
13 changes: 6 additions & 7 deletions chrome/browser/chromeos/login/login_utils_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "chrome/browser/chromeos/login/test/oobe_base_test.h"
#include "chrome/browser/chromeos/login/ui/webui_login_display.h"
#include "chrome/browser/chromeos/login/wizard_controller.h"
#include "chrome/browser/rlz/rlz.h"
#include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
Expand All @@ -28,10 +29,6 @@
#include "net/test/embedded_test_server/http_response.h"
#include "testing/gtest/include/gtest/gtest.h"

#if defined(ENABLE_RLZ)
#include "components/rlz/rlz_tracker.h"
#endif

namespace chromeos {

namespace {
Expand All @@ -40,7 +37,7 @@ namespace {
void GetAccessPointRlzInBackgroundThread(rlz_lib::AccessPoint point,
base::string16* rlz) {
ASSERT_FALSE(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
ASSERT_TRUE(rlz::RLZTracker::GetAccessPointRlz(point, rlz));
ASSERT_TRUE(RLZTracker::GetAccessPointRlz(point, rlz));
}
#endif

Expand Down Expand Up @@ -109,8 +106,10 @@ IN_PROC_BROWSER_TEST_P(LoginUtilsTest, RlzInitialized) {
base::RunLoop loop;
base::string16 rlz_string;
content::BrowserThread::PostBlockingPoolTaskAndReply(
FROM_HERE, base::Bind(&GetAccessPointRlzInBackgroundThread,
rlz::RLZTracker::ChromeHomePage(), &rlz_string),
FROM_HERE,
base::Bind(&GetAccessPointRlzInBackgroundThread,
RLZTracker::ChromeHomePage(),
&rlz_string),
loop.QuitClosure());
loop.Run();
EXPECT_EQ(base::string16(), rlz_string);
Expand Down
21 changes: 7 additions & 14 deletions chrome/browser/chromeos/login/session/user_session_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#include "chrome/browser/prefs/session_startup_pref.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/rlz/rlz.h"
#include "chrome/browser/signin/account_tracker_service_factory.h"
#include "chrome/browser/signin/easy_unlock_service.h"
#include "chrome/browser/signin/signin_manager_factory.h"
Expand Down Expand Up @@ -100,11 +101,6 @@
#include "ui/base/ime/chromeos/input_method_manager.h"
#include "url/gurl.h"

#if defined(ENABLE_RLZ)
#include "chrome/browser/rlz/chrome_rlz_tracker_delegate.h"
#include "components/rlz/rlz_tracker.h"
#endif

namespace chromeos {

namespace {
Expand Down Expand Up @@ -1302,22 +1298,19 @@ void UserSessionManager::InitRlzImpl(Profile* profile, bool disabled) {
}
if (disabled != local_state->GetBoolean(prefs::kRLZDisabled)) {
// When switching to RLZ enabled/disabled state, clear all recorded events.
rlz::RLZTracker::ClearRlzState();
RLZTracker::ClearRlzState();
local_state->SetBoolean(prefs::kRLZDisabled, disabled);
}
// Init the RLZ library.
int ping_delay = profile->GetPrefs()->GetInteger(
::first_run::GetPingDelayPrefName().c_str());
// Negative ping delay means to send ping immediately after a first search is
// recorded.
rlz::RLZTracker::SetRlzDelegate(
make_scoped_ptr(new ChromeRLZTrackerDelegate));
rlz::RLZTracker::InitRlzDelayed(
user_manager::UserManager::Get()->IsCurrentUserNew(), ping_delay < 0,
base::TimeDelta::FromMilliseconds(abs(ping_delay)),
ChromeRLZTrackerDelegate::IsGoogleDefaultSearch(profile),
ChromeRLZTrackerDelegate::IsGoogleHomepage(profile),
ChromeRLZTrackerDelegate::IsGoogleInStartpages(profile));
RLZTracker::InitRlzFromProfileDelayed(
profile,
user_manager::UserManager::Get()->IsCurrentUserNew(),
ping_delay < 0,
base::TimeDelta::FromMilliseconds(abs(ping_delay)));
#endif
}

Expand Down
Loading

0 comments on commit 66706d2

Please sign in to comment.