diff --git a/chrome/browser/chrome_browser_main_win.cc b/chrome/browser/chrome_browser_main_win.cc index ff6c5f1..cd155a0b 100644 --- a/chrome/browser/chrome_browser_main_win.cc +++ b/chrome/browser/chrome_browser_main_win.cc
@@ -494,7 +494,7 @@ base::FilePath exe_path; PathService::Get(base::DIR_EXE, &exe_path); std::wstring exe = exe_path.value(); - base::FilePath user_exe_path(installer::GetChromeInstallPath(false, dist)); + base::FilePath user_exe_path(installer::GetChromeInstallPath(false)); if (base::FilePath::CompareEqualIgnoreCase(exe, user_exe_path.value())) { base::CommandLine uninstall_cmd( InstallUtil::GetChromeUninstallCmd(false));
diff --git a/chrome/browser/google/google_update_win.cc b/chrome/browser/google/google_update_win.cc index c70b2a1..a0b8698 100644 --- a/chrome/browser/google/google_update_win.cc +++ b/chrome/browser/google/google_update_win.cc
@@ -34,7 +34,6 @@ #include "chrome/common/url_constants.h" #include "chrome/grit/generated_resources.h" #include "chrome/install_static/install_util.h" -#include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/google_update_settings.h" #include "chrome/installer/util/helper.h" #include "chrome/installer/util/install_util.h" @@ -94,9 +93,8 @@ const base::FilePath& chrome_exe_path, bool system_level_install) { DCHECK_NE(InstallUtil::IsPerUserInstall(), system_level_install); - BrowserDistribution* dist = BrowserDistribution::GetDistribution(); - base::FilePath user_exe_path = installer::GetChromeInstallPath(false, dist); - base::FilePath machine_exe_path = installer::GetChromeInstallPath(true, dist); + base::FilePath user_exe_path = installer::GetChromeInstallPath(false); + base::FilePath machine_exe_path = installer::GetChromeInstallPath(true); if (!base::FilePath::CompareEqualIgnoreCase(chrome_exe_path.value(), user_exe_path.value()) && !base::FilePath::CompareEqualIgnoreCase(chrome_exe_path.value(),
diff --git a/chrome/browser/google/google_update_win_unittest.cc b/chrome/browser/google/google_update_win_unittest.cc index 944c3955..033fa73 100644 --- a/chrome/browser/google/google_update_win_unittest.cc +++ b/chrome/browser/google/google_update_win_unittest.cc
@@ -27,7 +27,6 @@ #include "base/win/scoped_comptr.h" #include "chrome/common/chrome_version.h" #include "chrome/install_static/test/scoped_install_details.h" -#include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/google_update_settings.h" #include "chrome/installer/util/helper.h" #include "google_update/google_update_idl.h" @@ -542,8 +541,8 @@ // standard install location for this mode (system-level or user-level). base::FilePath file_exe; ASSERT_TRUE(PathService::Get(base::FILE_EXE, &file_exe)); - base::FilePath install_dir(installer::GetChromeInstallPath( - system_level_install_, BrowserDistribution::GetDistribution())); + base::FilePath install_dir( + installer::GetChromeInstallPath(system_level_install_)); file_exe_override_.reset(new base::ScopedPathOverride( base::FILE_EXE, install_dir.Append(file_exe.BaseName()), true /* is_absolute */, false /* create */));
diff --git a/chrome/browser/media/router/mojo/media_router_mojo_impl.cc b/chrome/browser/media/router/mojo/media_router_mojo_impl.cc index 82bf5d6..edec152b 100644 --- a/chrome/browser/media/router/mojo/media_router_mojo_impl.cc +++ b/chrome/browser/media/router/mojo/media_router_mojo_impl.cc
@@ -185,18 +185,17 @@ } auto* sinks_query = it->second.get(); - sinks_query->has_cached_result = true; - sinks_query->origins = origins; sinks_query->cached_sink_list = sinks; + sinks_query->origins = origins; - if (!sinks_query->observers.might_have_observers()) { - DVLOG_WITH_INSTANCE(1) - << "Received sink list without any active observers: " << media_source; - } else { + if (sinks_query->observers.might_have_observers()) { for (auto& observer : sinks_query->observers) { - observer.OnSinksUpdated(sinks_query->cached_sink_list, + observer.OnSinksUpdated(*sinks_query->cached_sink_list, sinks_query->origins); } + } else { + DVLOG_WITH_INSTANCE(1) + << "Received sink list without any active observers: " << media_source; } } @@ -215,8 +214,18 @@ return; } - for (auto& observer : it->second->observers) - observer.OnRoutesUpdated(routes, joinable_route_ids); + auto* routes_query = it->second.get(); + routes_query->cached_route_list = routes; + routes_query->joinable_route_ids = joinable_route_ids; + + if (routes_query->observers.might_have_observers()) { + for (auto& observer : routes_query->observers) + observer.OnRoutesUpdated(routes, joinable_route_ids); + } else { + DVLOG_WITH_INSTANCE(1) + << "Received routes update without any active observers: " + << media_source; + } } void MediaRouterMojoImpl::RouteResponseReceived( @@ -393,9 +402,9 @@ // to it. Fail if |observer| is already registered. const std::string& source_id = observer->source().id(); std::unique_ptr<MediaSinksQuery>& sinks_query = sinks_queries_[source_id]; - bool new_query = false; + bool is_new_query = false; if (!sinks_query) { - new_query = true; + is_new_query = true; sinks_query = base::MakeUnique<MediaSinksQuery>(); } else { DCHECK(!sinks_query->observers.HasObserver(observer)); @@ -409,12 +418,12 @@ std::vector<url::Origin>()); } else { // Need to call MRPM to start observing sinks if the query is new. - if (new_query) { + if (is_new_query) { SetWakeReason(MediaRouteProviderWakeReason::START_OBSERVING_MEDIA_SINKS); RunOrDefer(base::Bind(&MediaRouterMojoImpl::DoStartObservingMediaSinks, base::Unretained(this), source_id)); - } else if (sinks_query->has_cached_result) { - observer->OnSinksUpdated(sinks_query->cached_sink_list, + } else if (sinks_query->cached_sink_list) { + observer->OnSinksUpdated(*sinks_query->cached_sink_list, sinks_query->origins); } } @@ -459,16 +468,48 @@ DCHECK_CURRENTLY_ON(content::BrowserThread::UI); const MediaSource::Id source_id = observer->source_id(); auto& routes_query = routes_queries_[source_id]; + bool is_new_query = false; if (!routes_query) { + is_new_query = true; routes_query = base::MakeUnique<MediaRoutesQuery>(); } else { DCHECK(!routes_query->observers.HasObserver(observer)); } routes_query->observers.AddObserver(observer); - SetWakeReason(MediaRouteProviderWakeReason::START_OBSERVING_MEDIA_ROUTES); - RunOrDefer(base::Bind(&MediaRouterMojoImpl::DoStartObservingMediaRoutes, - base::Unretained(this), source_id)); + if (is_new_query) { + SetWakeReason(MediaRouteProviderWakeReason::START_OBSERVING_MEDIA_ROUTES); + RunOrDefer(base::Bind(&MediaRouterMojoImpl::DoStartObservingMediaRoutes, + base::Unretained(this), source_id)); + // The MRPM will call MediaRouterMojoImpl::OnRoutesUpdated() soon, if there + // are any existing routes the new observer should be aware of. + } else if (routes_query->cached_route_list) { + // Return to the event loop before notifying of a cached route list because + // MediaRoutesObserver is calling this method from its constructor, and that + // must complete before invoking its virtual OnRoutesUpdated() method. + content::BrowserThread::PostTask( + content::BrowserThread::UI, FROM_HERE, + base::Bind(&MediaRouterMojoImpl::NotifyOfExistingRoutesIfRegistered, + weak_factory_.GetWeakPtr(), source_id, observer)); + } +} + +void MediaRouterMojoImpl::NotifyOfExistingRoutesIfRegistered( + const MediaSource::Id& source_id, + MediaRoutesObserver* observer) const { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + + // Check that the route query still exists with a cached result, and that the + // observer is still registered. Otherwise, there is nothing to report to the + // observer. + const auto it = routes_queries_.find(source_id); + if (it == routes_queries_.end() || !it->second->cached_route_list || + !it->second->observers.HasObserver(observer)) { + return; + } + + observer->OnRoutesUpdated(*it->second->cached_route_list, + it->second->joinable_route_ids); } void MediaRouterMojoImpl::UnregisterMediaRoutesObserver( @@ -685,8 +726,7 @@ for (auto& source_and_query : sinks_queries_) { const auto& query = source_and_query.second; query->is_active = false; - query->has_cached_result = false; - query->cached_sink_list.clear(); + query->cached_sink_list = base::nullopt; query->origins.clear(); } } else {
diff --git a/chrome/browser/media/router/mojo/media_router_mojo_impl.h b/chrome/browser/media/router/mojo/media_router_mojo_impl.h index 73d7187..b5c0d70 100644 --- a/chrome/browser/media/router/mojo/media_router_mojo_impl.h +++ b/chrome/browser/media/router/mojo/media_router_mojo_impl.h
@@ -20,6 +20,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" +#include "base/optional.h" #include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" #include "chrome/browser/media/router/issue.h" @@ -170,13 +171,10 @@ // True if the query has been sent to the MRPM. bool is_active = false; - // True if cached result is available. - bool has_cached_result = false; - - // Cached list of sinks for the query, if |has_cached_result| is true. - // Empty otherwise. - std::vector<MediaSink> cached_sink_list; + // Cached list of sinks and origins for the query. + base::Optional<std::vector<MediaSink>> cached_sink_list; std::vector<url::Origin> origins; + base::ObserverList<MediaSinksObserver> observers; private: @@ -190,6 +188,11 @@ // True if the query has been sent to the MRPM. False otherwise. bool is_active = false; + + // Cached list of routes and joinable route IDs for the query. + base::Optional<std::vector<MediaRoute>> cached_route_list; + std::vector<std::string> joinable_route_ids; + base::ObserverList<MediaRoutesObserver> observers; private: @@ -232,6 +235,11 @@ void RegisterRouteMessageObserver(RouteMessageObserver* observer) override; void UnregisterRouteMessageObserver(RouteMessageObserver* observer) override; + // Notifies |observer| of any existing cached routes, if it is still + // registered. + void NotifyOfExistingRoutesIfRegistered(const MediaSource::Id& source_id, + MediaRoutesObserver* observer) const; + // These calls invoke methods in the component extension via Mojo. void DoCreateRoute(const MediaSource::Id& source_id, const MediaSink::Id& sink_id,
diff --git a/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc b/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc index 45ed335..20dfac3 100644 --- a/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc +++ b/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc
@@ -56,6 +56,7 @@ using testing::Return; using testing::ReturnRef; using testing::SaveArg; +using testing::Sequence; namespace media_router { @@ -806,7 +807,7 @@ MediaSource different_media_source(kSource2); EXPECT_CALL(mock_media_route_provider_, StartObservingMediaRoutes(media_source.id())) - .Times(2); + .Times(1); EXPECT_CALL( mock_media_route_provider_, StartObservingMediaRoutes(different_media_source.id())) @@ -869,6 +870,62 @@ ProcessEventLoop(); } +// Tests that multiple MediaRoutesObservers having the same query do not cause +// extra extension wake-ups because the OnRoutesUpdated() results are cached. +TEST_F(MediaRouterMojoImplTest, RegisterMediaRoutesObserver_DedupingWithCache) { + const MediaSource media_source = MediaSource(kSource); + std::vector<MediaRoute> expected_routes; + expected_routes.push_back(MediaRoute(kRouteId, media_source, kSinkId, + kDescription, false, "", false)); + std::vector<MediaRoute::Id> expected_joinable_route_ids; + expected_joinable_route_ids.push_back(kJoinableRouteId); + + Sequence sequence; + + // Creating the first observer will wake-up the provider and ask it to start + // observing routes having source |kSource|. The provider will respond with + // the existing route. + EXPECT_CALL(mock_media_route_provider_, + StartObservingMediaRoutes(media_source.id())) + .Times(1); + std::unique_ptr<MockMediaRoutesObserver> observer1( + new MockMediaRoutesObserver(router(), media_source.id())); + ProcessEventLoop(); + EXPECT_CALL(*observer1, OnRoutesUpdated(SequenceEquals(expected_routes), + expected_joinable_route_ids)) + .Times(1); + media_router_proxy_->OnRoutesUpdated(expected_routes, media_source.id(), + expected_joinable_route_ids); + ProcessEventLoop(); + + // Creating two more observers will not wake up the provider. Instead, the + // cached route list will be returned. + std::unique_ptr<MockMediaRoutesObserver> observer2( + new MockMediaRoutesObserver(router(), media_source.id())); + std::unique_ptr<MockMediaRoutesObserver> observer3( + new MockMediaRoutesObserver(router(), media_source.id())); + EXPECT_CALL(*observer2, OnRoutesUpdated(SequenceEquals(expected_routes), + expected_joinable_route_ids)) + .Times(1); + EXPECT_CALL(*observer3, OnRoutesUpdated(SequenceEquals(expected_routes), + expected_joinable_route_ids)) + .Times(1); + ProcessEventLoop(); + + // Kill 2 of three observers, and expect nothing happens at the provider. + observer1.reset(); + observer2.reset(); + ProcessEventLoop(); + + // Kill the final observer, and expect the provider to be woken-up and called + // with the "stop observing" notification. + EXPECT_CALL(mock_media_route_provider_, + StopObservingMediaRoutes(media_source.id())) + .Times(1); + observer3.reset(); + ProcessEventLoop(); +} + TEST_F(MediaRouterMojoImplTest, SendRouteMessage) { EXPECT_CALL( mock_media_route_provider_, SendRouteMessage(kRouteId, kMessage, _))
diff --git a/chrome/common/BUILD.gn b/chrome/common/BUILD.gn index 856a1d4..947ce713 100644 --- a/chrome/common/BUILD.gn +++ b/chrome/common/BUILD.gn
@@ -608,6 +608,10 @@ # implemented in //ui/base, so we need that dependency. deps += [ "//ui/base" ] } + + if (is_win) { + deps += [ "//chrome/install_static:install_static_util" ] + } } if (is_win) {
diff --git a/chrome/common/chrome_paths_win.cc b/chrome/common/chrome_paths_win.cc index 767f967..5cc2f12 100644 --- a/chrome/common/chrome_paths_win.cc +++ b/chrome/common/chrome_paths_win.cc
@@ -16,7 +16,7 @@ #include "base/win/scoped_co_mem.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" -#include "chrome/installer/util/browser_distribution.h" +#include "chrome/install_static/install_util.h" #include "components/nacl/common/nacl_switches.h" namespace chrome { @@ -45,8 +45,7 @@ bool GetDefaultUserDataDirectory(base::FilePath* result) { if (!PathService::Get(base::DIR_LOCAL_APP_DATA, result)) return false; - BrowserDistribution* dist = BrowserDistribution::GetDistribution(); - *result = result->Append(dist->GetInstallSubDir()); + *result = result->Append(install_static::GetChromeInstallSubDirectory()); *result = result->Append(chrome::kUserDataDirname); return true; } @@ -54,8 +53,7 @@ bool GetDefaultRoamingUserDataDirectory(base::FilePath* result) { if (!PathService::Get(base::DIR_APP_DATA, result)) return false; - BrowserDistribution* dist = BrowserDistribution::GetDistribution(); - *result = result->Append(dist->GetInstallSubDir()); + *result = result->Append(install_static::GetChromeInstallSubDirectory()); *result = result->Append(chrome::kUserDataDirname); return true; }
diff --git a/chrome/install_static/install_util.cc b/chrome/install_static/install_util.cc index 5848021..4ee841e 100644 --- a/chrome/install_static/install_util.cc +++ b/chrome/install_static/install_util.cc
@@ -311,6 +311,13 @@ return InstallDetails::Get().system_level(); } +std::wstring GetChromeInstallSubDirectory() { + std::wstring result; + AppendChromeInstallSubDirectory(InstallDetails::Get().mode(), + true /* include_suffix */, &result); + return result; +} + const wchar_t* GetAppGuid() { return InstallDetails::Get().app_guid(); }
diff --git a/chrome/install_static/install_util.h b/chrome/install_static/install_util.h index 9dc3be1b..fcb41e6 100644 --- a/chrome/install_static/install_util.h +++ b/chrome/install_static/install_util.h
@@ -54,6 +54,9 @@ // Returns true if Chrome is running at system level. bool IsSystemInstall(); +// Returns the string "[kCompanyPathName\]kProductPathName[install_suffix]" +std::wstring GetChromeInstallSubDirectory(); + // Returns the app GUID with which Chrome is registered with Google Update, or // an empty string if this brand does not integrate with Google Update. This is // a simple convenience wrapper around InstallDetails.
diff --git a/chrome/install_static/install_util_unittest.cc b/chrome/install_static/install_util_unittest.cc index 1f9b1640..7653e8a 100644 --- a/chrome/install_static/install_util_unittest.cc +++ b/chrome/install_static/install_util_unittest.cc
@@ -343,6 +343,26 @@ DISALLOW_COPY_AND_ASSIGN(InstallStaticUtilTest); }; +TEST_P(InstallStaticUtilTest, GetChromeInstallSubDirectory) { +#if defined(GOOGLE_CHROME_BUILD) + // The directory strings for the brand's install modes; parallel to + // kInstallModes. + static constexpr const wchar_t* kInstallDirs[] = { + L"Google\\Chrome", L"Google\\Chrome SxS", + }; +#else + // The directory strings for the brand's install modes; parallel to + // kInstallModes. + static constexpr const wchar_t* kInstallDirs[] = { + L"Chromium", + }; +#endif + static_assert(arraysize(kInstallDirs) == NUM_INSTALL_MODES, + "kInstallDirs out of date."); + EXPECT_THAT(GetChromeInstallSubDirectory(), + StrCaseEq(kInstallDirs[std::get<0>(GetParam())])); +} + TEST_P(InstallStaticUtilTest, GetAppGuid) { // For brands that do not integrate with Omaha/Google Update, the app guid is // an empty string.
diff --git a/chrome/installer/setup/install_worker_unittest.cc b/chrome/installer/setup/install_worker_unittest.cc index 34f3aae..e746e204 100644 --- a/chrome/installer/setup/install_worker_unittest.cc +++ b/chrome/installer/setup/install_worker_unittest.cc
@@ -198,9 +198,7 @@ product_state.set_version(new base::Version(*current_version_)); product_state.set_brand(L"TEST"); product_state.set_eula_accepted(1); - BrowserDistribution* dist = BrowserDistribution::GetDistribution(); - base::FilePath install_path = - installer::GetChromeInstallPath(system_level, dist); + base::FilePath install_path = installer::GetChromeInstallPath(system_level); product_state.SetUninstallProgram( install_path.AppendASCII(current_version_->GetString()) .Append(installer::kInstallerDir)
diff --git a/chrome/installer/setup/installer_state.cc b/chrome/installer/setup/installer_state.cc index 0578dbe..6dd4a148 100644 --- a/chrome/installer/setup/installer_state.cc +++ b/chrome/installer/setup/installer_state.cc
@@ -133,9 +133,10 @@ return nullptr; if (target_path_.empty()) { - target_path_ = product_dir ? *product_dir : GetChromeInstallPath( - system_install(), - the_product.distribution()); + DCHECK_EQ(BrowserDistribution::GetDistribution(), + the_product.distribution()); + target_path_ = + product_dir ? *product_dir : GetChromeInstallPath(system_install()); } if (state_key_.empty())
diff --git a/chrome/installer/setup/installer_state_unittest.cc b/chrome/installer/setup/installer_state_unittest.cc index f4d36e3..f13a745 100644 --- a/chrome/installer/setup/installer_state_unittest.cc +++ b/chrome/installer/setup/installer_state_unittest.cc
@@ -24,6 +24,7 @@ #include "base/win/registry.h" #include "base/win/scoped_handle.h" #include "chrome/common/chrome_constants.h" +#include "chrome/install_static/install_util.h" #include "chrome/installer/util/fake_installation_state.h" #include "chrome/installer/util/fake_product_state.h" #include "chrome/installer/util/google_update_constants.h" @@ -183,9 +184,8 @@ EXPECT_EQ(InstallerState::USER_LEVEL, installer_state.level()); EXPECT_EQ(InstallerState::SINGLE_INSTALL_OR_UPDATE, installer_state.operation()); - EXPECT_TRUE(wcsstr( - installer_state.target_path().value().c_str(), - BrowserDistribution::GetDistribution()->GetInstallSubDir().c_str())); + EXPECT_TRUE(wcsstr(installer_state.target_path().value().c_str(), + install_static::GetChromeInstallSubDirectory().c_str())); EXPECT_FALSE(installer_state.verbose_logging()); EXPECT_EQ(installer_state.state_key(), BrowserDistribution::GetDistribution()->GetStateKey()); @@ -202,9 +202,8 @@ EXPECT_EQ(InstallerState::SYSTEM_LEVEL, installer_state.level()); EXPECT_EQ(InstallerState::SINGLE_INSTALL_OR_UPDATE, installer_state.operation()); - EXPECT_TRUE(wcsstr( - installer_state.target_path().value().c_str(), - BrowserDistribution::GetDistribution()->GetInstallSubDir().c_str())); + EXPECT_TRUE(wcsstr(installer_state.target_path().value().c_str(), + install_static::GetChromeInstallSubDirectory().c_str())); EXPECT_TRUE(installer_state.verbose_logging()); EXPECT_EQ(installer_state.state_key(), BrowserDistribution::GetDistribution()->GetStateKey());
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index 7481e5f..b8d66b6 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc
@@ -490,6 +490,7 @@ // on top of an existing system-level installation. const Product& product = installer_state.product(); BrowserDistribution* browser_dist = product.distribution(); + DCHECK_EQ(BrowserDistribution::GetDistribution(), browser_dist); const ProductState* user_level_product_state = original_state.GetProductState(false); @@ -511,8 +512,7 @@ // Instruct Google Update to launch the existing system-level Chrome. // There should be no error dialog. base::FilePath install_path( - installer::GetChromeInstallPath(true, // system - browser_dist)); + installer::GetChromeInstallPath(true /* system_install */)); if (install_path.empty()) { // Give up if we failed to construct the install path. *status = installer::OS_ERROR; @@ -590,17 +590,16 @@ const InstallerState& installer_state, const base::FilePath& setup_exe, const base::CommandLine& cmd_line) { + DCHECK_EQ(BrowserDistribution::GetDistribution(), + installer_state.product().distribution()); // System-level Chrome will be launched via this command if its program gets // set below. base::CommandLine system_level_cmd(base::CommandLine::NO_PROGRAM); - const Product& chrome = installer_state.product(); if (cmd_line.HasSwitch(installer::switches::kSelfDestruct) && !installer_state.system_install()) { - BrowserDistribution* dist = chrome.distribution(); const base::FilePath system_exe_path( - installer::GetChromeInstallPath(true, dist) - .Append(installer::kChromeExe)); + installer::GetChromeInstallPath(true).Append(installer::kChromeExe)); system_level_cmd.SetProgram(system_exe_path); }
diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc index 9140d27..b556a4a 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc
@@ -823,6 +823,7 @@ const base::CommandLine& cmd_line) { InstallStatus status = installer::UNINSTALL_CONFIRMED; BrowserDistribution* browser_dist = product.distribution(); + DCHECK_EQ(BrowserDistribution::GetDistribution(), browser_dist); const base::FilePath chrome_exe( installer_state.target_path().Append(installer::kChromeExe)); @@ -883,7 +884,7 @@ if (cmd_line.HasSwitch(installer::switches::kSelfDestruct) && !installer_state.system_install()) { const base::FilePath system_chrome_path( - GetChromeInstallPath(true, browser_dist).Append(installer::kChromeExe)); + GetChromeInstallPath(true).Append(installer::kChromeExe)); VLOG(1) << "Retargeting user-generated Chrome shortcuts."; if (base::PathExists(system_chrome_path)) { RetargetUserShortcutsWithArgs(installer_state, product, chrome_exe,
diff --git a/chrome/installer/util/browser_distribution.cc b/chrome/installer/util/browser_distribution.cc index 6dda8cd..009b095 100644 --- a/chrome/installer/util/browser_distribution.cc +++ b/chrome/installer/util/browser_distribution.cc
@@ -20,6 +20,7 @@ #include "base/win/windows_version.h" #include "chrome/common/chrome_icon_resources_win.h" #include "chrome/common/env_vars.h" +#include "chrome/install_static/install_util.h" #include "chrome/installer/util/app_registration_data.h" #include "chrome/installer/util/google_chrome_distribution.h" #include "chrome/installer/util/google_chrome_sxs_distribution.h" @@ -160,10 +161,6 @@ } -base::string16 BrowserDistribution::GetInstallSubDir() { - return L"Chromium"; -} - base::string16 BrowserDistribution::GetPublisherName() { return L"Chromium"; } @@ -187,7 +184,8 @@ } base::string16 BrowserDistribution::GetRegistryPath() { - return base::string16(L"Software\\").append(GetInstallSubDir()); + return base::string16(L"Software\\") + .append(install_static::GetChromeInstallSubDirectory()); } base::string16 BrowserDistribution::GetUninstallRegPath() {
diff --git a/chrome/installer/util/browser_distribution.h b/chrome/installer/util/browser_distribution.h index 4a0c40f..5d0978d 100644 --- a/chrome/installer/util/browser_distribution.h +++ b/chrome/installer/util/browser_distribution.h
@@ -98,8 +98,6 @@ // Returns the Browser ProgId description. virtual base::string16 GetBrowserProgIdDesc(); - virtual base::string16 GetInstallSubDir(); - virtual base::string16 GetPublisherName(); virtual base::string16 GetAppDescription();
diff --git a/chrome/installer/util/fake_installation_state.h b/chrome/installer/util/fake_installation_state.h index 3f64218..e7af25c9 100644 --- a/chrome/installer/util/fake_installation_state.h +++ b/chrome/installer/util/fake_installation_state.h
@@ -21,8 +21,7 @@ void AddChrome(bool system_install, base::Version* version) { FakeProductState chrome_state; chrome_state.set_version(version); - base::FilePath setup_exe(GetChromeInstallPath( - system_install, BrowserDistribution::GetDistribution())); + base::FilePath setup_exe(GetChromeInstallPath(system_install)); setup_exe = setup_exe .AppendASCII(version->GetString()) .Append(kInstallerDir)
diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc index c4701ed..3134ba7 100644 --- a/chrome/installer/util/google_chrome_distribution.cc +++ b/chrome/installer/util/google_chrome_distribution.cc
@@ -178,13 +178,6 @@ return kBrowserProgIdDesc; } -base::string16 GoogleChromeDistribution::GetInstallSubDir() { - base::string16 sub_dir(installer::kGoogleChromeInstallSubDir1); - sub_dir.append(L"\\"); - sub_dir.append(installer::kGoogleChromeInstallSubDir2); - return sub_dir; -} - base::string16 GoogleChromeDistribution::GetPublisherName() { const base::string16& publisher_name = installer::GetLocalizedString(IDS_ABOUT_VERSION_COMPANY_NAME_BASE);
diff --git a/chrome/installer/util/google_chrome_distribution.h b/chrome/installer/util/google_chrome_distribution.h index 415d570..3763ee1e 100644 --- a/chrome/installer/util/google_chrome_distribution.h +++ b/chrome/installer/util/google_chrome_distribution.h
@@ -51,8 +51,6 @@ base::string16 GetBrowserProgIdDesc() override; - base::string16 GetInstallSubDir() override; - base::string16 GetPublisherName() override; base::string16 GetAppDescription() override;
diff --git a/chrome/installer/util/google_chrome_distribution_dummy.cc b/chrome/installer/util/google_chrome_distribution_dummy.cc index f2e8ec7..7844c6f 100644 --- a/chrome/installer/util/google_chrome_distribution_dummy.cc +++ b/chrome/installer/util/google_chrome_distribution_dummy.cc
@@ -64,10 +64,6 @@ return base::string16(); } -base::string16 GoogleChromeDistribution::GetInstallSubDir() { - return base::string16(); -} - base::string16 GoogleChromeDistribution::GetPublisherName() { return base::string16(); }
diff --git a/chrome/installer/util/google_chrome_sxs_distribution.cc b/chrome/installer/util/google_chrome_sxs_distribution.cc index 4401118..2646e6e 100644 --- a/chrome/installer/util/google_chrome_sxs_distribution.cc +++ b/chrome/installer/util/google_chrome_sxs_distribution.cc
@@ -59,11 +59,6 @@ return kBrowserProgIdDesc; } -base::string16 GoogleChromeSxSDistribution::GetInstallSubDir() { - return GoogleChromeDistribution::GetInstallSubDir().append( - installer::kSxSSuffix); -} - base::string16 GoogleChromeSxSDistribution::GetUninstallRegPath() { return GoogleChromeDistribution::GetUninstallRegPath().append( installer::kSxSSuffix);
diff --git a/chrome/installer/util/google_chrome_sxs_distribution.h b/chrome/installer/util/google_chrome_sxs_distribution.h index 9992d5e..55ca0745 100644 --- a/chrome/installer/util/google_chrome_sxs_distribution.h +++ b/chrome/installer/util/google_chrome_sxs_distribution.h
@@ -27,7 +27,6 @@ base::string16 GetBaseAppId() override; base::string16 GetBrowserProgIdPrefix() override; base::string16 GetBrowserProgIdDesc() override; - base::string16 GetInstallSubDir() override; base::string16 GetUninstallRegPath() override; DefaultBrowserControlPolicy GetDefaultBrowserControlPolicy() override; base::string16 GetCommandExecuteImplClsid() override;
diff --git a/chrome/installer/util/helper.cc b/chrome/installer/util/helper.cc index e8159d8c..1b5b94e 100644 --- a/chrome/installer/util/helper.cc +++ b/chrome/installer/util/helper.cc
@@ -5,13 +5,12 @@ #include "chrome/installer/util/helper.h" #include "base/path_service.h" -#include "chrome/installer/util/browser_distribution.h" +#include "chrome/install_static/install_util.h" #include "chrome/installer/util/util_constants.h" namespace installer { -base::FilePath GetChromeInstallPath(bool system_install, - BrowserDistribution* dist) { +base::FilePath GetChromeInstallPath(bool system_install) { base::FilePath install_path; #if defined(_WIN64) // TODO(wfh): Place Chrome binaries into DIR_PROGRAM_FILESX86 until the code @@ -22,7 +21,8 @@ int key = system_install ? base::DIR_PROGRAM_FILES : base::DIR_LOCAL_APP_DATA; #endif if (PathService::Get(key, &install_path)) { - install_path = install_path.Append(dist->GetInstallSubDir()); + install_path = + install_path.Append(install_static::GetChromeInstallSubDirectory()); install_path = install_path.Append(kInstallBinaryDir); } return install_path;
diff --git a/chrome/installer/util/helper.h b/chrome/installer/util/helper.h index c2c74e7e..5dadc32 100644 --- a/chrome/installer/util/helper.h +++ b/chrome/installer/util/helper.h
@@ -9,8 +9,6 @@ #include "base/files/file_path.h" -class BrowserDistribution; - namespace installer { // This function returns the install path for Chrome depending on whether its @@ -18,8 +16,7 @@ // system_install: if true, the function returns system wide location // (ProgramFiles\Google). Otherwise it returns user specific // location (Document And Settings\<user>\Local Settings...) -base::FilePath GetChromeInstallPath(bool system_install, - BrowserDistribution* dist); +base::FilePath GetChromeInstallPath(bool system_install); } // namespace installer
diff --git a/chrome/installer/util/util_constants.cc b/chrome/installer/util/util_constants.cc index 22a5465..27b6743 100644 --- a/chrome/installer/util/util_constants.cc +++ b/chrome/installer/util/util_constants.cc
@@ -202,8 +202,6 @@ const wchar_t kChromeOldExe[] = L"old_chrome.exe"; const wchar_t kCmdOnOsUpgrade[] = L"on-os-upgrade"; const wchar_t kEULASentinelFile[] = L"EULA Accepted"; -const wchar_t kGoogleChromeInstallSubDir1[] = L"Google"; -const wchar_t kGoogleChromeInstallSubDir2[] = L"Chrome"; const wchar_t kInstallBinaryDir[] = L"Application"; const wchar_t kInstallerDir[] = L"Installer"; const wchar_t kInstallTempDir[] = L"Temp";
diff --git a/chrome/installer/util/util_constants.h b/chrome/installer/util/util_constants.h index 4d8e4521..644c7b33 100644 --- a/chrome/installer/util/util_constants.h +++ b/chrome/installer/util/util_constants.h
@@ -205,8 +205,6 @@ extern const wchar_t kChromeOldExe[]; extern const wchar_t kCmdOnOsUpgrade[]; extern const wchar_t kEULASentinelFile[]; -extern const wchar_t kGoogleChromeInstallSubDir1[]; -extern const wchar_t kGoogleChromeInstallSubDir2[]; extern const wchar_t kInstallBinaryDir[]; extern const wchar_t kInstallerDir[]; extern const wchar_t kInstallTempDir[];
diff --git a/components/data_use_measurement/core/data_use_user_data.h b/components/data_use_measurement/core/data_use_user_data.h index 4f8b4b9..a3912d3 100644 --- a/components/data_use_measurement/core/data_use_user_data.h +++ b/components/data_use_measurement/core/data_use_user_data.h
@@ -22,7 +22,8 @@ public: // This enum should be synced with DataUseServices enum in histograms.xml. // Please keep them synced after any updates. Also add service name to - // GetServiceNameAsString function. + // GetServiceNameAsString function and the same service name to + // DataUse.Service.Types histogram suffixes in histograms.xml enum ServiceName { NOT_TAGGED, SUGGESTIONS,