Commit 481505b7 authored by Xiaoqian Dai's avatar Xiaoqian Dai Committed by Commit Bot

capture_mode: Add quick setting feature pod.

Bug: 1113032
Change-Id: Ief8e2a14d2367ad1c8cc65aecd89aa29dcb4d81c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2337634Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Commit-Queue: Xiaoqian Dai <xdai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#795282}
parent 758e2060
...@@ -251,6 +251,8 @@ component("ash") { ...@@ -251,6 +251,8 @@ component("ash") {
"cancel_mode.h", "cancel_mode.h",
"capture_mode/capture_mode_controller.cc", "capture_mode/capture_mode_controller.cc",
"capture_mode/capture_mode_controller.h", "capture_mode/capture_mode_controller.h",
"capture_mode/capture_mode_feature_pod_controller.cc",
"capture_mode/capture_mode_feature_pod_controller.h",
"clipboard/clipboard_history.cc", "clipboard/clipboard_history.cc",
"clipboard/clipboard_history.h", "clipboard/clipboard_history.h",
"clipboard/clipboard_history_controller.cc", "clipboard/clipboard_history_controller.cc",
......
...@@ -510,6 +510,10 @@ This file contains the strings for ash. ...@@ -510,6 +510,10 @@ This file contains the strings for ash.
Menu moved to the bottom-right corner of the screen. Menu moved to the bottom-right corner of the screen.
</message> </message>
<message name="IDS_ASH_STATUS_TRAY_CAPTURE_MODE_BUTTON_LABEL" desc="The label text for the button in the status tray to trigger capture mode.">
Screen capture
</message>
<message name="IDS_ASH_STATUS_TRAY_MIC_GAIN" desc="The accessible text for the toggle mic muted button in the tray audio settings"> <message name="IDS_ASH_STATUS_TRAY_MIC_GAIN" desc="The accessible text for the toggle mic muted button in the tray audio settings">
Toggle Mic. <ph name="STATE_TEXT">$1<ex>Mic is muted</ex></ph> Toggle Mic. <ph name="STATE_TEXT">$1<ex>Mic is muted</ex></ph>
</message> </message>
......
3beac37cfacaecd37ec12886f2719fdb4102cbc2
\ No newline at end of file
// 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 "ash/capture_mode/capture_mode_feature_pod_controller.h"
#include "ash/capture_mode/capture_mode_controller.h"
#include "ash/resources/vector_icons/vector_icons.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/system/tray/system_tray_item_uma_type.h"
#include "ash/system/unified/feature_pod_button.h"
#include "ui/base/l10n/l10n_util.h"
namespace ash {
CaptureModeFeaturePodController::CaptureModeFeaturePodController() = default;
CaptureModeFeaturePodController::~CaptureModeFeaturePodController() = default;
FeaturePodButton* CaptureModeFeaturePodController::CreateButton() {
DCHECK(!button_);
button_ = new FeaturePodButton(this, /*is_togglable=*/false);
button_->SetVectorIcon(kCaptureModeIcon);
button_->SetLabel(
l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_CAPTURE_MODE_BUTTON_LABEL));
return button_;
}
void CaptureModeFeaturePodController::OnIconPressed() {
CaptureModeController::Get()->Start();
}
SystemTrayItemUmaType CaptureModeFeaturePodController::GetUmaType() const {
return SystemTrayItemUmaType::UMA_SCREEN_CAPTURE;
}
} // namespace ash
// 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 ASH_CAPTURE_MODE_CAPTURE_MODE_FEATURE_POD_CONTROLLER_H_
#define ASH_CAPTURE_MODE_CAPTURE_MODE_FEATURE_POD_CONTROLLER_H_
#include "ash/system/unified/feature_pod_controller_base.h"
#include "base/macros.h"
namespace ash {
// Controller of a feature pod button that toggles night light mode.
class CaptureModeFeaturePodController : public FeaturePodControllerBase {
public:
CaptureModeFeaturePodController();
CaptureModeFeaturePodController(const CaptureModeFeaturePodController&) =
delete;
CaptureModeFeaturePodController& operator=(
const CaptureModeFeaturePodController&) = delete;
~CaptureModeFeaturePodController() override;
// FeaturePodControllerBase:
FeaturePodButton* CreateButton() override;
void OnIconPressed() override;
SystemTrayItemUmaType GetUmaType() const override;
private:
FeaturePodButton* button_ = nullptr;
};
} // namespace ash
#endif // ASH_CAPTURE_MODE_CAPTURE_MODE_FEATURE_POD_CONTROLLER_H_
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "ash/system/unified/unified_system_tray_controller.h" #include "ash/system/unified/unified_system_tray_controller.h"
#include "ash/capture_mode/capture_mode_feature_pod_controller.h"
#include "ash/metrics/user_metrics_action.h" #include "ash/metrics/user_metrics_action.h"
#include "ash/metrics/user_metrics_recorder.h" #include "ash/metrics/user_metrics_recorder.h"
#include "ash/public/cpp/ash_features.h" #include "ash/public/cpp/ash_features.h"
...@@ -411,6 +412,8 @@ void UnifiedSystemTrayController::InitFeaturePods() { ...@@ -411,6 +412,8 @@ void UnifiedSystemTrayController::InitFeaturePods() {
AddFeaturePodItem(std::make_unique<VPNFeaturePodController>(this)); AddFeaturePodItem(std::make_unique<VPNFeaturePodController>(this));
AddFeaturePodItem(std::make_unique<IMEFeaturePodController>(this)); AddFeaturePodItem(std::make_unique<IMEFeaturePodController>(this));
AddFeaturePodItem(std::make_unique<LocaleFeaturePodController>(this)); AddFeaturePodItem(std::make_unique<LocaleFeaturePodController>(this));
if (features::IsCaptureModeEnabled())
AddFeaturePodItem(std::make_unique<CaptureModeFeaturePodController>());
// If you want to add a new feature pod item, add here. // If you want to add a new feature pod item, add here.
......
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