Commit c420d71d authored by Kyle Horimoto's avatar Kyle Horimoto Committed by Commit Bot

[CrOS Settings] Add MultiDeviceStringsProvider

This CL migrates multi-device UI strings to a per-page provider and adds
TODOs for adding relevant search tags.

Bug: 1069849
Change-Id: I7623883c0d44fcde2008d8ff3c9ca4640d37935b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2150185Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Commit-Queue: Kyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#759344}
parent 877ff89a
...@@ -2027,6 +2027,8 @@ jumbo_static_library("ui") { ...@@ -2027,6 +2027,8 @@ jumbo_static_library("ui") {
"webui/settings/chromeos/kerberos_accounts_handler.h", "webui/settings/chromeos/kerberos_accounts_handler.h",
"webui/settings/chromeos/multidevice_handler.cc", "webui/settings/chromeos/multidevice_handler.cc",
"webui/settings/chromeos/multidevice_handler.h", "webui/settings/chromeos/multidevice_handler.h",
"webui/settings/chromeos/multidevice_strings_provider.cc",
"webui/settings/chromeos/multidevice_strings_provider.h",
"webui/settings/chromeos/os_settings_localized_strings_provider.cc", "webui/settings/chromeos/os_settings_localized_strings_provider.cc",
"webui/settings/chromeos/os_settings_localized_strings_provider.h", "webui/settings/chromeos/os_settings_localized_strings_provider.h",
"webui/settings/chromeos/os_settings_localized_strings_provider_factory.cc", "webui/settings/chromeos/os_settings_localized_strings_provider_factory.cc",
......
// Copyright 2020 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/ui/webui/settings/chromeos/multidevice_strings_provider.h"
#include "base/no_destructor.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/webui/webui_util.h"
#include "chrome/common/url_constants.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/grit/generated_resources.h"
#include "chromeos/services/multidevice_setup/public/cpp/url_provider.h"
#include "chromeos/services/multidevice_setup/public/mojom/multidevice_setup.mojom.h"
#include "content/public/browser/web_ui_data_source.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/webui/web_ui_util.h"
#include "ui/chromeos/devicetype_utils.h"
namespace chromeos {
namespace settings {
namespace {
const std::vector<SearchConcept>& GetMultiDeviceSearchConcepts() {
static const base::NoDestructor<std::vector<SearchConcept>> tags({
// TODO(khorimoto): Add "MultiDevice" search concepts.
});
return *tags;
}
const std::vector<SearchConcept>& GetMultiDeviceOptedInSearchConcepts() {
static const base::NoDestructor<std::vector<SearchConcept>> tags({
// TODO(khorimoto): Add "MultiDevice opted in" search concepts.
});
return *tags;
}
const std::vector<SearchConcept>& GetMultiDeviceOptedOutSearchConcepts() {
static const base::NoDestructor<std::vector<SearchConcept>> tags({
// TODO(khorimoto): Add "MultiDevice opted out" search concepts.
});
return *tags;
}
void AddEasyUnlockStrings(content::WebUIDataSource* html_source) {
static constexpr webui::LocalizedString kLocalizedStrings[] = {
{"easyUnlockSectionTitle", IDS_SETTINGS_EASY_UNLOCK_SECTION_TITLE},
{"easyUnlockUnlockDeviceOnly",
IDS_SETTINGS_EASY_UNLOCK_UNLOCK_DEVICE_ONLY},
{"easyUnlockUnlockDeviceAndAllowSignin",
IDS_SETTINGS_EASY_UNLOCK_UNLOCK_DEVICE_AND_ALLOW_SIGNIN},
};
AddLocalizedStringsBulk(html_source, kLocalizedStrings);
}
bool IsOptedIn(multidevice_setup::mojom::HostStatus host_status) {
return host_status ==
multidevice_setup::mojom::HostStatus::kHostSetButNotYetVerified ||
host_status == multidevice_setup::mojom::HostStatus::kHostVerified;
}
} // namespace
MultiDeviceStringsProvider::MultiDeviceStringsProvider(
Profile* profile,
Delegate* per_page_delegate,
multidevice_setup::MultiDeviceSetupClient* multidevice_setup_client)
: OsSettingsPerPageStringsProvider(profile, per_page_delegate),
multidevice_setup_client_(multidevice_setup_client) {
// Note: |multidevice_setup_client_| is null when multi-device features are
// prohibited by policy.
if (!multidevice_setup_client_)
return;
multidevice_setup_client_->AddObserver(this);
delegate()->AddSearchTags(GetMultiDeviceSearchConcepts());
OnHostStatusChanged(multidevice_setup_client_->GetHostStatus());
}
MultiDeviceStringsProvider::~MultiDeviceStringsProvider() {
if (multidevice_setup_client_)
multidevice_setup_client_->RemoveObserver(this);
}
void MultiDeviceStringsProvider::AddUiStrings(
content::WebUIDataSource* html_source) const {
static constexpr webui::LocalizedString kLocalizedStrings[] = {
{"multidevicePageTitle", IDS_SETTINGS_MULTIDEVICE},
{"multideviceSetupButton", IDS_SETTINGS_MULTIDEVICE_SETUP_BUTTON},
{"multideviceVerifyButton", IDS_SETTINGS_MULTIDEVICE_VERIFY_BUTTON},
{"multideviceSetupItemHeading",
IDS_SETTINGS_MULTIDEVICE_SETUP_ITEM_HEADING},
{"multideviceEnabled", IDS_SETTINGS_MULTIDEVICE_ENABLED},
{"multideviceDisabled", IDS_SETTINGS_MULTIDEVICE_DISABLED},
{"multideviceSmartLockItemTitle", IDS_SETTINGS_EASY_UNLOCK_SECTION_TITLE},
{"multideviceInstantTetheringItemTitle",
IDS_SETTINGS_MULTIDEVICE_INSTANT_TETHERING},
{"multideviceInstantTetheringItemSummary",
IDS_SETTINGS_MULTIDEVICE_INSTANT_TETHERING_SUMMARY},
{"multideviceAndroidMessagesItemTitle",
IDS_SETTINGS_MULTIDEVICE_ANDROID_MESSAGES},
{"multideviceForgetDevice", IDS_SETTINGS_MULTIDEVICE_FORGET_THIS_DEVICE},
{"multideviceSmartLockOptions",
IDS_SETTINGS_PEOPLE_LOCK_SCREEN_OPTIONS_LOCK},
{"multideviceForgetDeviceDisconnect",
IDS_SETTINGS_MULTIDEVICE_FORGET_THIS_DEVICE_DISCONNECT},
};
AddLocalizedStringsBulk(html_source, kLocalizedStrings);
html_source->AddString(
"multideviceForgetDeviceSummary",
ui::SubstituteChromeOSDeviceType(
IDS_SETTINGS_MULTIDEVICE_FORGET_THIS_DEVICE_EXPLANATION));
html_source->AddString(
"multideviceForgetDeviceDialogMessage",
ui::SubstituteChromeOSDeviceType(
IDS_SETTINGS_MULTIDEVICE_FORGET_DEVICE_DIALOG_MESSAGE));
html_source->AddString(
"multideviceVerificationText",
l10n_util::GetStringFUTF16(
IDS_SETTINGS_MULTIDEVICE_VERIFICATION_TEXT,
base::UTF8ToUTF16(
multidevice_setup::
GetBoardSpecificBetterTogetherSuiteLearnMoreUrl()
.spec())));
html_source->AddString(
"multideviceSetupSummary",
l10n_util::GetStringFUTF16(
IDS_SETTINGS_MULTIDEVICE_SETUP_SUMMARY, ui::GetChromeOSDeviceName(),
base::UTF8ToUTF16(
multidevice_setup::
GetBoardSpecificBetterTogetherSuiteLearnMoreUrl()
.spec())));
html_source->AddString(
"multideviceNoHostText",
l10n_util::GetStringFUTF16(
IDS_SETTINGS_MULTIDEVICE_NO_ELIGIBLE_HOSTS,
base::UTF8ToUTF16(
multidevice_setup::
GetBoardSpecificBetterTogetherSuiteLearnMoreUrl()
.spec())));
html_source->AddString(
"multideviceAndroidMessagesItemSummary",
l10n_util::GetStringFUTF16(
IDS_SETTINGS_MULTIDEVICE_ANDROID_MESSAGES_SUMMARY,
ui::GetChromeOSDeviceName(),
base::UTF8ToUTF16(
multidevice_setup::GetBoardSpecificMessagesLearnMoreUrl()
.spec())));
html_source->AddString(
"multideviceSmartLockItemSummary",
l10n_util::GetStringFUTF16(
IDS_SETTINGS_MULTIDEVICE_SMART_LOCK_SUMMARY,
ui::GetChromeOSDeviceName(),
GetHelpUrlWithBoard(chrome::kEasyUnlockLearnMoreUrl)));
AddEasyUnlockStrings(html_source);
}
void MultiDeviceStringsProvider::OnHostStatusChanged(
const multidevice_setup::MultiDeviceSetupClient::HostStatusWithDevice&
host_status_with_device) {
if (IsOptedIn(host_status_with_device.first)) {
delegate()->RemoveSearchTags(GetMultiDeviceOptedOutSearchConcepts());
delegate()->AddSearchTags(GetMultiDeviceOptedInSearchConcepts());
} else {
delegate()->RemoveSearchTags(GetMultiDeviceOptedInSearchConcepts());
delegate()->AddSearchTags(GetMultiDeviceOptedOutSearchConcepts());
}
}
} // namespace settings
} // namespace chromeos
// Copyright 2020 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.
#ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_MULTIDEVICE_STRINGS_PROVIDER_H_
#define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_MULTIDEVICE_STRINGS_PROVIDER_H_
#include "chrome/browser/ui/webui/settings/chromeos/os_settings_per_page_strings_provider.h"
#include "chromeos/services/multidevice_setup/public/cpp/multidevice_setup_client.h"
namespace content {
class WebUIDataSource;
} // namespace content
namespace chromeos {
namespace settings {
// Provides UI strings and search tags for MultiDevice settings. Different
// search tags are registered depending on whether MultiDevice features are
// allowed and whether the user has opted into the suite of features.
class MultiDeviceStringsProvider
: public OsSettingsPerPageStringsProvider,
public multidevice_setup::MultiDeviceSetupClient::Observer {
public:
MultiDeviceStringsProvider(
Profile* profile,
Delegate* per_page_delegate,
multidevice_setup::MultiDeviceSetupClient* multidevice_setup_client);
~MultiDeviceStringsProvider() override;
private:
// OsSettingsPerPageStringsProvider:
void AddUiStrings(content::WebUIDataSource* html_source) const override;
// multidevice_setup::MultiDeviceSetupClient::Observer:
void OnHostStatusChanged(
const multidevice_setup::MultiDeviceSetupClient::HostStatusWithDevice&
host_status_with_device) override;
multidevice_setup::MultiDeviceSetupClient* multidevice_setup_client_;
};
} // namespace settings
} // namespace chromeos
#endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_MULTIDEVICE_STRINGS_PROVIDER_H_
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/chromeos/crostini/crostini_util.h"
#include "chrome/browser/chromeos/kerberos/kerberos_credentials_manager.h" #include "chrome/browser/chromeos/kerberos/kerberos_credentials_manager.h"
#include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.h" #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.h"
#include "chrome/browser/chromeos/multidevice_setup/multidevice_setup_client_factory.h"
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/policy/profile_policy_connector.h" #include "chrome/browser/policy/profile_policy_connector.h"
...@@ -40,6 +41,7 @@ ...@@ -40,6 +41,7 @@
#include "chrome/browser/ui/webui/policy_indicator_localized_strings_provider.h" #include "chrome/browser/ui/webui/policy_indicator_localized_strings_provider.h"
#include "chrome/browser/ui/webui/settings/chromeos/bluetooth_strings_provider.h" #include "chrome/browser/ui/webui/settings/chromeos/bluetooth_strings_provider.h"
#include "chrome/browser/ui/webui/settings/chromeos/internet_strings_provider.h" #include "chrome/browser/ui/webui/settings/chromeos/internet_strings_provider.h"
#include "chrome/browser/ui/webui/settings/chromeos/multidevice_strings_provider.h"
#include "chrome/browser/ui/webui/settings/chromeos/search/search_concept.h" #include "chrome/browser/ui/webui/settings/chromeos/search/search_concept.h"
#include "chrome/browser/ui/webui/settings/shared_settings_localized_strings_provider.h" #include "chrome/browser/ui/webui/settings/shared_settings_localized_strings_provider.h"
#include "chrome/browser/ui/webui/webui_util.h" #include "chrome/browser/ui/webui/webui_util.h"
...@@ -54,7 +56,6 @@ ...@@ -54,7 +56,6 @@
#include "chromeos/constants/chromeos_features.h" #include "chromeos/constants/chromeos_features.h"
#include "chromeos/constants/chromeos_switches.h" #include "chromeos/constants/chromeos_switches.h"
#include "chromeos/services/assistant/public/features.h" #include "chromeos/services/assistant/public/features.h"
#include "chromeos/services/multidevice_setup/public/cpp/url_provider.h"
#include "chromeos/strings/grit/chromeos_strings.h" #include "chromeos/strings/grit/chromeos_strings.h"
#include "components/google/core/common/google_util.h" #include "components/google/core/common/google_util.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
...@@ -1280,91 +1281,6 @@ void AddFilesStrings(content::WebUIDataSource* html_source) { ...@@ -1280,91 +1281,6 @@ void AddFilesStrings(content::WebUIDataSource* html_source) {
GetHelpUrlWithBoard(chrome::kSmbSharesLearnMoreURL)); GetHelpUrlWithBoard(chrome::kSmbSharesLearnMoreURL));
} }
void AddEasyUnlockStrings(content::WebUIDataSource* html_source) {
static constexpr webui::LocalizedString kLocalizedStrings[] = {
{"easyUnlockSectionTitle", IDS_SETTINGS_EASY_UNLOCK_SECTION_TITLE},
{"easyUnlockUnlockDeviceOnly",
IDS_SETTINGS_EASY_UNLOCK_UNLOCK_DEVICE_ONLY},
{"easyUnlockUnlockDeviceAndAllowSignin",
IDS_SETTINGS_EASY_UNLOCK_UNLOCK_DEVICE_AND_ALLOW_SIGNIN},
};
AddLocalizedStringsBulk(html_source, kLocalizedStrings);
}
void AddMultideviceStrings(content::WebUIDataSource* html_source) {
static constexpr webui::LocalizedString kLocalizedStrings[] = {
{"multidevicePageTitle", IDS_SETTINGS_MULTIDEVICE},
{"multideviceSetupButton", IDS_SETTINGS_MULTIDEVICE_SETUP_BUTTON},
{"multideviceVerifyButton", IDS_SETTINGS_MULTIDEVICE_VERIFY_BUTTON},
{"multideviceSetupItemHeading",
IDS_SETTINGS_MULTIDEVICE_SETUP_ITEM_HEADING},
{"multideviceEnabled", IDS_SETTINGS_MULTIDEVICE_ENABLED},
{"multideviceDisabled", IDS_SETTINGS_MULTIDEVICE_DISABLED},
{"multideviceSmartLockItemTitle", IDS_SETTINGS_EASY_UNLOCK_SECTION_TITLE},
{"multideviceInstantTetheringItemTitle",
IDS_SETTINGS_MULTIDEVICE_INSTANT_TETHERING},
{"multideviceInstantTetheringItemSummary",
IDS_SETTINGS_MULTIDEVICE_INSTANT_TETHERING_SUMMARY},
{"multideviceAndroidMessagesItemTitle",
IDS_SETTINGS_MULTIDEVICE_ANDROID_MESSAGES},
{"multideviceForgetDevice", IDS_SETTINGS_MULTIDEVICE_FORGET_THIS_DEVICE},
{"multideviceSmartLockOptions",
IDS_SETTINGS_PEOPLE_LOCK_SCREEN_OPTIONS_LOCK},
{"multideviceForgetDeviceDisconnect",
IDS_SETTINGS_MULTIDEVICE_FORGET_THIS_DEVICE_DISCONNECT},
};
AddLocalizedStringsBulk(html_source, kLocalizedStrings);
html_source->AddString(
"multideviceForgetDeviceSummary",
ui::SubstituteChromeOSDeviceType(
IDS_SETTINGS_MULTIDEVICE_FORGET_THIS_DEVICE_EXPLANATION));
html_source->AddString(
"multideviceForgetDeviceDialogMessage",
ui::SubstituteChromeOSDeviceType(
IDS_SETTINGS_MULTIDEVICE_FORGET_DEVICE_DIALOG_MESSAGE));
html_source->AddString(
"multideviceVerificationText",
l10n_util::GetStringFUTF16(
IDS_SETTINGS_MULTIDEVICE_VERIFICATION_TEXT,
base::UTF8ToUTF16(
chromeos::multidevice_setup::
GetBoardSpecificBetterTogetherSuiteLearnMoreUrl()
.spec())));
html_source->AddString(
"multideviceSetupSummary",
l10n_util::GetStringFUTF16(
IDS_SETTINGS_MULTIDEVICE_SETUP_SUMMARY, ui::GetChromeOSDeviceName(),
base::UTF8ToUTF16(
chromeos::multidevice_setup::
GetBoardSpecificBetterTogetherSuiteLearnMoreUrl()
.spec())));
html_source->AddString(
"multideviceNoHostText",
l10n_util::GetStringFUTF16(
IDS_SETTINGS_MULTIDEVICE_NO_ELIGIBLE_HOSTS,
base::UTF8ToUTF16(
chromeos::multidevice_setup::
GetBoardSpecificBetterTogetherSuiteLearnMoreUrl()
.spec())));
html_source->AddString(
"multideviceAndroidMessagesItemSummary",
l10n_util::GetStringFUTF16(
IDS_SETTINGS_MULTIDEVICE_ANDROID_MESSAGES_SUMMARY,
ui::GetChromeOSDeviceName(),
base::UTF8ToUTF16(chromeos::multidevice_setup::
GetBoardSpecificMessagesLearnMoreUrl()
.spec())));
html_source->AddString(
"multideviceSmartLockItemSummary",
l10n_util::GetStringFUTF16(
IDS_SETTINGS_MULTIDEVICE_SMART_LOCK_SUMMARY,
ui::GetChromeOSDeviceName(),
GetHelpUrlWithBoard(chrome::kEasyUnlockLearnMoreUrl)));
AddEasyUnlockStrings(html_source);
}
void AddKerberosAccountsPageStrings(content::WebUIDataSource* html_source) { void AddKerberosAccountsPageStrings(content::WebUIDataSource* html_source) {
static constexpr webui::LocalizedString kLocalizedStrings[] = { static constexpr webui::LocalizedString kLocalizedStrings[] = {
{"kerberosAccountsAddAccountLabel", {"kerberosAccountsAddAccountLabel",
...@@ -2030,6 +1946,10 @@ OsSettingsLocalizedStringsProvider::OsSettingsLocalizedStringsProvider( ...@@ -2030,6 +1946,10 @@ OsSettingsLocalizedStringsProvider::OsSettingsLocalizedStringsProvider(
std::make_unique<InternetStringsProvider>(profile, /*delegate=*/this)); std::make_unique<InternetStringsProvider>(profile, /*delegate=*/this));
per_page_providers_.push_back( per_page_providers_.push_back(
std::make_unique<BluetoothStringsProvider>(profile, /*delegate=*/this)); std::make_unique<BluetoothStringsProvider>(profile, /*delegate=*/this));
per_page_providers_.push_back(std::make_unique<MultiDeviceStringsProvider>(
profile, /*delegate=*/this,
multidevice_setup::MultiDeviceSetupClientFactory::GetForProfile(
profile)));
} }
OsSettingsLocalizedStringsProvider::~OsSettingsLocalizedStringsProvider() = OsSettingsLocalizedStringsProvider::~OsSettingsLocalizedStringsProvider() =
...@@ -2056,7 +1976,6 @@ void OsSettingsLocalizedStringsProvider::AddOsLocalizedStrings( ...@@ -2056,7 +1976,6 @@ void OsSettingsLocalizedStringsProvider::AddOsLocalizedStrings(
AddFilesStrings(html_source); AddFilesStrings(html_source);
AddGoogleAssistantStrings(html_source, profile); AddGoogleAssistantStrings(html_source, profile);
AddLanguagesStrings(html_source); AddLanguagesStrings(html_source);
AddMultideviceStrings(html_source);
AddParentalControlStrings(html_source, profile); AddParentalControlStrings(html_source, profile);
AddPageVisibilityStrings(html_source); AddPageVisibilityStrings(html_source);
AddPeoplePageStrings(html_source, profile); AddPeoplePageStrings(html_source, profile);
...@@ -2085,6 +2004,9 @@ OsSettingsLocalizedStringsProvider::GetCanonicalTagMetadata( ...@@ -2085,6 +2004,9 @@ OsSettingsLocalizedStringsProvider::GetCanonicalTagMetadata(
void OsSettingsLocalizedStringsProvider::Shutdown() { void OsSettingsLocalizedStringsProvider::Shutdown() {
index_ = nullptr; index_ = nullptr;
// Delete all per-page providers, since some of them depend on KeyedServices.
per_page_providers_.clear();
} }
void OsSettingsLocalizedStringsProvider::AddSearchTags( void OsSettingsLocalizedStringsProvider::AddSearchTags(
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "chrome/browser/ui/webui/settings/chromeos/os_settings_localized_strings_provider_factory.h" #include "chrome/browser/ui/webui/settings/chromeos/os_settings_localized_strings_provider_factory.h"
#include "chrome/browser/chromeos/multidevice_setup/multidevice_setup_client_factory.h"
#include "chrome/browser/local_search_service/local_search_service_proxy.h" #include "chrome/browser/local_search_service/local_search_service_proxy.h"
#include "chrome/browser/local_search_service/local_search_service_proxy_factory.h" #include "chrome/browser/local_search_service/local_search_service_proxy_factory.h"
#include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/incognito_helpers.h"
...@@ -35,6 +36,7 @@ OsSettingsLocalizedStringsProviderFactory:: ...@@ -35,6 +36,7 @@ OsSettingsLocalizedStringsProviderFactory::
BrowserContextDependencyManager::GetInstance()) { BrowserContextDependencyManager::GetInstance()) {
DependsOn( DependsOn(
local_search_service::LocalSearchServiceProxyFactory::GetInstance()); local_search_service::LocalSearchServiceProxyFactory::GetInstance());
DependsOn(multidevice_setup::MultiDeviceSetupClientFactory::GetInstance());
} }
OsSettingsLocalizedStringsProviderFactory:: OsSettingsLocalizedStringsProviderFactory::
......
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
#include "chrome/browser/ui/webui/settings/chromeos/os_settings_localized_strings_provider.h" #include "chrome/browser/ui/webui/settings/chromeos/os_settings_localized_strings_provider.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "chrome/browser/local_search_service/local_search_service_proxy.h"
#include "chrome/browser/local_search_service/local_search_service_proxy_factory.h"
#include "chrome/browser/ui/webui/settings/chromeos/os_settings_localized_strings_provider_factory.h"
#include "chrome/browser/ui/webui/settings/chromeos/search/search_concept.h" #include "chrome/browser/ui/webui/settings/chromeos/search/search_concept.h"
#include "chrome/common/webui_url_constants.h" #include "chrome/common/webui_url_constants.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
...@@ -32,13 +35,17 @@ class OsSettingsLocalizedStringsProviderTest : public testing::Test { ...@@ -32,13 +35,17 @@ class OsSettingsLocalizedStringsProviderTest : public testing::Test {
// testing::Test: // testing::Test:
void SetUp() override { void SetUp() override {
ASSERT_TRUE(profile_manager_.SetUp()); ASSERT_TRUE(profile_manager_.SetUp());
TestingProfile* profile =
profile_manager_.CreateTestingProfile("TestingProfile");
provider_ = std::make_unique<OsSettingsLocalizedStringsProvider>( provider_ =
profile_manager_.CreateTestingProfile("TestingProfile"), OsSettingsLocalizedStringsProviderFactory::GetForProfile(profile);
&local_search_service_);
index_ = local_search_service_.GetIndexImpl( index_ =
local_search_service::IndexId::kCrosSettings); local_search_service::LocalSearchServiceProxyFactory::GetForProfile(
profile)
->GetLocalSearchServiceImpl()
->GetIndexImpl(local_search_service::IndexId::kCrosSettings);
// Allow asynchronous networking code to complete (networking functionality // Allow asynchronous networking code to complete (networking functionality
// is tested below). // is tested below).
...@@ -49,8 +56,7 @@ class OsSettingsLocalizedStringsProviderTest : public testing::Test { ...@@ -49,8 +56,7 @@ class OsSettingsLocalizedStringsProviderTest : public testing::Test {
TestingProfileManager profile_manager_; TestingProfileManager profile_manager_;
chromeos::network_config::CrosNetworkConfigTestHelper network_config_helper_; chromeos::network_config::CrosNetworkConfigTestHelper network_config_helper_;
local_search_service::IndexImpl* index_; local_search_service::IndexImpl* index_;
local_search_service::LocalSearchServiceImpl local_search_service_; OsSettingsLocalizedStringsProvider* provider_;
std::unique_ptr<OsSettingsLocalizedStringsProvider> provider_;
}; };
// To prevent this from becoming a change-detector test, this test simply // To prevent this from becoming a change-detector test, this test simply
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment