Commit 0cb311d7 authored by Wenzhao Zang's avatar Wenzhao Zang Committed by Commit Bot

cros: Enable changing locale from system tray in demo mode

Show a locale feature button in the unified system tray in demo
mode. The UI is implemented in //ash/system, but the data should come
from //chrome.

The mock is in go/CrosDemoLanguage. No additional spec is needed: the
UI is consistent with other buttons in the system tray. The change is
approved by UI review.

Bug: 877749
Change-Id: I23a88584845e432b7762aeac03ab86d659cca07c
Reviewed-on: https://chromium-review.googlesource.com/c/1321775
Commit-Queue: Wenzhao (Colin) Zang <wzang@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarStefan Kuhne <skuhne@chromium.org>
Reviewed-by: default avatarOliver Chang <ochang@chromium.org>
Reviewed-by: default avatarMichael Giuffrida <michaelpg@chromium.org>
Reviewed-by: default avatarTetsui Ohkubo <tetsui@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608557}
parent 2e75e2fa
......@@ -707,8 +707,14 @@ component("ash") {
"system/keyboard_brightness/unified_keyboard_brightness_slider_controller.cc",
"system/keyboard_brightness/unified_keyboard_brightness_slider_controller.h",
"system/keyboard_brightness_control_delegate.h",
"system/locale/locale_detailed_view.cc",
"system/locale/locale_detailed_view.h",
"system/locale/locale_feature_pod_controller.cc",
"system/locale/locale_feature_pod_controller.h",
"system/locale/locale_notification_controller.cc",
"system/locale/locale_notification_controller.h",
"system/locale/unified_locale_detailed_view_controller.cc",
"system/locale/unified_locale_detailed_view_controller.h",
"system/message_center/arc_notification_manager_delegate_impl.cc",
"system/message_center/arc_notification_manager_delegate_impl.h",
"system/message_center/ash_message_center_lock_screen_controller.cc",
......@@ -1744,6 +1750,7 @@ test("ash_unittests") {
"system/flag_warning/flag_warning_tray_unittest.cc",
"system/ime/ime_feature_pod_controller_unittest.cc",
"system/ime_menu/ime_menu_tray_unittest.cc",
"system/locale/locale_feature_pod_controller_unittest.cc",
"system/message_center/arc/arc_notification_content_view_unittest.cc",
"system/message_center/arc/arc_notification_manager_unittest.cc",
"system/message_center/arc/arc_notification_view_unittest.cc",
......
......@@ -543,6 +543,12 @@ This file contains the strings for ash.
<message name="IDS_ASH_STATUS_TRAY_NOTIFICATIONS_DO_NOT_DISTURB_SUBLABEL" desc="The sub label text shown under do not disturb button when all notifications are disabled.">
Do not disturb
</message>
<message name="IDS_ASH_STATUS_TRAY_LOCALE" desc="The label used for locale button in system tray bubble.">
Language
</message>
<message name="IDS_ASH_STATUS_TRAY_LOCALE_TITLE" desc="The title shown in the locale detailed view.">
Languages
</message>
<!-- Status tray supervised users. -->
<message name="IDS_ASH_STATUS_TRAY_SUPERVISED_LABEL" desc="Label shown instead of email for supervised users">
......
......@@ -7,6 +7,15 @@ module ash.mojom;
import "ash/public/interfaces/update.mojom";
import "mojo/public/mojom/base/string16.mojom";
// The locale info to show in the locale feature detailed view.
struct LocaleInfo {
// This ISO code of the locale.
string iso_code;
// The display name of the locale.
mojo_base.mojom.String16 display_name;
};
// Allows clients (e.g. Chrome browser) to control the ash system tray menu.
interface SystemTray {
// Sets the client interface.
......@@ -33,6 +42,10 @@ interface SystemTray {
// tracing is running.
SetPerformanceTracingIconVisible(bool visible);
// Sets the list of supported UI locales. |current_locale_iso_code| refers to
// the locale currently used by the UI.
SetLocaleList(array<LocaleInfo> locale_list, string current_locale_iso_code);
// Shows an icon in the system tray or a notification on the unified system
// menu indicating that a software update is available. Once shown, the icon
// or the notification persists until reboot.
......@@ -166,4 +179,8 @@ interface SystemTrayClient {
// Attempts to restart the system for update.
RequestRestartForUpdate();
// Sets the UI locale to |locale_iso_code| and exit the session to take
// effect.
SetLocaleAndExit(string locale_iso_code);
};
// Copyright 2018 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 "ash/system/locale/locale_detailed_view.h"
#include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/system/model/system_tray_model.h"
#include "ash/system/tray/hover_highlight_view.h"
#include "base/logging.h"
#include "ui/views/controls/scroll_view.h"
namespace ash {
namespace tray {
LocaleDetailedView::LocaleDetailedView(DetailedViewDelegate* delegate)
: TrayDetailedView(delegate) {
CreateItems();
}
LocaleDetailedView::~LocaleDetailedView() = default;
void LocaleDetailedView::CreateItems() {
CreateTitleRow(IDS_ASH_STATUS_TRAY_LOCALE_TITLE);
CreateScrollableList();
const std::vector<mojom::LocaleInfoPtr>& locales =
Shell::Get()->system_tray_model()->locale_list();
int id = 0;
for (auto& entry : locales) {
const bool checked =
entry->iso_code ==
Shell::Get()->system_tray_model()->current_locale_iso_code();
HoverHighlightView* item =
AddScrollListCheckableItem(entry->display_name, checked);
item->set_id(id);
id_to_locale_[id] = entry->iso_code;
++id;
}
scroll_content()->SizeToPreferredSize();
scroller()->Layout();
// TODO(wzang): Show locale ISO codes at the beginning of each row, most
// likely by reusing the code in |ImeListItemView|.
}
void LocaleDetailedView::HandleViewClicked(views::View* view) {
auto it = id_to_locale_.find(view->id());
DCHECK(it != id_to_locale_.end());
const std::string locale_iso_code = it->second;
if (locale_iso_code !=
Shell::Get()->system_tray_model()->current_locale_iso_code()) {
Shell::Get()->system_tray_model()->client_ptr()->SetLocaleAndExit(
locale_iso_code);
}
}
} // namespace tray
} // namespace ash
\ No newline at end of file
// Copyright 2018 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 ASH_SYSTEM_LOCALE_LOCALE_DETAILED_VIEW_H_
#define ASH_SYSTEM_LOCALE_LOCALE_DETAILED_VIEW_H_
#include <string>
#include "ash/system/tray/tray_detailed_view.h"
#include "base/containers/flat_map.h"
#include "base/macros.h"
namespace ash {
namespace tray {
// The detailed view to show when the locale feature button is clicked.
class LocaleDetailedView : public TrayDetailedView {
public:
explicit LocaleDetailedView(DetailedViewDelegate* delegate);
~LocaleDetailedView() override;
private:
void CreateItems();
// TrayDetailedView:
void HandleViewClicked(views::View* view) override;
// The map between the id of the view and the locale it corresponds to.
base::flat_map<int, std::string> id_to_locale_;
DISALLOW_COPY_AND_ASSIGN(LocaleDetailedView);
};
} // namespace tray
} // namespace ash
#endif // ASH_SYSTEM_LOCALE_LOCALE_DETAILED_VIEW_H_
\ No newline at end of file
// Copyright 2018 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 "ash/system/locale/locale_feature_pod_controller.h"
#include "ash/resources/vector_icons/vector_icons.h"
#include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/system/model/system_tray_model.h"
#include "ash/system/unified/feature_pod_button.h"
#include "ash/system/unified/unified_system_tray_controller.h"
#include "base/strings/utf_string_conversions.h"
#include "ui/base/l10n/l10n_util.h"
namespace ash {
LocaleFeaturePodController::LocaleFeaturePodController(
UnifiedSystemTrayController* tray_controller)
: tray_controller_(tray_controller) {}
LocaleFeaturePodController::~LocaleFeaturePodController() = default;
FeaturePodButton* LocaleFeaturePodController::CreateButton() {
auto* button = new FeaturePodButton(this);
const bool visible =
!Shell::Get()->system_tray_model()->locale_list().empty();
button->SetVisible(visible);
if (visible) {
// TODO(wzang): Add a tooltip.
// TODO(wzang): |kUnifiedMenuKeyboardIcon| is a placeholder. Change it.
button->SetVectorIcon(kUnifiedMenuKeyboardIcon);
button->SetLabel(l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_LOCALE));
button->ShowDetailedViewArrow();
button->DisableLabelButtonFocus();
button->SetSubLabel(base::UTF8ToUTF16(
Shell::Get()->system_tray_model()->current_locale_iso_code()));
}
return button;
}
void LocaleFeaturePodController::OnIconPressed() {
tray_controller_->ShowLocaleDetailedView();
}
SystemTrayItemUmaType LocaleFeaturePodController::GetUmaType() const {
return SystemTrayItemUmaType::UMA_LOCALE;
}
} // namespace ash
// Copyright 2018 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 ASH_SYSTEM_LOCALE_LOCALE_FEATURE_POD_CONTROLLER_H_
#define ASH_SYSTEM_LOCALE_LOCALE_FEATURE_POD_CONTROLLER_H_
#include "ash/ash_export.h"
#include "ash/system/unified/feature_pod_controller_base.h"
#include "base/macros.h"
namespace ash {
class UnifiedSystemTrayController;
// Controller of locale feature pod button.
class ASH_EXPORT LocaleFeaturePodController : public FeaturePodControllerBase {
public:
explicit LocaleFeaturePodController(
UnifiedSystemTrayController* tray_controller);
~LocaleFeaturePodController() override;
// FeaturePodControllerBase:
FeaturePodButton* CreateButton() override;
void OnIconPressed() override;
SystemTrayItemUmaType GetUmaType() const override;
private:
// Unowned.
UnifiedSystemTrayController* const tray_controller_;
DISALLOW_COPY_AND_ASSIGN(LocaleFeaturePodController);
};
} // namespace ash
#endif // ASH_SYSTEM_LOCALE_LOCALE_FEATURE_POD_CONTROLLER_H_
// Copyright 2018 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 "ash/system/locale/locale_feature_pod_controller.h"
#include <memory>
#include <vector>
#include "ash/shell.h"
#include "ash/system/model/system_tray_model.h"
#include "ash/system/unified/feature_pod_button.h"
#include "ash/system/unified/unified_system_tray_controller.h"
#include "ash/system/unified/unified_system_tray_model.h"
#include "ash/test/ash_test_base.h"
#include "base/macros.h"
#include "base/strings/utf_string_conversions.h"
namespace ash {
namespace {
class LocaleFeaturePodControllerTest : public NoSessionAshTestBase {
public:
LocaleFeaturePodControllerTest() = default;
~LocaleFeaturePodControllerTest() override = default;
void SetUp() override {
NoSessionAshTestBase::SetUp();
tray_model_ = std::make_unique<UnifiedSystemTrayModel>();
tray_controller_ =
std::make_unique<UnifiedSystemTrayController>(tray_model_.get());
controller_ =
std::make_unique<LocaleFeaturePodController>(tray_controller_.get());
}
void TearDown() override {
controller_.reset();
tray_controller_.reset();
tray_model_.reset();
NoSessionAshTestBase::TearDown();
}
protected:
std::unique_ptr<LocaleFeaturePodController> controller_;
private:
std::unique_ptr<UnifiedSystemTrayModel> tray_model_;
std::unique_ptr<UnifiedSystemTrayController> tray_controller_;
DISALLOW_COPY_AND_ASSIGN(LocaleFeaturePodControllerTest);
};
TEST_F(LocaleFeaturePodControllerTest, ButtonVisibility) {
constexpr char kDefaultLocaleIsoCode[] = "en-US";
// The button is invisible if the locale list is unset.
std::unique_ptr<FeaturePodButton> button;
button.reset(controller_->CreateButton());
EXPECT_FALSE(button->visible());
// The button is invisible if the locale list is empty.
Shell::Get()->system_tray_model()->SetLocaleList(
std::vector<mojom::LocaleInfoPtr>(), kDefaultLocaleIsoCode);
button.reset(controller_->CreateButton());
EXPECT_FALSE(button->visible());
// The button is visible if the locale list is non-empty.
std::vector<mojom::LocaleInfoPtr> locale_list;
mojom::LocaleInfoPtr locale = mojom::LocaleInfo::New(
kDefaultLocaleIsoCode, base::UTF8ToUTF16("English (United States)"));
locale_list.push_back(std::move(locale));
Shell::Get()->system_tray_model()->SetLocaleList(std::move(locale_list),
kDefaultLocaleIsoCode);
button.reset(controller_->CreateButton());
EXPECT_TRUE(button->visible());
}
} // namespace
} // namespace ash
\ No newline at end of file
// Copyright 2018 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 "ash/system/locale/unified_locale_detailed_view_controller.h"
#include "ash/system/locale/locale_detailed_view.h"
#include "ash/system/unified/unified_detailed_view_delegate.h"
#include "base/logging.h"
namespace ash {
UnifiedLocaleDetailedViewController::UnifiedLocaleDetailedViewController(
UnifiedSystemTrayController* tray_controller)
: detailed_view_delegate_(
std::make_unique<UnifiedDetailedViewDelegate>(tray_controller)) {}
UnifiedLocaleDetailedViewController::~UnifiedLocaleDetailedViewController() =
default;
views::View* UnifiedLocaleDetailedViewController::CreateView() {
DCHECK(!view_);
view_ = new tray::LocaleDetailedView(detailed_view_delegate_.get());
return view_;
}
} // namespace ash
// Copyright 2018 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 ASH_SYSTEM_LOCALE_UNIFIED_LOCALE_DETAILED_VIEW_CONTROLLER_H_
#define ASH_SYSTEM_LOCALE_UNIFIED_LOCALE_DETAILED_VIEW_CONTROLLER_H_
#include <memory>
#include "ash/system/unified/detailed_view_controller.h"
#include "base/macros.h"
namespace ash {
namespace tray {
class LocaleDetailedView;
} // namespace tray
class DetailedViewDelegate;
class UnifiedSystemTrayController;
// Controller of the locale detailed view in UnifiedSystemTray.
class UnifiedLocaleDetailedViewController : public DetailedViewController {
public:
explicit UnifiedLocaleDetailedViewController(
UnifiedSystemTrayController* tray_controller);
~UnifiedLocaleDetailedViewController() override;
// DetailedViewControllerBase:
views::View* CreateView() override;
private:
const std::unique_ptr<DetailedViewDelegate> detailed_view_delegate_;
tray::LocaleDetailedView* view_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(UnifiedLocaleDetailedViewController);
};
} // namespace ash
#endif // ASH_SYSTEM_LOCALE_UNIFIED_LOCALE_DETAILED_VIEW_CONTROLLER_H_
......@@ -67,6 +67,13 @@ void SystemTrayModel::SetPerformanceTracingIconVisible(bool visible) {
tracing()->SetIsTracing(visible);
}
void SystemTrayModel::SetLocaleList(
std::vector<mojom::LocaleInfoPtr> locale_list,
const std::string& current_locale_iso_code) {
locale_list_ = std::move(locale_list);
current_locale_iso_code_ = current_locale_iso_code;
}
void SystemTrayModel::ShowUpdateIcon(mojom::UpdateSeverity severity,
bool factory_reset_required,
bool rollback,
......
......@@ -37,6 +37,8 @@ class SystemTrayModel : public mojom::SystemTray {
void SetEnterpriseDisplayDomain(const std::string& enterprise_display_domain,
bool active_directory_managed) override;
void SetPerformanceTracingIconVisible(bool visible) override;
void SetLocaleList(std::vector<mojom::LocaleInfoPtr> locale_list,
const std::string& current_locale_iso_code) override;
void ShowUpdateIcon(mojom::UpdateSeverity severity,
bool factory_reset_required,
bool rollback,
......@@ -59,6 +61,13 @@ class SystemTrayModel : public mojom::SystemTray {
UpdateModel* update_model() { return update_model_.get(); }
VirtualKeyboardModel* virtual_keyboard() { return virtual_keyboard_.get(); }
const std::vector<mojom::LocaleInfoPtr>& locale_list() {
return locale_list_;
}
std::string current_locale_iso_code() const {
return current_locale_iso_code_;
}
const mojom::SystemTrayClientPtr& client_ptr() { return client_ptr_; }
private:
......@@ -69,6 +78,9 @@ class SystemTrayModel : public mojom::SystemTray {
std::unique_ptr<UpdateModel> update_model_;
std::unique_ptr<VirtualKeyboardModel> virtual_keyboard_;
std::vector<mojom::LocaleInfoPtr> locale_list_;
std::string current_locale_iso_code_;
// TODO(tetsui): Add following as a sub-model of SystemTrayModel:
// * BluetoothModel
......
......@@ -42,7 +42,8 @@ enum class SystemTrayItemUmaType {
UMA_VPN = 25,
UMA_NIGHT_LIGHT = 26,
UMA_QUIET_MODE = 27,
UMA_COUNT = 28,
UMA_LOCALE = 28,
UMA_COUNT = 29,
};
} // namespace ash
......
......@@ -20,6 +20,8 @@
#include "ash/system/cast/unified_cast_detailed_view_controller.h"
#include "ash/system/ime/ime_feature_pod_controller.h"
#include "ash/system/ime/unified_ime_detailed_view_controller.h"
#include "ash/system/locale/locale_feature_pod_controller.h"
#include "ash/system/locale/unified_locale_detailed_view_controller.h"
#include "ash/system/model/clock_model.h"
#include "ash/system/model/system_tray_model.h"
#include "ash/system/network/network_feature_pod_controller.h"
......@@ -265,6 +267,10 @@ void UnifiedSystemTrayController::ShowIMEDetailedView() {
ShowDetailedView(std::make_unique<UnifiedIMEDetailedViewController>(this));
}
void UnifiedSystemTrayController::ShowLocaleDetailedView() {
ShowDetailedView(std::make_unique<UnifiedLocaleDetailedViewController>(this));
}
void UnifiedSystemTrayController::ShowAudioDetailedView() {
ShowDetailedView(std::make_unique<UnifiedAudioDetailedViewController>(this));
}
......@@ -343,6 +349,7 @@ void UnifiedSystemTrayController::InitFeaturePods() {
AddFeaturePodItem(std::make_unique<AccessibilityFeaturePodController>(this));
AddFeaturePodItem(std::make_unique<VPNFeaturePodController>(this));
AddFeaturePodItem(std::make_unique<IMEFeaturePodController>(this));
AddFeaturePodItem(std::make_unique<LocaleFeaturePodController>(this));
// If you want to add a new feature pod item, add here.
}
......
......@@ -85,6 +85,8 @@ class ASH_EXPORT UnifiedSystemTrayController
void ShowVPNDetailedView();
// Show the detailed view of IME. Called from the view.
void ShowIMEDetailedView();
// Show the detailed view of locale. Called from the view.
void ShowLocaleDetailedView();
// Show the detailed view of audio. Called from the view.
void ShowAudioDetailedView();
// Show the detailed view of notifier settings. Called from the view.
......
......@@ -10,11 +10,13 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/command_line.h"
#include "base/containers/flat_set.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/optional.h"
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/system/sys_info.h"
#include "base/task/post_task.h"
#include "chrome/browser/apps/platform_apps/app_load_service.h"
......@@ -25,6 +27,7 @@
#include "chrome/browser/chromeos/login/demo_mode/demo_setup_controller.h"
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/ash/system_tray_client.h"
#include "chrome/browser/ui/extensions/app_launch_params.h"
#include "chrome/browser/ui/extensions/application_launch.h"
#include "chrome/common/extensions/extension_constants.h"
......@@ -40,6 +43,7 @@
#include "extensions/browser/extension_registry.h"
#include "extensions/common/constants.h"
#include "net/base/network_change_notifier.h"
#include "ui/base/l10n/l10n_util.h"
namespace chromeos {
......@@ -148,6 +152,36 @@ void RestoreDefaultLocaleForNextSession() {
}
}
// Returns the list of locales (and related info) supported by demo mode.
std::vector<ash::mojom::LocaleInfoPtr> GetSupportedLocales() {
const base::flat_set<std::string> kSupportedLocales(
{"da", "en-GB", "en-US", "fi", "fr", "fr-CA", "nb", "nl", "sv"});
const std::vector<std::string>& available_locales =
l10n_util::GetAvailableLocales();
const std::string current_locale_iso_code =
ProfileManager::GetActiveUserProfile()->GetPrefs()->GetString(
language::prefs::kApplicationLocale);
std::vector<ash::mojom::LocaleInfoPtr> supported_locales;
for (const std::string& locale : available_locales) {
if (!kSupportedLocales.contains(locale))
continue;
ash::mojom::LocaleInfoPtr locale_info = ash::mojom::LocaleInfo::New();
locale_info->iso_code = locale;
locale_info->display_name = l10n_util::GetDisplayNameForLocale(
locale, current_locale_iso_code, true /* is_for_ui */);
const base::string16 native_display_name =
l10n_util::GetDisplayNameForLocale(locale, locale,
true /* is_for_ui */);
if (locale_info->display_name != native_display_name) {
locale_info->display_name +=
base::UTF8ToUTF16(" - ") + native_display_name;
}
supported_locales.push_back(std::move(locale_info));
}
return supported_locales;
}
} // namespace
// static
......@@ -386,6 +420,14 @@ void DemoSession::OnSessionStateChanged() {
session_manager::SessionState::ACTIVE) {
return;
}
// SystemTrayClient may not exist in unit tests.
if (SystemTrayClient::Get()) {
const std::string current_locale_iso_code =
ProfileManager::GetActiveUserProfile()->GetPrefs()->GetString(
language::prefs::kApplicationLocale);
SystemTrayClient::Get()->SetLocaleList(GetSupportedLocales(),
current_locale_iso_code);
}
RestoreDefaultLocaleForNextSession();
if (!offline_enrolled_)
......
......@@ -232,10 +232,12 @@ class Profile : public content::BrowserContext {
APP_LOCALE_CHANGED_VIA_LOGIN,
// From login to a public session.
APP_LOCALE_CHANGED_VIA_PUBLIC_SESSION_LOGIN,
// From AllowedLanguages policy
// From AllowedLanguages policy.
APP_LOCALE_CHANGED_VIA_POLICY,
// From demo session.
APP_LOCALE_CHANGED_VIA_DEMO_SESSION,
// From system tray.
APP_LOCALE_CHANGED_VIA_SYSTEM_TRAY,
// Source unknown.
APP_LOCALE_CHANGED_VIA_UNKNOWN
};
......
......@@ -20,6 +20,7 @@
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/chromeos/set_time_dialog.h"
#include "chrome/browser/chromeos/system/system_clock.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/lifetime/termination_notification.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
......@@ -220,6 +221,12 @@ void SystemTrayClient::SetPerformanceTracingIconVisible(bool visible) {
system_tray_->SetPerformanceTracingIconVisible(visible);
}
void SystemTrayClient::SetLocaleList(
std::vector<ash::mojom::LocaleInfoPtr> locale_list,
const std::string& current_locale_iso_code) {
system_tray_->SetLocaleList(std::move(locale_list), current_locale_iso_code);
}
////////////////////////////////////////////////////////////////////////////////
// ash::mojom::SystemTrayClient:
......@@ -444,6 +451,12 @@ void SystemTrayClient::RequestRestartForUpdate() {
browser_shutdown::NotifyAndTerminate(true /* fast_path */, reboot_policy);
}
void SystemTrayClient::SetLocaleAndExit(const std::string& locale_iso_code) {
ProfileManager::GetActiveUserProfile()->ChangeAppLocale(
locale_iso_code, Profile::APP_LOCALE_CHANGED_VIA_SYSTEM_TRAY);
chrome::AttemptUserExit();
}
void SystemTrayClient::HandleUpdateAvailable() {
// Show an update icon for Chrome updates and Flash component updates.
UpgradeDetector* detector = UpgradeDetector::GetInstance();
......
......@@ -58,6 +58,8 @@ class SystemTrayClient : public ash::mojom::SystemTrayClient,
void SetPrimaryTrayEnabled(bool enabled);
void SetPrimaryTrayVisible(bool visible);
void SetPerformanceTracingIconVisible(bool visible);
void SetLocaleList(std::vector<ash::mojom::LocaleInfoPtr> locale_list,
const std::string& current_locale_iso_code);
// ash::mojom::SystemTrayClient:
void ShowSettings() override;
......@@ -88,6 +90,7 @@ class SystemTrayClient : public ash::mojom::SystemTrayClient,
void ShowNetworkSettings(const std::string& network_id) override;
void ShowMultiDeviceSetup() override;
void RequestRestartForUpdate() override;
void SetLocaleAndExit(const std::string& locale_iso_code) override;
private:
// Helper function shared by ShowNetworkSettings() and ShowNetworkConfigure().
......
......@@ -49105,6 +49105,7 @@ would be helpful to identify which type is being sent.
<int value="25" label="VPN"/>
<int value="26" label="Night light"/>
<int value="27" label="Do not disturb"/>
<int value="28" label="Language"/>
</enum>
<enum name="SystemNotificationType">
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