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

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

Issue 19675010: [win] Initialize the app list menu lazily, and allow invalidation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase/no-op because CQ is wedged Created 7 years, 5 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
« no previous file with comments | « ui/app_list/views/search_box_view.h ('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 1187ecf6ade5434dd19545d66ef538ebb27fdec3..73a04a60ac294bef55569be699f5c86ce75d871f 100644
--- a/ui/app_list/views/search_box_view.cc
+++ b/ui/app_list/views/search_box_view.cc
@@ -9,6 +9,7 @@
#include "grit/ui_resources.h"
#include "ui/app_list/search_box_model.h"
#include "ui/app_list/search_box_view_delegate.h"
+#include "ui/app_list/views/app_list_menu_views.h"
#include "ui/base/events/event.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/views/controls/button/menu_button.h"
@@ -32,8 +33,8 @@ const SkColor kHintTextColor = SkColorSetRGB(0xA0, 0xA0, 0xA0);
SearchBoxView::SearchBoxView(SearchBoxViewDelegate* delegate,
AppListViewDelegate* view_delegate)
: delegate_(delegate),
+ view_delegate_(view_delegate),
model_(NULL),
- menu_(view_delegate),
icon_view_(new views::ImageView),
search_box_(new views::Textfield),
contents_view_(NULL) {
@@ -90,6 +91,10 @@ void SearchBoxView::ClearSearch() {
NotifyQueryChanged();
}
+void SearchBoxView::InvalidateMenu() {
+ menu_.reset();
+}
+
gfx::Size SearchBoxView::GetPreferredSize() {
return gfx::Size(kPreferredWidth, kPreferredHeight);
}
@@ -159,8 +164,11 @@ bool SearchBoxView::HandleKeyEvent(views::Textfield* sender,
}
void SearchBoxView::OnMenuButtonClicked(View* source, const gfx::Point& point) {
- menu_.RunMenuAt(menu_button_,
- menu_button_->GetBoundsInScreen().bottom_right());
+ if (!menu_)
+ menu_.reset(new AppListMenuViews(view_delegate_));
+
+ menu_->RunMenuAt(menu_button_,
+ menu_button_->GetBoundsInScreen().bottom_right());
}
void SearchBoxView::IconChanged() {
« no previous file with comments | « ui/app_list/views/search_box_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698