Commit e6eb7b39 authored by Elaine Chien's avatar Elaine Chien Committed by Chromium LUCI CQ

ChromeBeta: Check for beta approval

Developers will specify whether their features have beta approval.
ChromeBeta will only showcase features on the Beta channel if they have
Beta approval

Note: We are renaming ChromeLabs to ChromeBeta

Bug: 1145666
Change-Id: Iee576ecf0a52d075559b605cfecae5733d539425
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2613557
Commit-Queue: Elaine Chien <elainechien@chromium.org>
Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842165}
parent 0ccf0ae3
...@@ -10,9 +10,11 @@ ...@@ -10,9 +10,11 @@
#include "chrome/browser/flag_descriptions.h" #include "chrome/browser/flag_descriptions.h"
#include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/ui/webui/flags/flags_ui.h" #include "chrome/browser/ui/webui/flags/flags_ui.h"
#include "chrome/common/channel_info.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "chrome/grit/google_chrome_strings.h" #include "chrome/grit/google_chrome_strings.h"
#include "components/flags_ui/pref_service_flags_storage.h" #include "components/flags_ui/pref_service_flags_storage.h"
#include "components/version_info/channel.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/color_palette.h" #include "ui/gfx/color_palette.h"
#include "ui/views/background.h" #include "ui/views/background.h"
...@@ -179,7 +181,8 @@ ChromeLabsBubbleView::ChromeLabsBubbleView( ...@@ -179,7 +181,8 @@ ChromeLabsBubbleView::ChromeLabsBubbleView(
for (const auto& lab : all_labs) { for (const auto& lab : all_labs) {
const flags_ui::FeatureEntry* entry = const flags_ui::FeatureEntry* entry =
flags_state_->FindFeatureEntryByName(lab.internal_name); flags_state_->FindFeatureEntryByName(lab.internal_name);
if (IsFeatureSupportedOnPlatform(entry)) { if (IsFeatureSupportedOnChannel(lab) &&
IsFeatureSupportedOnPlatform(entry)) {
DCHECK_EQ(entry->type, flags_ui::FeatureEntry::FEATURE_VALUE); DCHECK_EQ(entry->type, flags_ui::FeatureEntry::FEATURE_VALUE);
int default_index = GetIndexOfEnabledLabState(entry); int default_index = GetIndexOfEnabledLabState(entry);
menu_item_container_->AddChildView( menu_item_container_->AddChildView(
...@@ -235,6 +238,10 @@ int ChromeLabsBubbleView::GetIndexOfEnabledLabState( ...@@ -235,6 +238,10 @@ int ChromeLabsBubbleView::GetIndexOfEnabledLabState(
return 0; return 0;
} }
bool ChromeLabsBubbleView::IsFeatureSupportedOnChannel(const LabInfo& lab) {
return chrome::GetChannel() <= lab.allowed_channel;
}
// TODO(elainechien): ChromeOS specific logic for owner access only flags. // TODO(elainechien): ChromeOS specific logic for owner access only flags.
bool ChromeLabsBubbleView::IsFeatureSupportedOnPlatform( bool ChromeLabsBubbleView::IsFeatureSupportedOnPlatform(
const flags_ui::FeatureEntry* entry) { const flags_ui::FeatureEntry* entry) {
......
...@@ -43,6 +43,8 @@ class ChromeLabsBubbleView : public views::BubbleDialogDelegateView { ...@@ -43,6 +43,8 @@ class ChromeLabsBubbleView : public views::BubbleDialogDelegateView {
int GetIndexOfEnabledLabState(const flags_ui::FeatureEntry* entry); int GetIndexOfEnabledLabState(const flags_ui::FeatureEntry* entry);
bool IsFeatureSupportedOnChannel(const LabInfo& lab);
bool IsFeatureSupportedOnPlatform(const flags_ui::FeatureEntry* entry); bool IsFeatureSupportedOnPlatform(const flags_ui::FeatureEntry* entry);
void ShowRelaunchPrompt(); void ShowRelaunchPrompt();
......
...@@ -6,6 +6,19 @@ ...@@ -6,6 +6,19 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chrome/browser/flag_descriptions.h" #include "chrome/browser/flag_descriptions.h"
LabInfo::LabInfo(const std::string& internal_name,
const base::string16& visible_name,
const base::string16& visible_description,
version_info::Channel allowed_channel)
: internal_name(internal_name),
visible_name(visible_name),
visible_description(visible_description),
allowed_channel(allowed_channel) {}
LabInfo::LabInfo(const LabInfo& other) = default;
LabInfo::~LabInfo() = default;
ChromeLabsBubbleViewModel::ChromeLabsBubbleViewModel() { ChromeLabsBubbleViewModel::ChromeLabsBubbleViewModel() {
SetUpLabs(); SetUpLabs();
} }
...@@ -31,16 +44,18 @@ void ChromeLabsBubbleViewModel::SetUpLabs() { ...@@ -31,16 +44,18 @@ void ChromeLabsBubbleViewModel::SetUpLabs() {
// Read Later. // Read Later.
lab_info_.emplace_back(LabInfo( lab_info_.emplace_back(LabInfo(
flag_descriptions::kReadLaterFlagId, base::ASCIIToUTF16("Reading List"), flag_descriptions::kReadLaterFlagId, base::ASCIIToUTF16("Reading List"),
base::ASCIIToUTF16( base::ASCIIToUTF16("Right click on a tab or click the Bookmark icon to "
"Right click on a tab or click the star to add tabs to a reading " "add tabs to a reading "
"list. Access from the Bookmarks bar."))); "list. Access from the Bookmarks bar."),
version_info::Channel::BETA));
// Tab Search. // Tab Search.
lab_info_.emplace_back( lab_info_.emplace_back(
LabInfo(flag_descriptions::kEnableTabSearchFlagId, LabInfo(flag_descriptions::kEnableTabSearchFlagId,
base::ASCIIToUTF16("Tab Search"), base::ASCIIToUTF16("Tab Search"),
base::ASCIIToUTF16("Enable a popup bubble in Top Chrome UI to " base::ASCIIToUTF16("Enable a popup bubble in Top Chrome UI to "
"search over currently open tabs."))); "search over currently open tabs."),
version_info::Channel::BETA));
} }
void ChromeLabsBubbleViewModel::SetLabInfoForTesting( void ChromeLabsBubbleViewModel::SetLabInfoForTesting(
......
...@@ -7,21 +7,26 @@ ...@@ -7,21 +7,26 @@
#include <vector> #include <vector>
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "components/version_info/channel.h"
// Currently there are differences in both visible name and visible description // Currently there are differences in both visible name and visible description
// between about_flags and what we want for Chrome Labs. We are coordinating to // between about_flags and what we want for Chrome Labs. We are coordinating to
// match these. LabInfo struct can be removed after that. // match these. Visible name and visible description can be removed from this
// struct after that.
struct LabInfo { struct LabInfo {
LabInfo(const std::string& internal_name, LabInfo(const std::string& internal_name,
const base::string16& visible_name, const base::string16& visible_name,
const base::string16& visible_description) const base::string16& visible_description,
: internal_name(internal_name), version_info::Channel allowed_channel);
visible_name(visible_name), LabInfo(const LabInfo& other);
visible_description(visible_description) {} ~LabInfo();
std::string internal_name; std::string internal_name;
base::string16 visible_name; base::string16 visible_name;
base::string16 visible_description; base::string16 visible_description;
// Channels that are less stable than allowed_channel will also be
// considered allowed. ex) if BETA is specified, this feature will also be
// shown on CANARY and DEV.
version_info::Channel allowed_channel;
}; };
class ChromeLabsBubbleViewModel { class ChromeLabsBubbleViewModel {
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "chrome/browser/ui/views/toolbar/toolbar_view.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "components/flags_ui/feature_entry_macros.h" #include "components/flags_ui/feature_entry_macros.h"
#include "components/flags_ui/flags_state.h" #include "components/flags_ui/flags_state.h"
#include "components/version_info/channel.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/views/test/combobox_test_api.h" #include "ui/views/test/combobox_test_api.h"
#include "ui/views/test/widget_test.h" #include "ui/views/test/widget_test.h"
...@@ -67,14 +68,17 @@ class ChromeLabsBubbleTest : public TestWithBrowserView { ...@@ -67,14 +68,17 @@ class ChromeLabsBubbleTest : public TestWithBrowserView {
} }
void CreateTestLabInfo() { void CreateTestLabInfo() {
test_feature_info_.emplace_back(LabInfo( test_feature_info_.emplace_back(
kFirstTestFeatureId, base::ASCIIToUTF16(""), base::ASCIIToUTF16(""))); LabInfo(kFirstTestFeatureId, base::ASCIIToUTF16(""),
base::ASCIIToUTF16(""), version_info::Channel::UNKNOWN));
test_feature_info_.emplace_back(LabInfo( test_feature_info_.emplace_back(
kSecondTestFeatureId, base::ASCIIToUTF16(""), base::ASCIIToUTF16(""))); LabInfo(kSecondTestFeatureId, base::ASCIIToUTF16(""),
base::ASCIIToUTF16(""), version_info::Channel::UNKNOWN));
test_feature_info_.emplace_back(LabInfo( test_feature_info_.emplace_back(
kThirdTestFeatureId, base::ASCIIToUTF16(""), base::ASCIIToUTF16(""))); LabInfo(kThirdTestFeatureId, base::ASCIIToUTF16(""),
base::ASCIIToUTF16(""), version_info::Channel::UNKNOWN));
} }
const std::vector<LabInfo>& GetTestLabInfo() { return test_feature_info_; } const std::vector<LabInfo>& GetTestLabInfo() { return test_feature_info_; }
......
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