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