Commit d626fdeb authored by Meilin Wang's avatar Meilin Wang Committed by Commit Bot

[CrOS PhoneHub] Add onboarding dismiss UI.

This CL adds a new onboarding dismiss prompt by:
- Introduced a superclass |PhoneHubContentView| for all content views
  with an |OnBubbleClose| function.
- Separate the previous |OnboardingView| to |OnboardingMainView| which
  is responsible for displaying the main page of the onboarding view,
  and |OnboardingDismissPromptView| which is responsible for displaying
  the dismiss prompt.
- Refactors the content view classes to inherit from the superclass.
- Updates and refactors the unittest.

Screenshot: https://screenshot.googleplex.com/7vqNqrD9im5vvVS.png

Future work:
Update the UI to spec by removing the phone status bar.

BUG=1106937,1126208

Change-Id: I6d4f164526d37e7018aa696324e8b1f7878492bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2474253
Commit-Queue: Meilin Wang <meilinw@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarTim Song <tengs@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#820325}
parent e97ff163
...@@ -1162,6 +1162,8 @@ component("ash") { ...@@ -1162,6 +1162,8 @@ component("ash") {
"system/phonehub/onboarding_view.h", "system/phonehub/onboarding_view.h",
"system/phonehub/phone_connected_view.cc", "system/phonehub/phone_connected_view.cc",
"system/phonehub/phone_connected_view.h", "system/phonehub/phone_connected_view.h",
"system/phonehub/phone_hub_content_view.cc",
"system/phonehub/phone_hub_content_view.h",
"system/phonehub/phone_hub_interstitial_view.cc", "system/phonehub/phone_hub_interstitial_view.cc",
"system/phonehub/phone_hub_interstitial_view.h", "system/phonehub/phone_hub_interstitial_view.h",
"system/phonehub/phone_hub_metrics.cc", "system/phonehub/phone_hub_metrics.cc",
...@@ -2158,7 +2160,6 @@ test("ash_unittests") { ...@@ -2158,7 +2160,6 @@ test("ash_unittests") {
"system/palette/tools/create_note_unittest.cc", "system/palette/tools/create_note_unittest.cc",
"system/palette/tools/metalayer_unittest.cc", "system/palette/tools/metalayer_unittest.cc",
"system/palette/tools/screenshot_unittest.cc", "system/palette/tools/screenshot_unittest.cc",
"system/phonehub/onboarding_view_unittest.cc",
"system/phonehub/phone_hub_notification_controller_unittest.cc", "system/phonehub/phone_hub_notification_controller_unittest.cc",
"system/phonehub/phone_hub_tray_unittest.cc", "system/phonehub/phone_hub_tray_unittest.cc",
"system/phonehub/phone_hub_ui_controller_unittest.cc", "system/phonehub/phone_hub_ui_controller_unittest.cc",
......
...@@ -1064,6 +1064,18 @@ This file contains the strings for ash. ...@@ -1064,6 +1064,18 @@ This file contains the strings for ash.
<message name="IDS_ASH_PHONE_HUB_ONBOARDING_DIALOG_GET_STARTED_BUTTON" desc="Get started button on the onboarding dialog for user to opt in this feature and start the consent flow."> <message name="IDS_ASH_PHONE_HUB_ONBOARDING_DIALOG_GET_STARTED_BUTTON" desc="Get started button on the onboarding dialog for user to opt in this feature and start the consent flow.">
Get started Get started
</message> </message>
<message name="IDS_ASH_PHONE_HUB_ONBOARDING_DISMISS_DIALOG_TITLE" desc="The title of the dialog that pops up after user clicks the dismiss button on the onboarding dialog.">
Set up Phone Hub later
</message>
<message name="IDS_ASH_PHONE_HUB_ONBOARDING_DISMISS_DIALOG_DESCRIPTION_PART_1" desc="The description of the dialog that pops up after user clicks the dismiss button on the onboarding dialog. Also see IDS_ASH_PHONE_HUB_ONBOARDING_DISMISS_DIALOG_DESCRIPTION_PART_2." translateable="false">
View quick actions to extend the phone internet connection, control DND and locate your phone. Also view active Chrome tabs from your phone on your Chromebook.
</message>
<message name="IDS_ASH_PHONE_HUB_ONBOARDING_DISMISS_DIALOG_DESCRIPTION_PART_2" desc="The description of the dialog that pops up after user clicks the dismiss button on the onboarding dialog. Also see IDS_ASH_PHONE_HUB_ONBOARDING_DISMISS_DIALOG_DESCRIPTION_PART_1." translateable="false">
You can always set up later from Settings.
</message>
<message name="IDS_ASH_PHONE_HUB_ONBOARDING_DISMISS_DIALOG_OK_BUTTON" desc="Confirm button on the onboarding dismiss dialog to acknowledge.">
Ok, got it
</message>
<message name="IDS_ASH_PHONE_HUB_INITIAL_CONNECTING_DIALOG_TITLE" desc="The title of the initial connecting dialog that indicates the device is trying to connect to your phone after the user has opted in the Phone Hub feature."> <message name="IDS_ASH_PHONE_HUB_INITIAL_CONNECTING_DIALOG_TITLE" desc="The title of the initial connecting dialog that indicates the device is trying to connect to your phone after the user has opted in the Phone Hub feature.">
Connecting to your phone... Connecting to your phone...
</message> </message>
......
f5e31259e5b435facade2be2252866c432c865c2
\ No newline at end of file
dd7eee95aaa308c38ffacf4198c1c8618c8029b4
\ No newline at end of file
68d5ed6007081a9bfe3bd806155fbc65337cd038
\ No newline at end of file
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define ASH_SYSTEM_PHONEHUB_BLUETOOTH_DISABLED_VIEW_H_ #define ASH_SYSTEM_PHONEHUB_BLUETOOTH_DISABLED_VIEW_H_
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/system/phonehub/phone_hub_content_view.h"
#include "ui/views/controls/button/button.h" #include "ui/views/controls/button/button.h"
namespace ash { namespace ash {
...@@ -14,7 +15,7 @@ class PhoneHubInterstitialView; ...@@ -14,7 +15,7 @@ class PhoneHubInterstitialView;
// An interstitial view representing an error state where the Phone Hub // An interstitial view representing an error state where the Phone Hub
// feature is not available because Bluetooth is turned off on this device. // feature is not available because Bluetooth is turned off on this device.
class ASH_EXPORT BluetoothDisabledView : public views::View, class ASH_EXPORT BluetoothDisabledView : public PhoneHubContentView,
public views::ButtonListener { public views::ButtonListener {
public: public:
METADATA_HEADER(BluetoothDisabledView); METADATA_HEADER(BluetoothDisabledView);
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define ASH_SYSTEM_PHONEHUB_CONNECTION_ERROR_VIEW_H_ #define ASH_SYSTEM_PHONEHUB_CONNECTION_ERROR_VIEW_H_
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/system/phonehub/phone_hub_content_view.h"
#include "ui/views/controls/button/button.h" #include "ui/views/controls/button/button.h"
namespace chromeos { namespace chromeos {
...@@ -20,7 +21,7 @@ class PhoneHubInterstitialView; ...@@ -20,7 +21,7 @@ class PhoneHubInterstitialView;
// An interstitial view represeting that the Phone Hub feature is not available // An interstitial view represeting that the Phone Hub feature is not available
// due to connection issues. // due to connection issues.
class ASH_EXPORT ConnectionErrorView : public views::View, class ASH_EXPORT ConnectionErrorView : public PhoneHubContentView,
public views::ButtonListener { public views::ButtonListener {
public: public:
METADATA_HEADER(ConnectionErrorView); METADATA_HEADER(ConnectionErrorView);
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define ASH_SYSTEM_PHONEHUB_INITIAL_CONNECTING_VIEW_H_ #define ASH_SYSTEM_PHONEHUB_INITIAL_CONNECTING_VIEW_H_
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/system/phonehub/phone_hub_content_view.h"
#include "ui/views/metadata/metadata_header_macros.h" #include "ui/views/metadata/metadata_header_macros.h"
#include "ui/views/view.h" #include "ui/views/view.h"
...@@ -16,7 +17,7 @@ class PhoneHubInterstitialView; ...@@ -16,7 +17,7 @@ class PhoneHubInterstitialView;
// An interstitial view representing this device is trying to connect to your // An interstitial view representing this device is trying to connect to your
// phone after the user has opted in the Phone Hub feature through the // phone after the user has opted in the Phone Hub feature through the
// onboarding UI. // onboarding UI.
class ASH_EXPORT InitialConnectingView : public views::View { class ASH_EXPORT InitialConnectingView : public PhoneHubContentView {
public: public:
METADATA_HEADER(InitialConnectingView); METADATA_HEADER(InitialConnectingView);
......
...@@ -10,21 +10,26 @@ ...@@ -10,21 +10,26 @@
#include "ash/public/cpp/resources/grit/ash_public_unscaled_resources.h" #include "ash/public/cpp/resources/grit/ash_public_unscaled_resources.h"
#include "ash/public/cpp/system_tray_client.h" #include "ash/public/cpp/system_tray_client.h"
#include "ash/root_window_controller.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h" #include "ash/strings/grit/ash_strings.h"
#include "ash/style/ash_color_provider.h" #include "ash/style/ash_color_provider.h"
#include "ash/system/model/system_tray_model.h" #include "ash/system/model/system_tray_model.h"
#include "ash/system/phonehub/interstitial_view_button.h" #include "ash/system/phonehub/interstitial_view_button.h"
#include "ash/system/phonehub/phone_hub_content_view.h"
#include "ash/system/phonehub/phone_hub_interstitial_view.h" #include "ash/system/phonehub/phone_hub_interstitial_view.h"
#include "ash/system/phonehub/phone_hub_metrics.h" #include "ash/system/phonehub/phone_hub_metrics.h"
#include "ash/system/phonehub/phone_hub_tray.h"
#include "ash/system/phonehub/phone_hub_view_ids.h" #include "ash/system/phonehub/phone_hub_view_ids.h"
#include "ash/system/status_area_widget.h"
#include "ash/system/tray/tray_bubble_view.h"
#include "ash/system/unified/rounded_label_button.h" #include "ash/system/unified/rounded_label_button.h"
#include "base/strings/strcat.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "chromeos/components/phonehub/onboarding_ui_tracker.h" #include "chromeos/components/phonehub/onboarding_ui_tracker.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
#include "ui/views/controls/button/button.h" #include "ui/views/controls/button/button.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/layout/fill_layout.h" #include "ui/views/layout/fill_layout.h"
#include "ui/views/metadata/metadata_impl_macros.h" #include "ui/views/metadata/metadata_impl_macros.h"
...@@ -34,43 +39,142 @@ using phone_hub_metrics::InterstitialScreen; ...@@ -34,43 +39,142 @@ using phone_hub_metrics::InterstitialScreen;
using phone_hub_metrics::InterstitialScreenEvent; using phone_hub_metrics::InterstitialScreenEvent;
using phone_hub_metrics::LogInterstitialScreenEvent; using phone_hub_metrics::LogInterstitialScreenEvent;
// OnboardingMainView ---------------------------------------------------------
// Main onboarding screen with Phone Hub feature description and two buttons
// (Get Started and Dismiss), where user can either choose to grant permission
// to enable this feature or dismiss the screen.
class OnboardingMainView : public PhoneHubInterstitialView,
public views::ButtonListener {
public:
OnboardingMainView(
chromeos::phonehub::OnboardingUiTracker* onboarding_ui_tracker,
OnboardingView* parent_view)
: PhoneHubInterstitialView(/*show_progress=*/false),
onboarding_ui_tracker_(onboarding_ui_tracker),
parent_view_(parent_view) {
SetID(PhoneHubViewID::kOnboardingMainView);
InitLayout();
}
// views::ButtonListener:
// TODO(crbug.com/1141629): deprecated, replace with |PressedCallback|.
void ButtonPressed(views::Button* sender, const ui::Event& event) override {
switch (sender->GetID()) {
case PhoneHubViewID::kOnboardingGetStartedButton:
// TODO(tengs): Distinguish between the two different onboarding flows.
LogInterstitialScreenEvent(
InterstitialScreen::kOnboardingNewMultideviceUser,
InterstitialScreenEvent::kConfirm);
onboarding_ui_tracker_->HandleGetStarted();
return;
case PhoneHubViewID::kOnboardingDismissButton:
// TODO(tengs): Distinguish between the two different onboarding flows.
LogInterstitialScreenEvent(
InterstitialScreen::kOnboardingNewMultideviceUser,
InterstitialScreenEvent::kDismiss);
parent_view_->ShowDismissPrompt();
return;
}
}
private:
void InitLayout() {
// TODO(crbug.com/1127996): Replace PNG file with vector icon.
gfx::ImageSkia* image =
ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
IDR_PHONE_HUB_ONBOARDING_IMAGE);
SetImage(*image);
SetTitle(
l10n_util::GetStringUTF16(IDS_ASH_PHONE_HUB_ONBOARDING_DIALOG_TITLE));
SetDescription(l10n_util::GetStringUTF16(
IDS_ASH_PHONE_HUB_ONBOARDING_DIALOG_DESCRIPTION));
// Add "Dismiss" and "Get started" buttons.
auto dismiss = std::make_unique<InterstitialViewButton>(
this,
l10n_util::GetStringUTF16(
IDS_ASH_PHONE_HUB_ONBOARDING_DIALOG_DISMISS_BUTTON),
/*paint_background=*/false);
dismiss->SetEnabledTextColors(AshColorProvider::Get()->GetContentLayerColor(
AshColorProvider::ContentLayerType::kTextColorPrimary));
dismiss->SetID(PhoneHubViewID::kOnboardingDismissButton);
AddButton(std::move(dismiss));
auto get_started = std::make_unique<InterstitialViewButton>(
this,
l10n_util::GetStringUTF16(
IDS_ASH_PHONE_HUB_ONBOARDING_DIALOG_GET_STARTED_BUTTON),
/*paint_background=*/true);
get_started->SetID(PhoneHubViewID::kOnboardingGetStartedButton);
AddButton(std::move(get_started));
}
chromeos::phonehub::OnboardingUiTracker* onboarding_ui_tracker_ = nullptr;
OnboardingView* parent_view_ = nullptr;
};
// OnboardingDismissPromptView ------------------------------------------------
// A follow-up prompt screen that pops up when the user has chosen to dismiss
// the main onboarding screen. It should not be shown again after being
// dismissed manually by either clicking the ack button or outside the bubble.
class OnboardingDismissPromptView : public PhoneHubInterstitialView,
public views::ButtonListener {
public:
explicit OnboardingDismissPromptView(
chromeos::phonehub::OnboardingUiTracker* onboarding_ui_tracker)
: PhoneHubInterstitialView(/*show_progress=*/false),
onboarding_ui_tracker_(onboarding_ui_tracker) {
SetID(PhoneHubViewID::kOnboardingDismissPromptView);
InitLayout();
}
private:
void InitLayout() {
// Adds title and description.
SetTitle(l10n_util::GetStringUTF16(
IDS_ASH_PHONE_HUB_ONBOARDING_DISMISS_DIALOG_TITLE));
base::string16 part1 = l10n_util::GetStringUTF16(
IDS_ASH_PHONE_HUB_ONBOARDING_DISMISS_DIALOG_DESCRIPTION_PART_1);
base::string16 part2 = l10n_util::GetStringUTF16(
IDS_ASH_PHONE_HUB_ONBOARDING_DISMISS_DIALOG_DESCRIPTION_PART_2);
// Uses "\n" to create a newline separator between two text paragraphs.
SetDescription(base::StrCat({part1, base::ASCIIToUTF16("\n\n"), part2}));
// Adds "Ok, got it" button.
auto ack_button = std::make_unique<InterstitialViewButton>(
this,
l10n_util::GetStringUTF16(
IDS_ASH_PHONE_HUB_ONBOARDING_DISMISS_DIALOG_OK_BUTTON),
/*paint_background=*/true);
ack_button->SetID(PhoneHubViewID::kOnboardingDismissAckButton);
AddButton(std::move(ack_button));
}
// PhoneHubContentView:
void OnBubbleClose() override { onboarding_ui_tracker_->DismissSetupUi(); }
// views::ButtonListener:
void ButtonPressed(views::Button* sender, const ui::Event& event) override {
DCHECK_EQ(sender->GetID(), PhoneHubViewID::kOnboardingDismissAckButton);
Shell::GetPrimaryRootWindowController()
->GetStatusAreaWidget()
->phone_hub_tray()
->CloseBubble();
}
chromeos::phonehub::OnboardingUiTracker* onboarding_ui_tracker_ = nullptr;
};
// OnboardingView -------------------------------------------------------------
OnboardingView::OnboardingView( OnboardingView::OnboardingView(
chromeos::phonehub::OnboardingUiTracker* onboarding_ui_tracker) chromeos::phonehub::OnboardingUiTracker* onboarding_ui_tracker,
: onboarding_ui_tracker_(onboarding_ui_tracker) { TrayBubbleView* bubble_view)
: onboarding_ui_tracker_(onboarding_ui_tracker), bubble_view_(bubble_view) {
SetID(PhoneHubViewID::kOnboardingView); SetID(PhoneHubViewID::kOnboardingView);
SetLayoutManager(std::make_unique<views::FillLayout>()); SetLayoutManager(std::make_unique<views::FillLayout>());
content_view_ = AddChildView( main_view_ = AddChildView(
std::make_unique<PhoneHubInterstitialView>(/*show_progress=*/false)); std::make_unique<OnboardingMainView>(onboarding_ui_tracker_, this));
// TODO(crbug.com/1127996): Replace PNG file with vector icon.
gfx::ImageSkia* image =
ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
IDR_PHONE_HUB_ONBOARDING_IMAGE);
content_view_->SetImage(*image);
content_view_->SetTitle(
l10n_util::GetStringUTF16(IDS_ASH_PHONE_HUB_ONBOARDING_DIALOG_TITLE));
content_view_->SetDescription(l10n_util::GetStringUTF16(
IDS_ASH_PHONE_HUB_ONBOARDING_DIALOG_DESCRIPTION));
// Add "Dismiss" and "Get started" buttons.
auto dismiss = std::make_unique<InterstitialViewButton>(
this,
l10n_util::GetStringUTF16(
IDS_ASH_PHONE_HUB_ONBOARDING_DIALOG_DISMISS_BUTTON),
/*paint_background=*/false);
dismiss->SetEnabledTextColors(AshColorProvider::Get()->GetContentLayerColor(
AshColorProvider::ContentLayerType::kTextColorPrimary));
dismiss->SetID(PhoneHubViewID::kOnboardingDismissButton);
content_view_->AddButton(std::move(dismiss));
auto get_started = std::make_unique<InterstitialViewButton>(
this,
l10n_util::GetStringUTF16(
IDS_ASH_PHONE_HUB_ONBOARDING_DIALOG_GET_STARTED_BUTTON),
/*paint_background=*/true);
get_started->SetID(PhoneHubViewID::kOnboardingGetStartedButton);
content_view_->AddButton(std::move(get_started));
// TODO(tengs): Distinguish between the two different onboarding flows. // TODO(tengs): Distinguish between the two different onboarding flows.
LogInterstitialScreenEvent(InterstitialScreen::kOnboardingNewMultideviceUser, LogInterstitialScreenEvent(InterstitialScreen::kOnboardingNewMultideviceUser,
...@@ -79,24 +183,19 @@ OnboardingView::OnboardingView( ...@@ -79,24 +183,19 @@ OnboardingView::OnboardingView(
OnboardingView::~OnboardingView() = default; OnboardingView::~OnboardingView() = default;
void OnboardingView::ButtonPressed(views::Button* sender, void OnboardingView::OnBubbleClose() {
const ui::Event& event) { main_view_->OnBubbleClose();
switch (sender->GetID()) { }
case PhoneHubViewID::kOnboardingGetStartedButton:
// TODO(tengs): Distinguish between the two different onboarding flows. void OnboardingView::ShowDismissPrompt() {
LogInterstitialScreenEvent( DCHECK(main_view_);
InterstitialScreen::kOnboardingNewMultideviceUser,
InterstitialScreenEvent::kConfirm); RemoveChildView(main_view_);
onboarding_ui_tracker_->HandleGetStarted(); main_view_ = AddChildView(
return; std::make_unique<OnboardingDismissPromptView>(onboarding_ui_tracker_));
case PhoneHubViewID::kOnboardingDismissButton:
// TODO(tengs): Distinguish between the two different onboarding flows. // Updates bubble to handle size change with a different child view.
LogInterstitialScreenEvent( bubble_view_->UpdateBubble();
InterstitialScreen::kOnboardingNewMultideviceUser,
InterstitialScreenEvent::kDismiss);
onboarding_ui_tracker_->DismissSetupUi();
return;
}
} }
BEGIN_METADATA(OnboardingView, views::View) BEGIN_METADATA(OnboardingView, views::View)
......
...@@ -5,7 +5,11 @@ ...@@ -5,7 +5,11 @@
#ifndef ASH_SYSTEM_PHONEHUB_ONBOARDING_VIEW_H_ #ifndef ASH_SYSTEM_PHONEHUB_ONBOARDING_VIEW_H_
#define ASH_SYSTEM_PHONEHUB_ONBOARDING_VIEW_H_ #define ASH_SYSTEM_PHONEHUB_ONBOARDING_VIEW_H_
#include <memory>
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/system/phonehub/phone_hub_content_view.h"
#include "ash/system/tray/tray_bubble_view.h"
#include "ui/views/controls/button/button.h" #include "ui/views/controls/button/button.h"
#include "ui/views/metadata/metadata_header_macros.h" #include "ui/views/metadata/metadata_header_macros.h"
#include "ui/views/view.h" #include "ui/views/view.h"
...@@ -21,27 +25,32 @@ namespace ash { ...@@ -21,27 +25,32 @@ namespace ash {
class PhoneHubInterstitialView; class PhoneHubInterstitialView;
// An additional entry point UI to ask the existing multidevice users to opt in // An additional entry point UI to ask the existing multidevice users to opt in
// and set up the Phone feature on this device. // and set up the Phone feature on this device. Note that this class handles
class ASH_EXPORT OnboardingView : public views::View, // both the main onboarding screen and the dismiss prompt together.
public views::ButtonListener { class ASH_EXPORT OnboardingView : public PhoneHubContentView {
public: public:
METADATA_HEADER(OnboardingView); METADATA_HEADER(OnboardingView);
explicit OnboardingView( OnboardingView(chromeos::phonehub::OnboardingUiTracker* onboarding_ui_tracker,
chromeos::phonehub::OnboardingUiTracker* onboarding_ui_tracker); TrayBubbleView* bubble_view);
OnboardingView(const OnboardingView&) = delete; OnboardingView(const OnboardingView&) = delete;
OnboardingView& operator=(const OnboardingView&) = delete; OnboardingView& operator=(const OnboardingView&) = delete;
~OnboardingView() override; ~OnboardingView() override;
// views::ButtonListener: // Update |content_view_| to display the dismiss prompt contents.
void ButtonPressed(views::Button* sender, const ui::Event& event) override; // Invoked when user clicks the "Dismiss" button on the main onboarding view.
void ShowDismissPrompt();
private: // PhoneHubContentView:
chromeos::phonehub::OnboardingUiTracker* onboarding_ui_tracker_ = nullptr; void OnBubbleClose() override;
private:
// The view responsible for displaying the onboarding UI contents. // The view responsible for displaying the onboarding UI contents.
// Owned by view hierarchy. // Owned by view hierarchy.
PhoneHubInterstitialView* content_view_ = nullptr; PhoneHubInterstitialView* main_view_ = nullptr;
chromeos::phonehub::OnboardingUiTracker* onboarding_ui_tracker_ = nullptr;
TrayBubbleView* bubble_view_ = nullptr;
}; };
} // namespace ash } // 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.
#include "ash/system/phonehub/onboarding_view.h"
#include <memory>
#include "ash/public/cpp/test/test_system_tray_client.h"
#include "ash/system/phonehub/phone_hub_view_ids.h"
#include "ash/test/ash_test_base.h"
#include "base/test/scoped_feature_list.h"
#include "chromeos/components/phonehub/fake_onboarding_ui_tracker.h"
#include "chromeos/constants/chromeos_features.h"
namespace ash {
class OnboardingViewTest : public AshTestBase {
public:
OnboardingViewTest() = default;
~OnboardingViewTest() override = default;
// AshTestBase:
void SetUp() override {
feature_list_.InitAndEnableFeature(chromeos::features::kPhoneHub);
AshTestBase::SetUp();
onboarding_view_ =
std::make_unique<OnboardingView>(&fake_onboarding_ui_tracker_);
}
void TearDown() override {
onboarding_view_.reset();
AshTestBase::TearDown();
}
protected:
OnboardingView* onboarding_view() { return onboarding_view_.get(); }
views::Button* get_started_button() {
return static_cast<views::Button*>(onboarding_view_->GetViewByID(
PhoneHubViewID::kOnboardingGetStartedButton));
}
views::Button* dismiss_button() {
return static_cast<views::Button*>(onboarding_view_->GetViewByID(
PhoneHubViewID::kOnboardingDismissButton));
}
chromeos::phonehub::FakeOnboardingUiTracker* fake_onboarding_ui_tracker() {
return &fake_onboarding_ui_tracker_;
}
private:
base::test::ScopedFeatureList feature_list_;
chromeos::phonehub::FakeOnboardingUiTracker fake_onboarding_ui_tracker_;
std::unique_ptr<OnboardingView> onboarding_view_ = nullptr;
};
TEST_F(OnboardingViewTest, PressGetStartedButton) {
EXPECT_EQ(0u, fake_onboarding_ui_tracker()->handle_get_started_call_count());
// Simulates a mouse press on the Get started button.
onboarding_view()->ButtonPressed(
get_started_button(),
ui::MouseEvent(ui::ET_MOUSE_PRESSED, gfx::PointF(), gfx::PointF(),
base::TimeTicks(), 0, 0));
// Pressing Get started button should invoke the |HandleGetStarted| call.
EXPECT_EQ(1u, fake_onboarding_ui_tracker()->handle_get_started_call_count());
}
TEST_F(OnboardingViewTest, PressDismissButton) {
fake_onboarding_ui_tracker()->SetShouldShowOnboardingUi(true);
// Simulates a mouse press on the Dismiss button.
onboarding_view()->ButtonPressed(
dismiss_button(), ui::MouseEvent(ui::ET_MOUSE_PRESSED, gfx::PointF(),
gfx::PointF(), base::TimeTicks(), 0, 0));
// Pressing Dismiss button should disable the ability to show onboarding UI
// again.
EXPECT_FALSE(fake_onboarding_ui_tracker()->ShouldShowOnboardingUi());
}
} // namespace ash
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define ASH_SYSTEM_PHONEHUB_PHONE_CONNECTED_VIEW_H_ #define ASH_SYSTEM_PHONEHUB_PHONE_CONNECTED_VIEW_H_
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/system/phonehub/phone_hub_content_view.h"
#include "ui/views/view.h" #include "ui/views/view.h"
namespace chromeos { namespace chromeos {
...@@ -20,7 +21,7 @@ class TrayBubbleView; ...@@ -20,7 +21,7 @@ class TrayBubbleView;
// A view of the Phone Hub panel, displaying phone status and utility actions // A view of the Phone Hub panel, displaying phone status and utility actions
// such as phone status, task continuation, etc. // such as phone status, task continuation, etc.
class PhoneConnectedView : public views::View { class PhoneConnectedView : public PhoneHubContentView {
public: public:
PhoneConnectedView(TrayBubbleView* bubble_view, PhoneConnectedView(TrayBubbleView* bubble_view,
chromeos::phonehub::PhoneHubManager* phone_hub_manager); chromeos::phonehub::PhoneHubManager* phone_hub_manager);
......
// 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/system/phonehub/phone_hub_content_view.h"
namespace ash {
PhoneHubContentView::PhoneHubContentView() = default;
PhoneHubContentView::~PhoneHubContentView() = default;
void PhoneHubContentView::OnBubbleClose() {
// Nothing to do.
}
} // 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_SYSTEM_PHONEHUB_PHONE_HUB_CONTENT_VIEW_H_
#define ASH_SYSTEM_PHONEHUB_PHONE_HUB_CONTENT_VIEW_H_
#include "ash/ash_export.h"
#include "ui/views/view.h"
namespace ash {
// A base class for Phone Hub content views.
class ASH_EXPORT PhoneHubContentView : public views::View {
public:
~PhoneHubContentView() override;
// Called upon bubble closing, subclasses can install their own handlers here
// if needed for when the the bubble is dismissed.
virtual void OnBubbleClose();
protected:
PhoneHubContentView();
};
} // namespace ash
#endif // ASH_SYSTEM_PHONEHUB_PHONE_HUB_CONTENT_VIEW_H_
...@@ -68,6 +68,7 @@ void PhoneHubInterstitialView::SetImage(const gfx::ImageSkia& image) { ...@@ -68,6 +68,7 @@ void PhoneHubInterstitialView::SetImage(const gfx::ImageSkia& image) {
// Expect a non-empty string for the title. // Expect a non-empty string for the title.
DCHECK(!image.isNull()); DCHECK(!image.isNull());
image_->SetImage(image); image_->SetImage(image);
image_->SetImageSize(gfx::Size(kImageWidthDip, kImageHeightDip));
} }
void PhoneHubInterstitialView::SetTitle(const base::string16& title) { void PhoneHubInterstitialView::SetTitle(const base::string16& title) {
...@@ -119,7 +120,6 @@ void PhoneHubInterstitialView::InitLayout(bool show_progress) { ...@@ -119,7 +120,6 @@ void PhoneHubInterstitialView::InitLayout(bool show_progress) {
// Set up layout row for the image view. // Set up layout row for the image view.
layout->StartRow(views::GridLayout::kFixedSize, kSecondColumnSetId); layout->StartRow(views::GridLayout::kFixedSize, kSecondColumnSetId);
image_ = layout->AddView(std::make_unique<views::ImageView>()); image_ = layout->AddView(std::make_unique<views::ImageView>());
image_->SetImageSize(gfx::Size(kImageWidthDip, kImageHeightDip));
// Set up layout row for the title view, which should be left-aligned. // Set up layout row for the title view, which should be left-aligned.
layout->StartRow(views::GridLayout::kFixedSize, kSecondColumnSetId); layout->StartRow(views::GridLayout::kFixedSize, kSecondColumnSetId);
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <vector> #include <vector>
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/system/phonehub/phone_hub_content_view.h"
#include "ui/views/controls/progress_bar.h" #include "ui/views/controls/progress_bar.h"
#include "ui/views/metadata/metadata_header_macros.h" #include "ui/views/metadata/metadata_header_macros.h"
#include "ui/views/view.h" #include "ui/views/view.h"
...@@ -25,7 +26,7 @@ namespace ash { ...@@ -25,7 +26,7 @@ namespace ash {
// A generic view to display interstitial pages for the Phone Hub feature with // A generic view to display interstitial pages for the Phone Hub feature with
// image, text and buttons in a customized layout. It is reused by the // image, text and buttons in a customized layout. It is reused by the
// onboarding, loading, disconnected/reconnecting and error state UI. // onboarding, loading, disconnected/reconnecting and error state UI.
class ASH_EXPORT PhoneHubInterstitialView : public views::View { class ASH_EXPORT PhoneHubInterstitialView : public PhoneHubContentView {
public: public:
METADATA_HEADER(PhoneHubInterstitialView); METADATA_HEADER(PhoneHubInterstitialView);
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h" #include "ash/strings/grit/ash_strings.h"
#include "ash/style/ash_color_provider.h" #include "ash/style/ash_color_provider.h"
#include "ash/system/phonehub/phone_hub_content_view.h"
#include "ash/system/phonehub/phone_status_view.h" #include "ash/system/phonehub/phone_status_view.h"
#include "ash/system/phonehub/quick_actions_view.h" #include "ash/system/phonehub/quick_actions_view.h"
#include "ash/system/phonehub/task_continuation_view.h" #include "ash/system/phonehub/task_continuation_view.h"
...@@ -109,7 +110,7 @@ void PhoneHubTray::OnPhoneHubUiStateChanged() { ...@@ -109,7 +110,7 @@ void PhoneHubTray::OnPhoneHubUiStateChanged() {
TrayBubbleView* bubble_view = bubble_->bubble_view(); TrayBubbleView* bubble_view = bubble_->bubble_view();
DCHECK(ui_controller_.get()); DCHECK(ui_controller_.get());
std::unique_ptr<views::View> content_view = std::unique_ptr<PhoneHubContentView> content_view =
ui_controller_->CreateContentView(bubble_view); ui_controller_->CreateContentView(bubble_view);
if (!content_view.get()) { if (!content_view.get()) {
CloseBubble(); CloseBubble();
...@@ -207,6 +208,8 @@ const char* PhoneHubTray::GetClassName() const { ...@@ -207,6 +208,8 @@ const char* PhoneHubTray::GetClassName() const {
} }
void PhoneHubTray::CloseBubble() { void PhoneHubTray::CloseBubble() {
if (content_view_)
content_view_->OnBubbleClose();
content_view_ = nullptr; content_view_ = nullptr;
bubble_.reset(); bubble_.reset();
SetIsActive(false); SetIsActive(false);
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define ASH_SYSTEM_PHONEHUB_PHONE_HUB_TRAY_H_ #define ASH_SYSTEM_PHONEHUB_PHONE_HUB_TRAY_H_
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/system/phonehub/phone_hub_content_view.h"
#include "ash/system/phonehub/phone_hub_ui_controller.h" #include "ash/system/phonehub/phone_hub_ui_controller.h"
#include "ash/system/tray/tray_background_view.h" #include "ash/system/tray/tray_background_view.h"
#include "base/scoped_observer.h" #include "base/scoped_observer.h"
...@@ -22,6 +23,7 @@ class ImageView; ...@@ -22,6 +23,7 @@ class ImageView;
namespace ash { namespace ash {
class PhoneHubContentView;
class TrayBubbleWrapper; class TrayBubbleWrapper;
// This class represents the Phone Hub tray button in the status area and // This class represents the Phone Hub tray button in the status area and
...@@ -53,6 +55,10 @@ class ASH_EXPORT PhoneHubTray : public TrayBackgroundView, ...@@ -53,6 +55,10 @@ class ASH_EXPORT PhoneHubTray : public TrayBackgroundView,
views::View* content_view_for_testing() { return content_view_; } views::View* content_view_for_testing() { return content_view_; }
PhoneHubUiController* ui_controller_for_testing() {
return ui_controller_.get();
}
private: private:
// TrayBubbleView::Delegate: // TrayBubbleView::Delegate:
base::string16 GetAccessibleNameForBubble() override; base::string16 GetAccessibleNameForBubble() override;
...@@ -78,7 +84,7 @@ class ASH_EXPORT PhoneHubTray : public TrayBackgroundView, ...@@ -78,7 +84,7 @@ class ASH_EXPORT PhoneHubTray : public TrayBackgroundView,
// The main content view of the bubble, which changes depending on the state. // The main content view of the bubble, which changes depending on the state.
// Unowned. // Unowned.
views::View* content_view_ = nullptr; PhoneHubContentView* content_view_ = nullptr;
ScopedObserver<PhoneHubUiController, PhoneHubUiController::Observer> ScopedObserver<PhoneHubUiController, PhoneHubUiController::Observer>
observed_phone_hub_ui_controller_{this}; observed_phone_hub_ui_controller_{this};
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "ash/public/cpp/test/test_new_window_delegate.h" #include "ash/public/cpp/test/test_new_window_delegate.h"
#include "ash/system/phonehub/notification_opt_in_view.h" #include "ash/system/phonehub/notification_opt_in_view.h"
#include "ash/system/phonehub/phone_hub_ui_controller.h"
#include "ash/system/phonehub/phone_hub_view_ids.h" #include "ash/system/phonehub/phone_hub_view_ids.h"
#include "ash/system/status_area_widget.h" #include "ash/system/status_area_widget.h"
#include "ash/system/status_area_widget_test_helper.h" #include "ash/system/status_area_widget_test_helper.h"
...@@ -65,6 +66,10 @@ class PhoneHubTrayTest : public AshTestBase { ...@@ -65,6 +66,10 @@ class PhoneHubTrayTest : public AshTestBase {
return phone_hub_manager_.fake_connection_scheduler(); return phone_hub_manager_.fake_connection_scheduler();
} }
chromeos::phonehub::FakeOnboardingUiTracker* GetOnboardingUiTracker() {
return phone_hub_manager_.fake_onboarding_ui_tracker();
}
// Simulate a mouse click on the given view. // Simulate a mouse click on the given view.
// Waits for the event to be processed. // Waits for the event to be processed.
void ClickOnAndWait(const views::View* view) { void ClickOnAndWait(const views::View* view) {
...@@ -107,6 +112,36 @@ class PhoneHubTrayTest : public AshTestBase { ...@@ -107,6 +112,36 @@ class PhoneHubTrayTest : public AshTestBase {
PhoneHubViewID::kDisconnectedLearnMoreButton)); PhoneHubViewID::kDisconnectedLearnMoreButton));
} }
views::View* onboarding_main_view() {
return static_cast<views::View*>(
phone_hub_tray_->GetBubbleView()->GetViewByID(
PhoneHubViewID::kOnboardingMainView));
}
views::View* onboarding_dismiss_prompt_view() {
return static_cast<views::View*>(
phone_hub_tray_->GetBubbleView()->GetViewByID(
PhoneHubViewID::kOnboardingDismissPromptView));
}
views::Button* onboarding_get_started_button() {
return static_cast<views::Button*>(
phone_hub_tray_->GetBubbleView()->GetViewByID(
PhoneHubViewID::kOnboardingGetStartedButton));
}
views::Button* onboarding_dismiss_button() {
return static_cast<views::Button*>(
phone_hub_tray_->GetBubbleView()->GetViewByID(
PhoneHubViewID::kOnboardingDismissButton));
}
views::Button* onboarding_dismiss_ack_button() {
return static_cast<views::Button*>(
phone_hub_tray_->GetBubbleView()->GetViewByID(
PhoneHubViewID::kOnboardingDismissAckButton));
}
protected: protected:
PhoneHubTray* phone_hub_tray_ = nullptr; PhoneHubTray* phone_hub_tray_ = nullptr;
chromeos::phonehub::FakePhoneHubManager phone_hub_manager_; chromeos::phonehub::FakePhoneHubManager phone_hub_manager_;
...@@ -228,6 +263,84 @@ TEST_F(PhoneHubTrayTest, TransitionContentView) { ...@@ -228,6 +263,84 @@ TEST_F(PhoneHubTrayTest, TransitionContentView) {
EXPECT_EQ(PhoneHubViewID::kDisconnectedView, content_view()->GetID()); EXPECT_EQ(PhoneHubViewID::kDisconnectedView, content_view()->GetID());
} }
TEST_F(PhoneHubTrayTest, StartOnboardingFlow) {
// Simulate a pending setup state to show the onboarding screen.
GetFeatureStatusProvider()->SetStatus(
chromeos::phonehub::FeatureStatus::kEligiblePhoneButNotSetUp);
GetOnboardingUiTracker()->SetShouldShowOnboardingUi(true);
ClickTrayButton();
EXPECT_TRUE(phone_hub_tray_->is_active());
EXPECT_EQ(PhoneHubViewID::kOnboardingView, content_view()->GetID());
// It should display the onboarding main view.
EXPECT_TRUE(onboarding_main_view());
EXPECT_TRUE(onboarding_main_view()->GetVisible());
EXPECT_EQ(0u, GetOnboardingUiTracker()->handle_get_started_call_count());
// Simulate a click on the "Get started" button.
ClickOnAndWait(onboarding_get_started_button());
// It should invoke the |HandleGetStarted| call.
EXPECT_EQ(1u, GetOnboardingUiTracker()->handle_get_started_call_count());
}
TEST_F(PhoneHubTrayTest, DismissOnboardingFlowByClickingAckButton) {
// Simulate a pending setup state to show the onboarding screen.
GetFeatureStatusProvider()->SetStatus(
chromeos::phonehub::FeatureStatus::kEligiblePhoneButNotSetUp);
GetOnboardingUiTracker()->SetShouldShowOnboardingUi(true);
ClickTrayButton();
EXPECT_TRUE(phone_hub_tray_->is_active());
EXPECT_EQ(PhoneHubViewID::kOnboardingView, content_view()->GetID());
// It should display the onboarding main view at first.
EXPECT_TRUE(onboarding_main_view());
// Simulate a click on the "Dismiss" button.
ClickOnAndWait(onboarding_dismiss_button());
// It should transit to show the dismiss prompt.
EXPECT_TRUE(onboarding_dismiss_prompt_view());
EXPECT_TRUE(onboarding_dismiss_prompt_view()->GetVisible());
// Simulate a click on the "OK, got it" button to ack.
ClickOnAndWait(onboarding_dismiss_ack_button());
// Clicking "Ok, got it" button should dismiss the bubble, hide the tray icon,
// and disable the ability to show onboarding UI again.
EXPECT_FALSE(phone_hub_tray_->GetBubbleView());
EXPECT_FALSE(phone_hub_tray_->GetVisible());
EXPECT_FALSE(GetOnboardingUiTracker()->ShouldShowOnboardingUi());
}
TEST_F(PhoneHubTrayTest, DismissOnboardingFlowByClickingOutside) {
// Simulate a pending setup state to show the onboarding screen.
GetFeatureStatusProvider()->SetStatus(
chromeos::phonehub::FeatureStatus::kEligiblePhoneButNotSetUp);
GetOnboardingUiTracker()->SetShouldShowOnboardingUi(true);
ClickTrayButton();
EXPECT_TRUE(phone_hub_tray_->is_active());
EXPECT_EQ(PhoneHubViewID::kOnboardingView, content_view()->GetID());
// It should display the onboarding main view at first.
EXPECT_TRUE(onboarding_main_view());
// Simulate a click on the "Dismiss" button.
ClickOnAndWait(onboarding_dismiss_button());
// It should transit to show the dismiss prompt.
EXPECT_TRUE(onboarding_dismiss_prompt_view());
EXPECT_TRUE(onboarding_dismiss_prompt_view()->GetVisible());
// Simulate a click outside the bubble.
phone_hub_tray_->ClickedOutsideBubble();
// Clicking outside should dismiss the bubble, hide the tray icon, and disable
// the ability to show onboarding UI again.
EXPECT_FALSE(phone_hub_tray_->GetBubbleView());
EXPECT_FALSE(phone_hub_tray_->GetVisible());
EXPECT_FALSE(GetOnboardingUiTracker()->ShouldShowOnboardingUi());
}
TEST_F(PhoneHubTrayTest, ClickButtonsOnDisconnectedView) { TEST_F(PhoneHubTrayTest, ClickButtonsOnDisconnectedView) {
// Simulates a phone disconnected error state to show the disconnected view. // Simulates a phone disconnected error state to show the disconnected view.
GetFeatureStatusProvider()->SetStatus( GetFeatureStatusProvider()->SetStatus(
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "ash/system/phonehub/initial_connecting_view.h" #include "ash/system/phonehub/initial_connecting_view.h"
#include "ash/system/phonehub/onboarding_view.h" #include "ash/system/phonehub/onboarding_view.h"
#include "ash/system/phonehub/phone_connected_view.h" #include "ash/system/phonehub/phone_connected_view.h"
#include "ash/system/phonehub/phone_hub_content_view.h"
#include "ash/system/phonehub/phone_status_view.h" #include "ash/system/phonehub/phone_status_view.h"
#include "base/logging.h" #include "base/logging.h"
#include "chromeos/components/phonehub/phone_hub_manager.h" #include "chromeos/components/phonehub/phone_hub_manager.h"
...@@ -38,7 +39,7 @@ void PhoneHubUiController::SetPhoneHubManager( ...@@ -38,7 +39,7 @@ void PhoneHubUiController::SetPhoneHubManager(
phone_hub_manager_->GetOnboardingUiTracker()->AddObserver(this); phone_hub_manager_->GetOnboardingUiTracker()->AddObserver(this);
} }
UpdateUiState(); UpdateUiState(GetUiStateFromPhoneHubManager());
} }
std::unique_ptr<views::View> PhoneHubUiController::CreateStatusHeaderView() { std::unique_ptr<views::View> PhoneHubUiController::CreateStatusHeaderView() {
...@@ -47,7 +48,7 @@ std::unique_ptr<views::View> PhoneHubUiController::CreateStatusHeaderView() { ...@@ -47,7 +48,7 @@ std::unique_ptr<views::View> PhoneHubUiController::CreateStatusHeaderView() {
return std::make_unique<PhoneStatusView>(phone_hub_manager_->GetPhoneModel()); return std::make_unique<PhoneStatusView>(phone_hub_manager_->GetPhoneModel());
} }
std::unique_ptr<views::View> PhoneHubUiController::CreateContentView( std::unique_ptr<PhoneHubContentView> PhoneHubUiController::CreateContentView(
TrayBubbleView* bubble_view) { TrayBubbleView* bubble_view) {
switch (ui_state_) { switch (ui_state_) {
case UiState::kHidden: case UiState::kHidden:
...@@ -55,7 +56,7 @@ std::unique_ptr<views::View> PhoneHubUiController::CreateContentView( ...@@ -55,7 +56,7 @@ std::unique_ptr<views::View> PhoneHubUiController::CreateContentView(
case UiState::kOnboardingWithoutPhone: case UiState::kOnboardingWithoutPhone:
case UiState::kOnboardingWithPhone: case UiState::kOnboardingWithPhone:
return std::make_unique<OnboardingView>( return std::make_unique<OnboardingView>(
phone_hub_manager_->GetOnboardingUiTracker()); phone_hub_manager_->GetOnboardingUiTracker(), bubble_view);
case UiState::kBluetoothDisabled: case UiState::kBluetoothDisabled:
return std::make_unique<BluetoothDisabledView>(); return std::make_unique<BluetoothDisabledView>();
case UiState::kInitialConnecting: case UiState::kInitialConnecting:
...@@ -83,15 +84,15 @@ void PhoneHubUiController::RemoveObserver(Observer* observer) { ...@@ -83,15 +84,15 @@ void PhoneHubUiController::RemoveObserver(Observer* observer) {
} }
void PhoneHubUiController::OnFeatureStatusChanged() { void PhoneHubUiController::OnFeatureStatusChanged() {
UpdateUiState(); UpdateUiState(GetUiStateFromPhoneHubManager());
} }
void PhoneHubUiController::OnShouldShowOnboardingUiChanged() { void PhoneHubUiController::OnShouldShowOnboardingUiChanged() {
UpdateUiState(); UpdateUiState(GetUiStateFromPhoneHubManager());
} }
void PhoneHubUiController::UpdateUiState() { void PhoneHubUiController::UpdateUiState(
auto new_state = GetUiStateFromPhoneHubManager(); PhoneHubUiController::UiState new_state) {
if (new_state == ui_state_) if (new_state == ui_state_)
return; return;
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define ASH_SYSTEM_PHONEHUB_PHONE_HUB_UI_CONTROLLER_H_ #define ASH_SYSTEM_PHONEHUB_PHONE_HUB_UI_CONTROLLER_H_
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/system/phonehub/phone_hub_content_view.h"
#include "base/observer_list.h" #include "base/observer_list.h"
#include "base/observer_list_types.h" #include "base/observer_list_types.h"
#include "chromeos/components/phonehub/feature_status_provider.h" #include "chromeos/components/phonehub/feature_status_provider.h"
...@@ -62,7 +63,8 @@ class ASH_EXPORT PhoneHubUiController ...@@ -62,7 +63,8 @@ class ASH_EXPORT PhoneHubUiController
// Creates the corresponding content view for the current UI state. // Creates the corresponding content view for the current UI state.
// |bubble_view| will be the parent the created content view. // |bubble_view| will be the parent the created content view.
std::unique_ptr<views::View> CreateContentView(TrayBubbleView* bubble_view); std::unique_ptr<PhoneHubContentView> CreateContentView(
TrayBubbleView* bubble_view);
// Creates the header view displaying the phone status. // Creates the header view displaying the phone status.
std::unique_ptr<views::View> CreateStatusHeaderView(); std::unique_ptr<views::View> CreateStatusHeaderView();
...@@ -81,7 +83,7 @@ class ASH_EXPORT PhoneHubUiController ...@@ -81,7 +83,7 @@ class ASH_EXPORT PhoneHubUiController
void OnShouldShowOnboardingUiChanged() override; void OnShouldShowOnboardingUiChanged() override;
// Updates the current UI state and notifies observers. // Updates the current UI state and notifies observers.
void UpdateUiState(); void UpdateUiState(PhoneHubUiController::UiState new_state);
// Returns the UiState from the PhoneHubManager. // Returns the UiState from the PhoneHubManager.
UiState GetUiStateFromPhoneHubManager(); UiState GetUiStateFromPhoneHubManager();
......
...@@ -20,8 +20,11 @@ enum PhoneHubViewID { ...@@ -20,8 +20,11 @@ enum PhoneHubViewID {
// Onboarding view and its components. // Onboarding view and its components.
kOnboardingView, kOnboardingView,
kOnboardingMainView,
kOnboardingGetStartedButton, kOnboardingGetStartedButton,
kOnboardingDismissButton, kOnboardingDismissButton,
kOnboardingDismissPromptView,
kOnboardingDismissAckButton,
// Connection error view and its components. // Connection error view and its components.
kDisconnectedView, kDisconnectedView,
......
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