Skip to content

Commit

Permalink
change app_list::features to app_list_features
Browse files Browse the repository at this point in the history
We have a few different "features" namespaces, which can collide in
subtle and confusing ways, particularly in jumbo builds.

The Google C++ Style Guide advises avoiding collisions between nested
namespaces and well-known top-level namespaces, and I think "features"
qualifies.

Let's therefore rename app_list::features to app_list_features.

Change-Id: I4fbad5a33b6e5d217924cd008b0f8d9374cf1a43
Reviewed-on: https://chromium-review.googlesource.com/1215023
Reviewed-by: Scott Violet <[email protected]>
Reviewed-by: Xiyuan Xia <[email protected]>
Commit-Queue: Mostyn Bramley-Moore <[email protected]>
Cr-Commit-Position: refs/heads/master@{#593729}
  • Loading branch information
mostynb authored and Commit Bot committed Sep 24, 2018
1 parent bab1406 commit 177b931
Show file tree
Hide file tree
Showing 41 changed files with 111 additions and 101 deletions.
4 changes: 2 additions & 2 deletions ash/app_list/app_list_controller_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace ash {
AppListControllerImpl::AppListControllerImpl(ws::WindowService* window_service)
: window_service_(window_service),
presenter_(std::make_unique<AppListPresenterDelegateImpl>(this)),
is_home_launcher_enabled_(app_list::features::IsHomeLauncherEnabled()),
is_home_launcher_enabled_(app_list_features::IsHomeLauncherEnabled()),
voice_interaction_binding_(this) {
model_.AddObserver(this);

Expand All @@ -73,7 +73,7 @@ AppListControllerImpl::AppListControllerImpl(ws::WindowService* window_service)
keyboard::KeyboardController::Get()->AddObserver(this);

if (is_home_launcher_enabled_ &&
app_list::features::IsHomeLauncherGesturesEnabled()) {
app_list_features::IsHomeLauncherGesturesEnabled()) {
home_launcher_gesture_handler_ =
std::make_unique<HomeLauncherGestureHandler>(this);
}
Expand Down
6 changes: 3 additions & 3 deletions ash/app_list/app_list_presenter_delegate_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class AppListPresenterDelegateNonHomeLauncherTest
// testing::Test:
void SetUp() override {
scoped_feature_list_.InitWithFeatures(
{}, {app_list::features::kEnableHomeLauncher});
{}, {app_list_features::kEnableHomeLauncher});
AppListPresenterDelegateTest::SetUp();
}

Expand Down Expand Up @@ -1120,8 +1120,8 @@ class AppListPresenterDelegateHomeLauncherTest
// testing::Test:
void SetUp() override {
scoped_feature_list_.InitWithFeatures(
{app_list::features::kEnableHomeLauncher,
app_list::features::kEnableBackgroundBlur},
{app_list_features::kEnableHomeLauncher,
app_list_features::kEnableBackgroundBlur},
{});
AppListPresenterDelegateTest::SetUp();
// Home launcher is only enabled on internal display.
Expand Down
5 changes: 3 additions & 2 deletions ash/app_list/model/folder_image.cc
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ const size_t FolderImage::kNumFolderTopItems = 4;

FolderImage::FolderImage(AppListItemList* item_list)
: item_list_(item_list),
is_new_style_launcher_enabled_(features::IsNewStyleLauncherEnabled()) {
is_new_style_launcher_enabled_(
app_list_features::IsNewStyleLauncherEnabled()) {
item_list_->AddObserver(this);
}

Expand Down Expand Up @@ -217,7 +218,7 @@ void FolderImage::UpdateDraggedItem(const AppListItem* dragged_item) {
std::vector<gfx::Rect> FolderImage::GetTopIconsBounds(
const gfx::Rect& folder_icon_bounds,
size_t num_items) {
if (!features::IsNewStyleLauncherEnabled())
if (!app_list_features::IsNewStyleLauncherEnabled())
return GetTopIconsBoundsLegacy(folder_icon_bounds, num_items);

DCHECK_LE(num_items, kNumFolderTopItems);
Expand Down
3 changes: 2 additions & 1 deletion ash/app_list/views/app_list_item_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ AppListItemView::AppListItemView(AppsGridView* apps_grid_view,
icon_(new IconImageView),
title_(new views::Label),
progress_bar_(new views::ProgressBar),
is_new_style_launcher_enabled_(features::IsNewStyleLauncherEnabled()),
is_new_style_launcher_enabled_(
app_list_features::IsNewStyleLauncherEnabled()),
weak_ptr_factory_(this) {
SetFocusBehavior(FocusBehavior::ALWAYS);

Expand Down
4 changes: 2 additions & 2 deletions ash/app_list/views/app_list_main_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ void AppListMainView::QueryChanged(search_box::SearchBoxViewBase* sender) {
base::string16 query;
base::TrimWhitespace(raw_query, base::TRIM_ALL, &query);
bool should_show_search =
features::IsZeroStateSuggestionsEnabled()
app_list_features::IsZeroStateSuggestionsEnabled()
? search_box_view_->is_search_box_active() || !query.empty()
: !query.empty();
contents_view_->ShowSearchResults(should_show_search);
Expand All @@ -190,7 +190,7 @@ void AppListMainView::QueryChanged(search_box::SearchBoxViewBase* sender) {
}

void AppListMainView::ActiveChanged(search_box::SearchBoxViewBase* sender) {
if (!features::IsZeroStateSuggestionsEnabled())
if (!app_list_features::IsZeroStateSuggestionsEnabled())
return;

if (search_box_view_->is_search_box_active()) {
Expand Down
15 changes: 8 additions & 7 deletions ash/app_list/views/app_list_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ AppListView::AppListView(AppListViewDelegate* delegate)
: delegate_(delegate),
model_(delegate->GetModel()),
search_model_(delegate->GetSearchModel()),
is_background_blur_enabled_(features::IsBackgroundBlurEnabled()),
is_background_blur_enabled_(app_list_features::IsBackgroundBlurEnabled()),
display_observer_(this),
hide_view_animation_observer_(
std::make_unique<HideViewAnimationObserver>()),
Expand All @@ -315,8 +315,9 @@ AppListView::AppListView(AppListViewDelegate* delegate)
views::FocusManager::arrow_key_traversal_enabled()),
state_animation_metrics_reporter_(
std::make_unique<StateAnimationMetricsReporter>()),
is_home_launcher_enabled_(app_list::features::IsHomeLauncherEnabled()),
is_new_style_launcher_enabled_(features::IsNewStyleLauncherEnabled()),
is_home_launcher_enabled_(app_list_features::IsHomeLauncherEnabled()),
is_new_style_launcher_enabled_(
app_list_features::IsNewStyleLauncherEnabled()),
weak_ptr_factory_(this) {
CHECK(delegate);

Expand Down Expand Up @@ -1413,7 +1414,7 @@ void AppListView::SetStateFromSearchBoxView(bool search_box_is_empty,
bool triggered_by_contents_change) {
switch (app_list_state_) {
case AppListViewState::PEEKING:
if (features::IsZeroStateSuggestionsEnabled()) {
if (app_list_features::IsZeroStateSuggestionsEnabled()) {
if (!search_box_is_empty || search_box_view()->is_search_box_active())
SetState(AppListViewState::HALF);
} else {
Expand All @@ -1422,7 +1423,7 @@ void AppListView::SetStateFromSearchBoxView(bool search_box_is_empty,
}
break;
case AppListViewState::HALF:
if (features::IsZeroStateSuggestionsEnabled()) {
if (app_list_features::IsZeroStateSuggestionsEnabled()) {
if (search_box_is_empty && !triggered_by_contents_change)
SetState(AppListViewState::PEEKING);
} else {
Expand All @@ -1431,7 +1432,7 @@ void AppListView::SetStateFromSearchBoxView(bool search_box_is_empty,
}
break;
case AppListViewState::FULLSCREEN_SEARCH:
if (features::IsZeroStateSuggestionsEnabled()) {
if (app_list_features::IsZeroStateSuggestionsEnabled()) {
if (search_box_is_empty && !triggered_by_contents_change) {
SetState(AppListViewState::FULLSCREEN_ALL_APPS);
app_list_main_view()->contents_view()->SetActiveState(
Expand All @@ -1446,7 +1447,7 @@ void AppListView::SetStateFromSearchBoxView(bool search_box_is_empty,
}
break;
case AppListViewState::FULLSCREEN_ALL_APPS:
if (features::IsZeroStateSuggestionsEnabled()) {
if (app_list_features::IsZeroStateSuggestionsEnabled()) {
if (!search_box_is_empty ||
(search_box_is_empty && triggered_by_contents_change))
SetState(AppListViewState::FULLSCREEN_SEARCH);
Expand Down
12 changes: 6 additions & 6 deletions ash/app_list/views/app_list_view_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ class AppListViewTest : public views::ViewsTestBase,
}
if (is_new_style_launcher_enabled_) {
scoped_feature_list_.InitAndEnableFeature(
features::kEnableNewStyleLauncher);
app_list_features::kEnableNewStyleLauncher);
} else {
scoped_feature_list_.InitAndDisableFeature(
features::kEnableNewStyleLauncher);
app_list_features::kEnableNewStyleLauncher);
}
views::ViewsTestBase::SetUp();
}
Expand Down Expand Up @@ -271,10 +271,10 @@ class AppListViewFocusTest : public views::ViewsTestBase,
}
if (is_new_style_launcher_enabled_) {
scoped_feature_list_.InitAndEnableFeature(
features::kEnableNewStyleLauncher);
app_list_features::kEnableNewStyleLauncher);
} else {
scoped_feature_list_.InitAndDisableFeature(
features::kEnableNewStyleLauncher);
app_list_features::kEnableNewStyleLauncher);
}

views::ViewsTestBase::SetUp();
Expand Down Expand Up @@ -614,7 +614,7 @@ class AppListViewHomeLauncherTest : public AppListViewTest {

void SetUp() override {
scoped_feature_list_.InitAndEnableFeature(
app_list::features::kEnableHomeLauncher);
app_list_features::kEnableHomeLauncher);
AppListViewTest::SetUp();
}

Expand All @@ -632,7 +632,7 @@ class AppListViewNonHomeLauncherTest : public AppListViewTest {

void SetUp() override {
scoped_feature_list_.InitAndDisableFeature(
app_list::features::kEnableHomeLauncher);
app_list_features::kEnableHomeLauncher);
AppListViewTest::SetUp();
}

Expand Down
3 changes: 2 additions & 1 deletion ash/app_list/views/apps_container_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ constexpr float kSuggestionChipOpacityEndProgress = 1;
AppsContainerView::AppsContainerView(ContentsView* contents_view,
AppListModel* model)
: contents_view_(contents_view),
is_new_style_launcher_enabled_(features::IsNewStyleLauncherEnabled()) {
is_new_style_launcher_enabled_(
app_list_features::IsNewStyleLauncherEnabled()) {
if (is_new_style_launcher_enabled_) {
suggestion_chip_container_view_ =
new SuggestionChipContainerView(contents_view);
Expand Down
7 changes: 4 additions & 3 deletions ash/app_list/views/apps_grid_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,9 @@ AppsGridView::AppsGridView(ContentsView* contents_view,
pagination_animation_start_frame_number_(0),
view_structure_(this),
is_apps_grid_gap_feature_enabled_(
features::IsAppsGridGapFeatureEnabled()),
is_new_style_launcher_enabled_(features::IsNewStyleLauncherEnabled()) {
app_list_features::IsAppsGridGapFeatureEnabled()),
is_new_style_launcher_enabled_(
app_list_features::IsNewStyleLauncherEnabled()) {
DCHECK(contents_view_);
SetPaintToLayer();
// Clip any icons that are outside the grid view's bounds. These icons would
Expand Down Expand Up @@ -353,7 +354,7 @@ AppsGridView::AppsGridView(ContentsView* contents_view,
AddChildView(expand_arrow_view_);
}

if (!folder_delegate_ && features::IsBackgroundBlurEnabled()) {
if (!folder_delegate_ && app_list_features::IsBackgroundBlurEnabled()) {
// TODO(newcomer): Improve implementation of the mask layer so we can
// enable it on all devices https://crbug.com/765292.
fadeout_layer_delegate_ = std::make_unique<FadeoutLayerDelegate>();
Expand Down
13 changes: 8 additions & 5 deletions ash/app_list/views/apps_grid_view_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,17 @@ class AppsGridViewTest : public views::ViewsTestBase,
is_new_style_launcher_enabled_ = GetParam().is_new_style_launcher_enabled;
}
if (is_apps_grid_gap_enabled_) {
enabled_features.emplace_back(features::kEnableAppsGridGapFeature);
enabled_features.emplace_back(
app_list_features::kEnableAppsGridGapFeature);
} else {
disabled_features.emplace_back(features::kEnableAppsGridGapFeature);
disabled_features.emplace_back(
app_list_features::kEnableAppsGridGapFeature);
}
if (is_new_style_launcher_enabled_) {
enabled_features.emplace_back(features::kEnableNewStyleLauncher);
enabled_features.emplace_back(app_list_features::kEnableNewStyleLauncher);
} else {
disabled_features.emplace_back(features::kEnableNewStyleLauncher);
disabled_features.emplace_back(
app_list_features::kEnableNewStyleLauncher);
}
scoped_feature_list_.InitWithFeatures(enabled_features, disabled_features);
views::ViewsTestBase::SetUp();
Expand Down Expand Up @@ -1087,7 +1090,7 @@ class AppsGridGapTest : public AppsGridViewTest {
// testing::Test overrides:
void SetUp() override {
scoped_feature_list_.InitWithFeatures(
{app_list::features::kEnableAppsGridGapFeature}, {});
{app_list_features::kEnableAppsGridGapFeature}, {});
AppsGridViewTest::SetUp();
apps_grid_view_->set_page_flip_delay_in_ms_for_testing(10);
GetPaginationModel()->SetTransitionDurations(10, 10);
Expand Down
6 changes: 3 additions & 3 deletions ash/app_list/views/contents_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ void ContentsView::Init(AppListModel* model) {
SearchModel::SearchResults* results =
view_delegate->GetSearchModel()->results();

if (features::IsAnswerCardEnabled()) {
if (app_list_features::IsAnswerCardEnabled()) {
search_result_answer_card_view_ =
new SearchResultAnswerCardView(view_delegate);
search_results_page_view_->AddSearchResultContainerView(
results, search_result_answer_card_view_);
}

if (features::IsNewStyleLauncherEnabled()) {
if (app_list_features::IsNewStyleLauncherEnabled()) {
expand_arrow_view_ = new ExpandArrowView(this, app_list_view_);
AddChildView(expand_arrow_view_);
}
Expand Down Expand Up @@ -323,7 +323,7 @@ void ContentsView::UpdateExpandArrowOpacity(double progress,
// Don't show |expand_arrow_view_| when the home launcher gestures are
// disabled in tablet mode.
if (app_list_view_->IsHomeLauncherEnabledInTabletMode() &&
!features::IsHomeLauncherGesturesEnabled()) {
!app_list_features::IsHomeLauncherGesturesEnabled()) {
expand_arrow_view_->layer()->SetOpacity(0);
return;
}
Expand Down
3 changes: 2 additions & 1 deletion ash/app_list/views/expand_arrow_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ ExpandArrowView::ExpandArrowView(ContentsView* contents_view,
: views::Button(this),
contents_view_(contents_view),
app_list_view_(app_list_view),
is_new_style_launcher_enabled_(features::IsNewStyleLauncherEnabled()),
is_new_style_launcher_enabled_(
app_list_features::IsNewStyleLauncherEnabled()),
weak_ptr_factory_(this) {
SetFocusBehavior(FocusBehavior::ALWAYS);
SetPaintToLayer();
Expand Down
7 changes: 4 additions & 3 deletions ash/app_list/views/search_box_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,13 @@ SearchBoxView::SearchBoxView(search_box::SearchBoxViewDelegate* delegate,
: search_box::SearchBoxViewBase(delegate),
view_delegate_(view_delegate),
app_list_view_(app_list_view),
is_new_style_launcher_enabled_(features::IsNewStyleLauncherEnabled()),
is_new_style_launcher_enabled_(
app_list_features::IsNewStyleLauncherEnabled()),
is_app_list_search_autocomplete_enabled_(
features::IsAppListSearchAutocompleteEnabled()),
app_list_features::IsAppListSearchAutocompleteEnabled()),
weak_ptr_factory_(this) {
set_is_tablet_mode(app_list_view->is_tablet_mode());
if (features::IsZeroStateSuggestionsEnabled())
if (app_list_features::IsZeroStateSuggestionsEnabled())
set_show_close_button_when_active(true);
}

Expand Down
2 changes: 1 addition & 1 deletion ash/app_list/views/search_box_view_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ class SearchBoxViewAutocompleteTest
// Overridden from testing::Test
void SetUp() override {
scoped_feature_list_.InitWithFeatures(
{features::kEnableAppListSearchAutocomplete}, {});
{app_list_features::kEnableAppListSearchAutocomplete}, {});
SearchBoxViewTest::SetUp();
}

Expand Down
8 changes: 5 additions & 3 deletions ash/app_list/views/search_result_page_view_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@ class SearchResultPageViewTest

// Setting up the feature set.
if (test_with_answer_card)
scoped_feature_list_.InitAndEnableFeature(features::kEnableAnswerCard);
scoped_feature_list_.InitAndEnableFeature(
app_list_features::kEnableAnswerCard);
else
scoped_feature_list_.InitAndDisableFeature(features::kEnableAnswerCard);
scoped_feature_list_.InitAndDisableFeature(
app_list_features::kEnableAnswerCard);

ASSERT_EQ(test_with_answer_card, features::IsAnswerCardEnabled());
ASSERT_EQ(test_with_answer_card, app_list_features::IsAnswerCardEnabled());

// Setting up views.
delegate_ = std::make_unique<AppListTestViewDelegate>();
Expand Down
4 changes: 2 additions & 2 deletions ash/app_list/views/search_result_tile_item_list_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ SearchResultTileItemListView::SearchResultTileItemListView(
: search_result_page_view_(search_result_page_view),
search_box_(search_box),
is_play_store_app_search_enabled_(
features::IsPlayStoreAppSearchEnabled()) {
app_list_features::IsPlayStoreAppSearchEnabled()) {
SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::kHorizontal,
gfx::Insets(kItemListVerticalSpacing, kItemListHorizontalSpacing),
Expand Down Expand Up @@ -98,7 +98,7 @@ int SearchResultTileItemListView::DoUpdate() {
base::TrimWhitespace(raw_query, base::TRIM_ALL, &query);

SearchResult::DisplayType display_type =
features::IsZeroStateSuggestionsEnabled()
app_list_features::IsZeroStateSuggestionsEnabled()
? (query.empty() ? ash::SearchResultDisplayType::kRecommendation
: ash::SearchResultDisplayType::kTile)
: ash::SearchResultDisplayType::kTile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ class SearchResultTileItemListViewTest
// feature.
if (IsPlayStoreAppSearchEnabled()) {
scoped_feature_list_.InitWithFeatures(
{features::kEnablePlayStoreAppSearch}, {});
{app_list_features::kEnablePlayStoreAppSearch}, {});
} else {
scoped_feature_list_.InitWithFeatures(
{}, {features::kEnablePlayStoreAppSearch});
{}, {app_list_features::kEnablePlayStoreAppSearch});
}
ASSERT_EQ(IsPlayStoreAppSearchEnabled(),
features::IsPlayStoreAppSearchEnabled());
app_list_features::IsPlayStoreAppSearchEnabled());

// Sets up the views.
textfield_ = std::make_unique<views::Textfield>();
Expand Down
4 changes: 2 additions & 2 deletions ash/app_list/views/search_result_tile_item_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ SearchResultTileItemView::SearchResultTileItemView(
: view_delegate_(view_delegate),
pagination_model_(pagination_model),
is_play_store_app_search_enabled_(
features::IsPlayStoreAppSearchEnabled()),
app_list_features::IsPlayStoreAppSearchEnabled()),
show_in_apps_page_(show_in_apps_page),
weak_ptr_factory_(this) {
SetFocusBehavior(FocusBehavior::ALWAYS);
Expand All @@ -114,7 +114,7 @@ SearchResultTileItemView::SearchResultTileItemView(
AddChildView(icon_);

if (is_play_store_app_search_enabled_ ||
features::IsAppShortcutSearchEnabled()) {
app_list_features::IsAppShortcutSearchEnabled()) {
badge_ = new views::ImageView;
badge_->set_can_process_events_within_subtree(false);
badge_->SetVerticalAlignment(views::ImageView::LEADING);
Expand Down
2 changes: 1 addition & 1 deletion ash/frame/non_client_frame_view_ash_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ class HomeLauncherNonClientFrameViewAshTest : public AshTestBase {

void SetUp() override {
scoped_feature_list_.InitAndEnableFeature(
app_list::features::kEnableHomeLauncher);
app_list_features::kEnableHomeLauncher);
AshTestBase::SetUp();
}

Expand Down
4 changes: 2 additions & 2 deletions ash/message_center/message_center_bubble.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ ContentsView::ContentsView(MessageCenterBubble* bubble, views::View* contents)
SetLayoutManager(std::make_unique<views::FillLayout>());

SetBackground(views::CreateSolidBackground(
app_list::features::IsBackgroundBlurEnabled() ? kBackgroundColorWithBlur
: kBackgroundColor));
app_list_features::IsBackgroundBlurEnabled() ? kBackgroundColorWithBlur
: kBackgroundColor));
SetPaintToLayer();
layer()->SetFillsBoundsOpaquely(false);
AddChildView(contents);
Expand Down
Loading

0 comments on commit 177b931

Please sign in to comment.