Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(705)

Unified Diff: ui/app_list/views/search_box_view.cc

Issue 2934513004: Changed static variable flag to be a bool in the anon namespace. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« ui/app_list/views/app_list_view.cc ('K') | « ui/app_list/views/app_list_view.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/views/search_box_view.cc
diff --git a/ui/app_list/views/search_box_view.cc b/ui/app_list/views/search_box_view.cc
index 599f298e8c5f24eec2bbe104450765527e879a72..9da5411f81a71ea59c36d0286006c48eb5b13fcd 100644
--- a/ui/app_list/views/search_box_view.cc
+++ b/ui/app_list/views/search_box_view.cc
@@ -53,10 +53,13 @@ const SkColor kHintTextColor = SkColorSetRGB(0xA0, 0xA0, 0xA0);
const int kBackgroundBorderCornerRadius = 2;
const int kBackgroundBorderCornerRadiusFullscreen = 20;
-bool IsFullscreenAppListEnabled() {
+// The switch that is checked to determine if the fullscreen app list feature is
+// enabled.
+bool is_fullscreen_app_list_enabled;
+
+void IsFullscreenAppListEnabled() {
// Cache this value to avoid repeated lookup.
- static bool cached_value = features::IsFullscreenAppListEnabled();
- return cached_value;
+ is_fullscreen_app_list_enabled = features::IsFullscreenAppListEnabled();
}
// A background that paints a solid white rounded rect with a thin grey border.
@@ -64,7 +67,7 @@ class SearchBoxBackground : public views::Background {
public:
SearchBoxBackground()
: background_border_corner_radius_(
- IsFullscreenAppListEnabled()
+ is_fullscreen_app_list_enabled
? kBackgroundBorderCornerRadiusFullscreen
: kBackgroundBorderCornerRadius) {}
~SearchBoxBackground() override {}
@@ -143,8 +146,9 @@ SearchBoxView::SearchBoxView(SearchBoxViewDelegate* delegate,
contents_view_(NULL),
app_list_view_(app_list_view),
focused_view_(FOCUS_SEARCH_BOX) {
+ IsFullscreenAppListEnabled();
SetLayoutManager(new views::FillLayout);
- SetPreferredSize(gfx::Size(IsFullscreenAppListEnabled()
+ SetPreferredSize(gfx::Size(is_fullscreen_app_list_enabled
? kPreferredWidthFullscreen
: kPreferredWidth,
kPreferredHeight));
@@ -346,7 +350,7 @@ void SearchBoxView::ContentsChanged(views::Textfield* sender,
view_delegate_->AutoLaunchCanceled();
NotifyQueryChanged();
- if (IsFullscreenAppListEnabled() && !app_list_view_->is_fullscreen()) {
+ if (is_fullscreen_app_list_enabled && !app_list_view_->is_fullscreen()) {
// If the app list is in the peeking state, switch it to fullscreen.
app_list_view_->SetState(AppListView::FULLSCREEN);
}
« ui/app_list/views/app_list_view.cc ('K') | « ui/app_list/views/app_list_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698