Commit 7ee83e45 authored by Abigail Klein's avatar Abigail Klein Committed by Commit Bot

[Live Caption] Introduce a promo for Live Caption feature.

The live caption feature will have a promo underneath of the global
media controls in order to inform users of this feature and help them
find where to enable it.

Bug: 1055150
Change-Id: I00fb0a4a4dfaeba507aac7b3a3d00a93577a731e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2406537
Commit-Queue: Abigail Klein <abigailbklein@google.com>
Reviewed-by: default avatarYaron Friedman <yfriedman@chromium.org>
Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808156}
parent 0644be77
...@@ -5906,6 +5906,12 @@ the Bookmarks menu."> ...@@ -5906,6 +5906,12 @@ the Bookmarks menu.">
<message name="IDS_INCOGNITOWINDOW_PROMO_3" desc="Variations option 4. Text shown on promotional UI appearing next to the App Menu button, which encourages users to use it."> <message name="IDS_INCOGNITOWINDOW_PROMO_3" desc="Variations option 4. Text shown on promotional UI appearing next to the App Menu button, which encourages users to use it.">
To browse privately, click the dots icon menu to open an incognito window To browse privately, click the dots icon menu to open an incognito window
</message> </message>
<message name="IDS_LIVE_CAPTION_PROMO" desc="Text shown on promotional UI appearing next to the global media controls button">
Get captions for your media
</message>
<message name="IDS_LIVE_CAPTION_PROMO_SCREENREADER" desc="Text announced encouraging users to open live caption">
Get captions for your media by enabling Live Caption in settings
</message>
<message name="IDS_NEWTAB_PROMO_0" desc="Variations option 1. Text shown on promotional UI appearing next to the New Tab button, which encourages users to use it."> <message name="IDS_NEWTAB_PROMO_0" desc="Variations option 1. Text shown on promotional UI appearing next to the New Tab button, which encourages users to use it.">
Open a new tab with one click Open a new tab with one click
</message> </message>
......
7a566f94e78d5c397925c5ef4094678799afde22
\ No newline at end of file
7a566f94e78d5c397925c5ef4094678799afde22
\ No newline at end of file
...@@ -1024,6 +1024,10 @@ static_library("ui") { ...@@ -1024,6 +1024,10 @@ static_library("ui") {
"in_product_help/global_media_controls_in_product_help_factory.cc", "in_product_help/global_media_controls_in_product_help_factory.cc",
"in_product_help/global_media_controls_in_product_help_factory.h", "in_product_help/global_media_controls_in_product_help_factory.h",
"in_product_help/in_product_help.h", "in_product_help/in_product_help.h",
"in_product_help/live_caption_in_product_help.cc",
"in_product_help/live_caption_in_product_help.h",
"in_product_help/live_caption_in_product_help_factory.cc",
"in_product_help/live_caption_in_product_help_factory.h",
"in_product_help/reopen_tab_in_product_help.cc", "in_product_help/reopen_tab_in_product_help.cc",
"in_product_help/reopen_tab_in_product_help.h", "in_product_help/reopen_tab_in_product_help.h",
"in_product_help/reopen_tab_in_product_help_factory.cc", "in_product_help/reopen_tab_in_product_help_factory.cc",
...@@ -3570,6 +3574,8 @@ static_library("ui") { ...@@ -3570,6 +3574,8 @@ static_library("ui") {
"views/in_product_help/feature_promo_registry.h", "views/in_product_help/feature_promo_registry.h",
"views/in_product_help/global_media_controls_promo_controller.cc", "views/in_product_help/global_media_controls_promo_controller.cc",
"views/in_product_help/global_media_controls_promo_controller.h", "views/in_product_help/global_media_controls_promo_controller.h",
"views/in_product_help/live_caption_promo_controller.cc",
"views/in_product_help/live_caption_promo_controller.h",
"views/in_product_help/reopen_tab_promo_controller.cc", "views/in_product_help/reopen_tab_promo_controller.cc",
"views/in_product_help/reopen_tab_promo_controller.h", "views/in_product_help/reopen_tab_promo_controller.h",
"views/infobars/alternate_nav_infobar_view.cc", "views/infobars/alternate_nav_infobar_view.cc",
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
enum class InProductHelpFeature { enum class InProductHelpFeature {
kGlobalMediaControls, kGlobalMediaControls,
kIncognitoWindow, kIncognitoWindow,
kLiveCaption,
kReopenTab, kReopenTab,
}; };
......
// 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 "chrome/browser/ui/in_product_help/live_caption_in_product_help.h"
#include "base/feature_list.h"
#include "chrome/browser/feature_engagement/tracker_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "components/feature_engagement/public/feature_constants.h"
#include "components/feature_engagement/public/tracker.h"
#include "media/base/media_switches.h"
LiveCaptionInProductHelp::LiveCaptionInProductHelp(Profile* profile)
: profile_(profile) {}
LiveCaptionInProductHelp::~LiveCaptionInProductHelp() = default;
void LiveCaptionInProductHelp::OnMediaButtonEnabled() {
Browser* browser = BrowserList::GetInstance()->GetLastActive();
if (!browser || browser->profile() != profile_)
return;
if (GetTracker()->ShouldTriggerHelpUI(
feature_engagement::kIPHLiveCaptionFeature)) {
browser->window()->ShowInProductHelpPromo(
InProductHelpFeature::kLiveCaption);
}
}
void LiveCaptionInProductHelp::HelpDismissed() {
GetTracker()->Dismissed(feature_engagement::kIPHLiveCaptionFeature);
}
feature_engagement::Tracker* LiveCaptionInProductHelp::GetTracker() {
return feature_engagement::TrackerFactory::GetForBrowserContext(profile_);
}
// 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 CHROME_BROWSER_UI_IN_PRODUCT_HELP_LIVE_CAPTION_IN_PRODUCT_HELP_H_
#define CHROME_BROWSER_UI_IN_PRODUCT_HELP_LIVE_CAPTION_IN_PRODUCT_HELP_H_
#include "chrome/browser/ui/global_media_controls/media_toolbar_button_observer.h"
#include "components/keyed_service/core/keyed_service.h"
class Profile;
namespace feature_engagement {
class Tracker;
}
// Listens for the triggering conditions for the global media controls
// in-product help and starts the IPH flow at the appropriate time. This is a
// |Profile|-keyed service since we track interactions per user profile. Hooks
// throughout the browser UI code will fetch this service and notify it of
// interesting user actions.
class LiveCaptionInProductHelp : public KeyedService,
public MediaToolbarButtonObserver {
public:
explicit LiveCaptionInProductHelp(Profile* profile);
~LiveCaptionInProductHelp() override;
LiveCaptionInProductHelp(const LiveCaptionInProductHelp&) = delete;
LiveCaptionInProductHelp& operator=(const LiveCaptionInProductHelp&) = delete;
// MediaToolbarButtonObserver:
void OnMediaDialogOpened() override {}
void OnMediaButtonShown() override {}
void OnMediaButtonHidden() override {}
void OnMediaButtonEnabled() override;
void OnMediaButtonDisabled() override {}
// Must be called when IPH promo finishes showing, whether by use of the
// feature or by timing out.
void HelpDismissed();
private:
feature_engagement::Tracker* GetTracker();
Profile* const profile_;
};
#endif // CHROME_BROWSER_UI_IN_PRODUCT_HELP_LIVE_CAPTION_IN_PRODUCT_HELP_H_
// 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 "chrome/browser/ui/in_product_help/live_caption_in_product_help_factory.h"
#include "chrome/browser/feature_engagement/tracker_factory.h"
#include "chrome/browser/profiles/incognito_helpers.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/in_product_help/live_caption_in_product_help.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
// static
LiveCaptionInProductHelp* LiveCaptionInProductHelpFactory::GetForProfile(
Profile* profile) {
return static_cast<LiveCaptionInProductHelp*>(
GetInstance()->GetServiceForBrowserContext(profile, true));
}
// static
LiveCaptionInProductHelpFactory*
LiveCaptionInProductHelpFactory::GetInstance() {
static base::NoDestructor<LiveCaptionInProductHelpFactory> factory;
return factory.get();
}
LiveCaptionInProductHelpFactory::LiveCaptionInProductHelpFactory()
: BrowserContextKeyedServiceFactory(
"LiveCaptionInProductHelp",
BrowserContextDependencyManager::GetInstance()) {
DependsOn(feature_engagement::TrackerFactory::GetInstance());
}
LiveCaptionInProductHelpFactory::~LiveCaptionInProductHelpFactory() = default;
content::BrowserContext*
LiveCaptionInProductHelpFactory::GetBrowserContextToUse(
content::BrowserContext* context) const {
return chrome::GetBrowserContextRedirectedInIncognito(context);
}
KeyedService* LiveCaptionInProductHelpFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const {
return new LiveCaptionInProductHelp(Profile::FromBrowserContext(context));
}
// 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 CHROME_BROWSER_UI_IN_PRODUCT_HELP_LIVE_CAPTION_IN_PRODUCT_HELP_FACTORY_H_
#define CHROME_BROWSER_UI_IN_PRODUCT_HELP_LIVE_CAPTION_IN_PRODUCT_HELP_FACTORY_H_
#include "base/no_destructor.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
class LiveCaptionInProductHelp;
class Profile;
class LiveCaptionInProductHelpFactory
: public BrowserContextKeyedServiceFactory {
public:
static LiveCaptionInProductHelp* GetForProfile(Profile* profile);
static LiveCaptionInProductHelpFactory* GetInstance();
private:
friend base::NoDestructor<LiveCaptionInProductHelpFactory>;
LiveCaptionInProductHelpFactory();
~LiveCaptionInProductHelpFactory() override;
// BrowserContextKeyedServiceFactory overrides:
content::BrowserContext* GetBrowserContextToUse(
content::BrowserContext* context) const override;
KeyedService* BuildServiceInstanceFor(
content::BrowserContext* profile) const override;
};
#endif // CHROME_BROWSER_UI_IN_PRODUCT_HELP_LIVE_CAPTION_IN_PRODUCT_HELP_FACTORY_H_
// 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 "chrome/browser/ui/in_product_help/live_caption_in_product_help.h"
#include "base/bind.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/feature_engagement/tracker_factory.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/test/base/browser_with_test_window_test.h"
#include "chrome/test/base/testing_profile.h"
#include "components/feature_engagement/public/feature_constants.h"
#include "components/feature_engagement/public/tracker.h"
#include "components/feature_engagement/test/mock_tracker.h"
#include "media/base/media_switches.h"
using ::testing::_;
using ::testing::Return;
using MockTracker = ::testing::NiceMock<feature_engagement::test::MockTracker>;
class LiveCaptionInProductHelpTest : public BrowserWithTestWindowTest {
protected:
void SetUp() override {
BrowserWithTestWindowTest::SetUp();
scoped_feature_list_.InitWithFeatures(
{media::kLiveCaption, feature_engagement::kIPHLiveCaptionFeature}, {});
}
TestingProfile::TestingFactories GetTestingFactories() override {
return {{feature_engagement::TrackerFactory::GetInstance(),
base::BindRepeating(CreateTracker)}};
}
MockTracker* GetMockTracker() {
return static_cast<MockTracker*>(
feature_engagement::TrackerFactory::GetForBrowserContext(profile()));
}
private:
static std::unique_ptr<KeyedService> CreateTracker(
content::BrowserContext* context) {
return std::make_unique<MockTracker>();
}
base::test::ScopedFeatureList scoped_feature_list_;
};
TEST_F(LiveCaptionInProductHelpTest, TriggersAndDismissesIPH) {
LiveCaptionInProductHelp live_caption_iph(profile());
auto* mock_tracker = GetMockTracker();
EXPECT_CALL(*mock_tracker, ShouldTriggerHelpUI(_))
.Times(1)
.WillOnce(Return(true));
EXPECT_CALL(*mock_tracker, Dismissed(_)).Times(1);
BrowserList::SetLastActive(browser());
live_caption_iph.OnMediaButtonEnabled();
live_caption_iph.HelpDismissed();
}
...@@ -3437,6 +3437,9 @@ void BrowserView::ShowInProductHelpPromo(InProductHelpFeature iph_feature) { ...@@ -3437,6 +3437,9 @@ void BrowserView::ShowInProductHelpPromo(InProductHelpFeature iph_feature) {
if (toolbar_ && toolbar_->media_button()) if (toolbar_ && toolbar_->media_button())
toolbar_->media_button()->ShowPromo(); toolbar_->media_button()->ShowPromo();
break; break;
case InProductHelpFeature::kLiveCaption:
live_caption_promo_controller_.ShowPromo();
break;
} }
} }
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "chrome/browser/ui/views/frame/immersive_mode_controller.h" #include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
#include "chrome/browser/ui/views/frame/top_controls_slide_controller.h" #include "chrome/browser/ui/views/frame/top_controls_slide_controller.h"
#include "chrome/browser/ui/views/frame/web_contents_close_handler.h" #include "chrome/browser/ui/views/frame/web_contents_close_handler.h"
#include "chrome/browser/ui/views/in_product_help/live_caption_promo_controller.h"
#include "chrome/browser/ui/views/in_product_help/reopen_tab_promo_controller.h" #include "chrome/browser/ui/views/in_product_help/reopen_tab_promo_controller.h"
#include "chrome/browser/ui/views/intent_picker_bubble_view.h" #include "chrome/browser/ui/views/intent_picker_bubble_view.h"
#include "chrome/browser/ui/views/load_complete_listener.h" #include "chrome/browser/ui/views/load_complete_listener.h"
...@@ -921,6 +922,8 @@ class BrowserView : public BrowserWindow, ...@@ -921,6 +922,8 @@ class BrowserView : public BrowserWindow,
ReopenTabPromoController reopen_tab_promo_controller_{this}; ReopenTabPromoController reopen_tab_promo_controller_{this};
LiveCaptionPromoController live_caption_promo_controller_{this};
ScopedObserver<banners::AppBannerManager, banners::AppBannerManager::Observer> ScopedObserver<banners::AppBannerManager, banners::AppBannerManager::Observer>
app_banner_manager_observer_{this}; app_banner_manager_observer_{this};
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
#include "chrome/browser/ui/global_media_controls/media_toolbar_button_controller.h" #include "chrome/browser/ui/global_media_controls/media_toolbar_button_controller.h"
#include "chrome/browser/ui/in_product_help/global_media_controls_in_product_help.h" #include "chrome/browser/ui/in_product_help/global_media_controls_in_product_help.h"
#include "chrome/browser/ui/in_product_help/global_media_controls_in_product_help_factory.h" #include "chrome/browser/ui/in_product_help/global_media_controls_in_product_help_factory.h"
#include "chrome/browser/ui/in_product_help/live_caption_in_product_help.h"
#include "chrome/browser/ui/in_product_help/live_caption_in_product_help_factory.h"
#include "chrome/browser/ui/views/global_media_controls/media_dialog_view.h" #include "chrome/browser/ui/views/global_media_controls/media_dialog_view.h"
#include "chrome/browser/ui/views/in_product_help/global_media_controls_promo_controller.h" #include "chrome/browser/ui/views/in_product_help/global_media_controls_promo_controller.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
...@@ -31,11 +33,18 @@ MediaToolbarButtonView::MediaToolbarButtonView(const Browser* browser) ...@@ -31,11 +33,18 @@ MediaToolbarButtonView::MediaToolbarButtonView(const Browser* browser)
service_( service_(
MediaNotificationServiceFactory::GetForProfile(browser->profile())), MediaNotificationServiceFactory::GetForProfile(browser->profile())),
browser_(browser) { browser_(browser) {
GlobalMediaControlsInProductHelp* in_product_help = GlobalMediaControlsInProductHelp* global_media_controls_in_product_help =
GlobalMediaControlsInProductHelpFactory::GetForProfile( GlobalMediaControlsInProductHelpFactory::GetForProfile(
browser_->profile()); browser_->profile());
if (in_product_help) if (global_media_controls_in_product_help)
AddObserver(in_product_help); AddObserver(global_media_controls_in_product_help);
if (base::FeatureList::IsEnabled(media::kLiveCaption)) {
LiveCaptionInProductHelp* live_caption_in_product_help =
LiveCaptionInProductHelpFactory::GetForProfile(browser_->profile());
if (live_caption_in_product_help)
AddObserver(live_caption_in_product_help);
}
button_controller()->set_notify_action( button_controller()->set_notify_action(
views::ButtonController::NotifyAction::kOnPress); views::ButtonController::NotifyAction::kOnPress);
......
// 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 "chrome/browser/ui/views/in_product_help/live_caption_promo_controller.h"
#include "chrome/browser/ui/in_product_help/live_caption_in_product_help.h"
#include "chrome/browser/ui/in_product_help/live_caption_in_product_help_factory.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/global_media_controls/media_toolbar_button_view.h"
#include "chrome/browser/ui/views/in_product_help/feature_promo_bubble_params.h"
#include "chrome/browser/ui/views/in_product_help/feature_promo_bubble_view.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "chrome/grit/generated_resources.h"
LiveCaptionPromoController::LiveCaptionPromoController(
BrowserView* browser_view)
: browser_view_(browser_view) {}
LiveCaptionPromoController::~LiveCaptionPromoController() = default;
void LiveCaptionPromoController::ShowPromo() {
FeaturePromoBubbleParams bubble_params;
bubble_params.body_string_specifier = IDS_LIVE_CAPTION_PROMO;
bubble_params.screenreader_string_specifier =
IDS_LIVE_CAPTION_PROMO_SCREENREADER;
bubble_params.anchor_view = browser_view_->toolbar()->media_button();
bubble_params.arrow = views::BubbleBorder::Arrow::TOP_RIGHT;
promo_bubble_ = FeaturePromoBubbleView::Create(std::move(bubble_params));
promo_bubble_->set_close_on_deactivate(false);
widget_observer_.Add(promo_bubble_->GetWidget());
browser_view_->toolbar()->media_button()->AddObserver(this);
}
void LiveCaptionPromoController::PromoEnded() {
LiveCaptionInProductHelpFactory::GetForProfile(
browser_view_->browser()->profile())
->HelpDismissed();
}
void LiveCaptionPromoController::OnMediaDialogOpened() {
promo_bubble_->GetWidget()->CloseNow();
PromoEnded();
}
void LiveCaptionPromoController::OnMediaButtonDisabled() {
promo_bubble_->GetWidget()->CloseNow();
}
void LiveCaptionPromoController::OnWidgetDestroying(views::Widget* widget) {
DCHECK(promo_bubble_);
promo_bubble_ = nullptr;
browser_view_->toolbar()->media_button()->RemoveObserver(this);
widget_observer_.Remove(widget);
}
// 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 CHROME_BROWSER_UI_VIEWS_IN_PRODUCT_HELP_LIVE_CAPTION_PROMO_CONTROLLER_H_
#define CHROME_BROWSER_UI_VIEWS_IN_PRODUCT_HELP_LIVE_CAPTION_PROMO_CONTROLLER_H_
#include "base/scoped_observer.h"
#include "chrome/browser/ui/global_media_controls/media_toolbar_button_observer.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_observer.h"
class BrowserView;
class FeaturePromoBubbleView;
// Handles display of the live caption in-product help promo. Notifies the
// |LiveCaptionInProductHelp| service when the promo is finished.
class LiveCaptionPromoController : public MediaToolbarButtonObserver,
public views::WidgetObserver {
public:
explicit LiveCaptionPromoController(BrowserView* browser_view);
~LiveCaptionPromoController() override;
LiveCaptionPromoController(const LiveCaptionPromoController&) = delete;
LiveCaptionPromoController& operator=(const LiveCaptionPromoController&) =
delete;
// Shows the IPH promo. Should only be called once.
void ShowPromo();
private:
friend class LiveCaptionPromoControllerTest;
// MediaToolbarButtonObserver:
void OnMediaDialogOpened() override;
void OnMediaButtonShown() override {}
void OnMediaButtonHidden() override {}
void OnMediaButtonEnabled() override {}
void OnMediaButtonDisabled() override;
// views::WidgetObserver:
void OnWidgetDestroying(views::Widget* widget) override;
// Called when the promo flow ends.
void PromoEnded();
BrowserView* const browser_view_;
FeaturePromoBubbleView* promo_bubble_ = nullptr;
ScopedObserver<views::Widget, views::WidgetObserver> widget_observer_{this};
};
#endif // CHROME_BROWSER_UI_VIEWS_IN_PRODUCT_HELP_LIVE_CAPTION_PROMO_CONTROLLER_H_
// 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 "base/test/scoped_feature_list.h"
#include "chrome/browser/ui/views/global_media_controls/media_toolbar_button_view.h"
#include "chrome/browser/ui/views/in_product_help/feature_promo_bubble_view.h"
#include "chrome/browser/ui/views/in_product_help/live_caption_promo_controller.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/feature_engagement/public/feature_constants.h"
#include "content/public/test/browser_test.h"
#include "media/base/media_switches.h"
#include "ui/events/base_event_utils.h"
class LiveCaptionPromoControllerTest : public InProcessBrowserTest {
public:
LiveCaptionPromoControllerTest() = default;
~LiveCaptionPromoControllerTest() override = default;
LiveCaptionPromoControllerTest(const LiveCaptionPromoControllerTest&) =
delete;
LiveCaptionPromoControllerTest& operator=(
const LiveCaptionPromoControllerTest&) = delete;
// InProcessBrowserTest:
void SetUp() override {
scoped_feature_list_.InitWithFeatures(
{media::kGlobalMediaControls,
feature_engagement::kIPHLiveCaptionFeature},
{});
InProcessBrowserTest::SetUp();
}
bool PromoBubbleVisible() {
FeaturePromoBubbleView* bubble = GetPromoController()->promo_bubble_;
return bubble && bubble->GetVisible();
}
void ShowPromo() { GetPromoController()->ShowPromo(); }
void DisableMediaButton() { GetPromoController()->OnMediaButtonDisabled(); }
void OpenMediaDialog() { GetPromoController()->OnMediaDialogOpened(); }
private:
LiveCaptionPromoController* GetPromoController() {
if (!controller_) {
controller_ = std::make_unique<LiveCaptionPromoController>(
BrowserView::GetBrowserViewForBrowser(browser()));
}
return controller_.get();
}
base::test::ScopedFeatureList scoped_feature_list_;
std::unique_ptr<LiveCaptionPromoController> controller_;
};
IN_PROC_BROWSER_TEST_F(LiveCaptionPromoControllerTest, ShowPromo) {
EXPECT_FALSE(PromoBubbleVisible());
ShowPromo();
EXPECT_TRUE(PromoBubbleVisible());
}
IN_PROC_BROWSER_TEST_F(LiveCaptionPromoControllerTest, OpenMediaDialog) {
EXPECT_FALSE(PromoBubbleVisible());
ShowPromo();
EXPECT_TRUE(PromoBubbleVisible());
// Promo disappears when media dialog opens.
OpenMediaDialog();
EXPECT_FALSE(PromoBubbleVisible());
}
IN_PROC_BROWSER_TEST_F(LiveCaptionPromoControllerTest, DisableMediaButton) {
EXPECT_FALSE(PromoBubbleVisible());
ShowPromo();
EXPECT_TRUE(PromoBubbleVisible());
// Promo disappears when media button is disabled.
DisableMediaButton();
EXPECT_FALSE(PromoBubbleVisible());
}
...@@ -2131,6 +2131,7 @@ if (!is_android) { ...@@ -2131,6 +2131,7 @@ if (!is_android) {
"../browser/ui/views/importer/import_lock_dialog_view_browsertest.cc", "../browser/ui/views/importer/import_lock_dialog_view_browsertest.cc",
"../browser/ui/views/in_product_help/feature_promo_dialog_browsertest.cc", "../browser/ui/views/in_product_help/feature_promo_dialog_browsertest.cc",
"../browser/ui/views/in_product_help/global_media_controls_promo_controller_dialog_browsertest.cc", "../browser/ui/views/in_product_help/global_media_controls_promo_controller_dialog_browsertest.cc",
"../browser/ui/views/in_product_help/live_caption_promo_controller_browsertest.cc",
"../browser/ui/views/in_product_help/reopen_tab_promo_controller_dialog_browsertest.cc", "../browser/ui/views/in_product_help/reopen_tab_promo_controller_dialog_browsertest.cc",
"../browser/ui/views/location_bar/content_setting_bubble_dialog_browsertest.cc", "../browser/ui/views/location_bar/content_setting_bubble_dialog_browsertest.cc",
"../browser/ui/views/location_bar/custom_tab_bar_view_browsertest.cc", "../browser/ui/views/location_bar/custom_tab_bar_view_browsertest.cc",
...@@ -4426,6 +4427,7 @@ test("unit_tests") { ...@@ -4426,6 +4427,7 @@ test("unit_tests") {
"../browser/ui/hid/hid_chooser_controller_unittest.cc", "../browser/ui/hid/hid_chooser_controller_unittest.cc",
"../browser/ui/in_product_help/active_tab_tracker_unittest.cc", "../browser/ui/in_product_help/active_tab_tracker_unittest.cc",
"../browser/ui/in_product_help/global_media_controls_in_product_help_unittest.cc", "../browser/ui/in_product_help/global_media_controls_in_product_help_unittest.cc",
"../browser/ui/in_product_help/live_caption_in_product_help_unittest.cc",
"../browser/ui/in_product_help/reopen_tab_in_product_help_trigger_unittest.cc", "../browser/ui/in_product_help/reopen_tab_in_product_help_trigger_unittest.cc",
"../browser/ui/in_product_help/reopen_tab_in_product_help_unittest.cc", "../browser/ui/in_product_help/reopen_tab_in_product_help_unittest.cc",
"../browser/ui/manifest_web_app_browser_controller_unittest.cc", "../browser/ui/manifest_web_app_browser_controller_unittest.cc",
......
...@@ -20,6 +20,8 @@ const base::Feature kIPHFocusModeFeature{"IPH_FocusMode", ...@@ -20,6 +20,8 @@ const base::Feature kIPHFocusModeFeature{"IPH_FocusMode",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kIPHGlobalMediaControlsFeature{ const base::Feature kIPHGlobalMediaControlsFeature{
"IPH_GlobalMediaControls", base::FEATURE_DISABLED_BY_DEFAULT}; "IPH_GlobalMediaControls", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kIPHLiveCaptionFeature{"IPH_LiveCaption",
base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kIPHPasswordsAccountStorageFeature{ const base::Feature kIPHPasswordsAccountStorageFeature{
"IPH_PasswordsAccountStorage", base::FEATURE_DISABLED_BY_DEFAULT}; "IPH_PasswordsAccountStorage", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kIPHReopenTabFeature{"IPH_ReopenTab", const base::Feature kIPHReopenTabFeature{"IPH_ReopenTab",
......
...@@ -21,6 +21,7 @@ extern const base::Feature kIPHDummyFeature; ...@@ -21,6 +21,7 @@ extern const base::Feature kIPHDummyFeature;
extern const base::Feature kIPHDesktopTabGroupsNewGroupFeature; extern const base::Feature kIPHDesktopTabGroupsNewGroupFeature;
extern const base::Feature kIPHFocusModeFeature; extern const base::Feature kIPHFocusModeFeature;
extern const base::Feature kIPHGlobalMediaControlsFeature; extern const base::Feature kIPHGlobalMediaControlsFeature;
extern const base::Feature kIPHLiveCaptionFeature;
extern const base::Feature kIPHPasswordsAccountStorageFeature; extern const base::Feature kIPHPasswordsAccountStorageFeature;
extern const base::Feature kIPHReopenTabFeature; extern const base::Feature kIPHReopenTabFeature;
extern const base::Feature kIPHWebUITabStripFeature; extern const base::Feature kIPHWebUITabStripFeature;
......
...@@ -69,6 +69,7 @@ const base::Feature* const kAllFeatures[] = { ...@@ -69,6 +69,7 @@ const base::Feature* const kAllFeatures[] = {
&kIPHDesktopTabGroupsNewGroupFeature, &kIPHDesktopTabGroupsNewGroupFeature,
&kIPHFocusModeFeature, &kIPHFocusModeFeature,
&kIPHGlobalMediaControlsFeature, &kIPHGlobalMediaControlsFeature,
&kIPHLiveCaptionFeature,
&kIPHPasswordsAccountStorageFeature, &kIPHPasswordsAccountStorageFeature,
&kIPHReopenTabFeature, &kIPHReopenTabFeature,
&kIPHWebUITabStripFeature, &kIPHWebUITabStripFeature,
......
...@@ -129,6 +129,7 @@ DEFINE_VARIATION_PARAM(kIPHDesktopTabGroupsNewGroupFeature, ...@@ -129,6 +129,7 @@ DEFINE_VARIATION_PARAM(kIPHDesktopTabGroupsNewGroupFeature,
"IPH_DesktopTabGroupsNewGroup"); "IPH_DesktopTabGroupsNewGroup");
DEFINE_VARIATION_PARAM(kIPHFocusModeFeature, "IPH_FocusMode"); DEFINE_VARIATION_PARAM(kIPHFocusModeFeature, "IPH_FocusMode");
DEFINE_VARIATION_PARAM(kIPHGlobalMediaControls, "IPH_GlobalMediaControls"); DEFINE_VARIATION_PARAM(kIPHGlobalMediaControls, "IPH_GlobalMediaControls");
DEFINE_VARIATION_PARAM(kIPHLiveCaption, "IPH_LiveCaption");
DEFINE_VARIATION_PARAM(kIPHPasswordsAccountStorageFeature, DEFINE_VARIATION_PARAM(kIPHPasswordsAccountStorageFeature,
"IPH_PasswordsAccountStorage"); "IPH_PasswordsAccountStorage");
DEFINE_VARIATION_PARAM(kIPHReopenTabFeature, "IPH_ReopenTab"); DEFINE_VARIATION_PARAM(kIPHReopenTabFeature, "IPH_ReopenTab");
...@@ -195,6 +196,7 @@ constexpr flags_ui::FeatureEntry::FeatureVariation ...@@ -195,6 +196,7 @@ constexpr flags_ui::FeatureEntry::FeatureVariation
VARIATION_ENTRY(kIPHDesktopTabGroupsNewGroupFeature), VARIATION_ENTRY(kIPHDesktopTabGroupsNewGroupFeature),
VARIATION_ENTRY(kIPHFocusModeFeature), VARIATION_ENTRY(kIPHFocusModeFeature),
VARIATION_ENTRY(kIPHGlobalMediaControls), VARIATION_ENTRY(kIPHGlobalMediaControls),
VARIATION_ENTRY(kIPHLiveCaption),
VARIATION_ENTRY(kIPHPasswordsAccountStorageFeature), VARIATION_ENTRY(kIPHPasswordsAccountStorageFeature),
VARIATION_ENTRY(kIPHReopenTabFeature), VARIATION_ENTRY(kIPHReopenTabFeature),
VARIATION_ENTRY(kIPHWebUITabStripFeature), VARIATION_ENTRY(kIPHWebUITabStripFeature),
......
...@@ -4046,6 +4046,24 @@ ...@@ -4046,6 +4046,24 @@
] ]
} }
], ],
"LiveCaptionInProductHelp": [
{
"platforms": [
"chromeos",
"linux",
"mac",
"windows"
],
"experiments": [
{
"name": "Enabled",
"enable_features": [
"IPH_LiveCaption"
]
}
]
}
],
"LoadingPredictorDisregardAlwaysAccessesNetwork": [ "LoadingPredictorDisregardAlwaysAccessesNetwork": [
{ {
"platforms": [ "platforms": [
......
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