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

Unified Diff: ui/app_list/search_result_view.h

Issue 10386224: app_list: Add search box and search result view for v2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win_aura Created 8 years, 7 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
Index: ui/app_list/search_result_view.h
diff --git a/ui/app_list/search_result_view.h b/ui/app_list/search_result_view.h
new file mode 100644
index 0000000000000000000000000000000000000000..8d466f50fc65ca2ba113d92021db0e48e0e1c38d
--- /dev/null
+++ b/ui/app_list/search_result_view.h
@@ -0,0 +1,66 @@
+// Copyright (c) 2012 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 UI_APP_LIST_SEARCH_RESULT_VIEW_H_
+#define UI_APP_LIST_SEARCH_RESULT_VIEW_H_
+#pragma once
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "ui/views/controls/button/custom_button.h"
+
+namespace gfx {
+class RenderText;
+}
+
+namespace views {
+class ImageView;
+}
+
+namespace app_list {
+
+class SearchResult;
+class SearchResultListView;
+
+// SearchResultView displays a SearchResult.
+class SearchResultView : public views::CustomButton {
+ public:
+ // Internal class name.
+ static const char kViewClassName[];
+
+ SearchResultView(SearchResultListView* list_view,
+ views::ButtonListener* listener);
+ virtual ~SearchResultView();
+
+ // Sets/gets SearchResult displayed by this view.
+ void SetResult(const SearchResult* result);
+ const SearchResult* result() const { return result_; }
+
+ private:
+ void UpdateTitleText();
+ void UpdateDetailsText();
+
+ // views::View overrides:
+ virtual std::string GetClassName() const OVERRIDE;
+ virtual gfx::Size GetPreferredSize() OVERRIDE;
+ virtual void Layout() OVERRIDE;
+ virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
+
+ const SearchResult* result_;
+
+ // Parent list view. Owned by views hierarchy.
+ SearchResultListView* list_view_;
+
+ views::ImageView* icon_; // Owned by views hierarchy
+ scoped_ptr<gfx::RenderText> title_text_;
+ scoped_ptr<gfx::RenderText> details_text_;
+
+ DISALLOW_COPY_AND_ASSIGN(SearchResultView);
+};
+
+} // namespace app_list
+
+#endif // UI_APP_LIST_SEARCH_RESULT_VIEW_H_

Powered by Google App Engine
This is Rietveld 408576698