Commit a6682b15 authored by Tim Song's avatar Tim Song Committed by Commit Bot

[CrOS PhoneHub] Refactor interstitial screen logging.

BUG=1138137,1106937

Change-Id: If93f56067d670e1baa8e4e5fd639b2a4768df2b4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2516389Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Tim Song <tengs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#823720}
parent ba0727e6
......@@ -25,7 +25,6 @@
namespace ash {
using phone_hub_metrics::InterstitialScreenEvent;
using phone_hub_metrics::LogInterstitialScreenEvent;
using phone_hub_metrics::Screen;
BluetoothDisabledView::BluetoothDisabledView() {
......@@ -67,8 +66,7 @@ BluetoothDisabledView::BluetoothDisabledView() {
confirm->SetID(PhoneHubViewID::kBluetoothDisabledConfirmButton);
content_view_->AddButton(std::move(confirm));
LogInterstitialScreenEvent(GetScreenForMetrics(),
InterstitialScreenEvent::kShown);
LogInterstitialScreenEvent(InterstitialScreenEvent::kShown);
}
BluetoothDisabledView::~BluetoothDisabledView() = default;
......@@ -78,15 +76,13 @@ phone_hub_metrics::Screen BluetoothDisabledView::GetScreenForMetrics() const {
}
void BluetoothDisabledView::LearnMoreButtonPressed() {
LogInterstitialScreenEvent(GetScreenForMetrics(),
InterstitialScreenEvent::kLearnMore);
LogInterstitialScreenEvent(InterstitialScreenEvent::kLearnMore);
NewWindowDelegate::GetInstance()->NewTabWithUrl(
GURL(kLearnMoreUrl), /*from_user_interaction=*/true);
}
void BluetoothDisabledView::ConfirmButtonPressed() {
LogInterstitialScreenEvent(GetScreenForMetrics(),
InterstitialScreenEvent::kConfirm);
LogInterstitialScreenEvent(InterstitialScreenEvent::kConfirm);
Shell::GetPrimaryRootWindowController()
->GetStatusAreaWidget()
->phone_hub_tray()
......
......@@ -23,7 +23,7 @@ class ASH_EXPORT BluetoothDisabledView : public PhoneHubContentView {
BluetoothDisabledView& operator=(const BluetoothDisabledView&) = delete;
~BluetoothDisabledView() override;
// PhoneHubInterstitialView:
// PhoneHubContentView:
phone_hub_metrics::Screen GetScreenForMetrics() const override;
private:
......
......@@ -24,7 +24,6 @@
namespace ash {
using phone_hub_metrics::InterstitialScreenEvent;
using phone_hub_metrics::LogInterstitialScreenEvent;
using phone_hub_metrics::Screen;
ConnectionErrorView::ConnectionErrorView(
......@@ -54,8 +53,8 @@ ConnectionErrorView::ConnectionErrorView(
IDS_ASH_PHONE_HUB_CONNECTION_ERROR_DIALOG_DESCRIPTION));
if (error == ErrorStatus::kReconnecting) {
LogInterstitialScreenEvent(Screen::kReconnecting,
InterstitialScreenEvent::kShown);
phone_hub_metrics::LogInterstitialScreenEvent(
Screen::kReconnecting, InterstitialScreenEvent::kShown);
return;
}
......@@ -90,8 +89,8 @@ ConnectionErrorView::ConnectionErrorView(
refresh->SetID(PhoneHubViewID::kDisconnectedRefreshButton);
content_view_->AddButton(std::move(refresh));
LogInterstitialScreenEvent(Screen::kConnectionError,
InterstitialScreenEvent::kShown);
phone_hub_metrics::LogInterstitialScreenEvent(
Screen::kConnectionError, InterstitialScreenEvent::kShown);
}
ConnectionErrorView::~ConnectionErrorView() = default;
......@@ -104,7 +103,7 @@ phone_hub_metrics::Screen ConnectionErrorView::GetScreenForMetrics() const {
void ConnectionErrorView::ButtonPressed(InterstitialScreenEvent event,
base::RepeatingClosure callback) {
LogInterstitialScreenEvent(GetScreenForMetrics(), event);
LogInterstitialScreenEvent(event);
std::move(callback).Run();
}
......
......@@ -21,7 +21,6 @@
namespace ash {
using phone_hub_metrics::InterstitialScreenEvent;
using phone_hub_metrics::LogInterstitialScreenEvent;
using phone_hub_metrics::Screen;
InitialConnectingView::InitialConnectingView() {
......@@ -40,8 +39,7 @@ InitialConnectingView::InitialConnectingView() {
content_view_->SetDescription(l10n_util::GetStringUTF16(
IDS_ASH_PHONE_HUB_INITIAL_CONNECTING_DIALOG_DESCRIPTION));
LogInterstitialScreenEvent(GetScreenForMetrics(),
InterstitialScreenEvent::kShown);
LogInterstitialScreenEvent(InterstitialScreenEvent::kShown);
}
InitialConnectingView::~InitialConnectingView() = default;
......
......@@ -35,7 +35,6 @@
namespace ash {
using phone_hub_metrics::InterstitialScreenEvent;
using phone_hub_metrics::LogInterstitialScreenEvent;
using phone_hub_metrics::Screen;
// OnboardingMainView ---------------------------------------------------------
......@@ -95,14 +94,12 @@ class OnboardingMainView : public PhoneHubInterstitialView {
}
void GetStartedButtonPressed() {
LogInterstitialScreenEvent(GetScreenForMetrics(),
InterstitialScreenEvent::kConfirm);
LogInterstitialScreenEvent(InterstitialScreenEvent::kConfirm);
onboarding_ui_tracker_->HandleGetStarted();
}
void DismissButtonPressed() {
LogInterstitialScreenEvent(GetScreenForMetrics(),
InterstitialScreenEvent::kDismiss);
LogInterstitialScreenEvent(InterstitialScreenEvent::kDismiss);
parent_view_->ShowDismissPrompt();
}
......@@ -148,8 +145,7 @@ class OnboardingDismissPromptView : public PhoneHubInterstitialView {
}
void ButtonPressed() {
LogInterstitialScreenEvent(GetScreenForMetrics(),
InterstitialScreenEvent::kConfirm);
LogInterstitialScreenEvent(InterstitialScreenEvent::kConfirm);
Shell::GetPrimaryRootWindowController()
->GetStatusAreaWidget()
......@@ -178,8 +174,7 @@ OnboardingView::OnboardingView(
main_view_ = AddChildView(
std::make_unique<OnboardingMainView>(onboarding_ui_tracker_, this));
LogInterstitialScreenEvent(GetScreenForMetrics(),
InterstitialScreenEvent::kShown);
LogInterstitialScreenEvent(InterstitialScreenEvent::kShown);
}
OnboardingView::~OnboardingView() = default;
......@@ -195,8 +190,7 @@ Screen OnboardingView::GetScreenForMetrics() const {
void OnboardingView::ShowDismissPrompt() {
DCHECK(main_view_);
LogInterstitialScreenEvent(GetScreenForMetrics(),
InterstitialScreenEvent::kShown);
LogInterstitialScreenEvent(InterstitialScreenEvent::kShown);
RemoveChildView(main_view_);
main_view_ = AddChildView(
......
......@@ -17,4 +17,9 @@ phone_hub_metrics::Screen PhoneHubContentView::GetScreenForMetrics() const {
return phone_hub_metrics::Screen::kInvalid;
}
void PhoneHubContentView::LogInterstitialScreenEvent(
phone_hub_metrics::InterstitialScreenEvent event) {
phone_hub_metrics::LogInterstitialScreenEvent(GetScreenForMetrics(), event);
}
} // namespace ash
......@@ -25,6 +25,9 @@ class ASH_EXPORT PhoneHubContentView : public views::View {
protected:
PhoneHubContentView();
void LogInterstitialScreenEvent(
phone_hub_metrics::InterstitialScreenEvent event);
};
} // namespace ash
......
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