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

Unified Diff: chrome/browser/ui/views/location_bar/search_token_view.h

Issue 11418229: alternate ntp: implement right-aligned search token (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: prev was rebased, this changes copyright year Created 8 years 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: chrome/browser/ui/views/location_bar/search_token_view.h
diff --git a/chrome/browser/ui/views/location_bar/search_token_view.h b/chrome/browser/ui/views/location_bar/search_token_view.h
new file mode 100644
index 0000000000000000000000000000000000000000..d983b064b6ff63d91c6005d275d41e2fd185cb25
--- /dev/null
+++ b/chrome/browser/ui/views/location_bar/search_token_view.h
@@ -0,0 +1,52 @@
+// 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 CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_SEARCH_TOKEN_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_SEARCH_TOKEN_VIEW_H_
+
+#include "base/compiler_specific.h"
+#include "ui/gfx/size.h"
+#include "ui/views/view.h"
+
+class LocationBarView;
+
Peter Kasting 2012/12/17 21:01:00 Nit: I'd leave these two blank lines out.
kuan 2012/12/20 00:26:14 Done.
+namespace gfx {
+class Font;
+}
+
+namespace views {
+class Label;
+}
+
+// SearchTokenView is used by the location bar view to display a search token to
+// the user when the omnibox replaces the url with its query terms.
+// Internally SearchTokenView uses a label to render the text, and draws the
+// right border that serves as a divider between itself and the icons to its
+// right.
+class SearchTokenView : public views::View {
+ public:
+ explicit SearchTokenView(const LocationBarView* location_bar_view);
+ virtual ~SearchTokenView();
+
+ void SetFont(const gfx::Font& font);
+
+ void SetSearchProvider(const string16& search_provider);
+
+ bool HasSearchProvider() const {
Peter Kasting 2012/12/17 21:01:00 Inline functions must be named unix_hacker()-style
kuan 2012/12/20 00:26:14 Done.
+ return !search_provider_.empty();
+ }
+
+ virtual gfx::Size GetPreferredSize() OVERRIDE;
+ virtual void Layout() OVERRIDE;
+ virtual void OnPaintBorder(gfx::Canvas* canvas) OVERRIDE;
+
+ private:
+ views::Label* label_;
+ string16 search_provider_;
+ SkColor border_color_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(SearchTokenView);
Peter Kasting 2012/12/17 21:01:00 Nit: This should be DISALLOW_COPY_AND_ASSIGN.
kuan 2012/12/20 00:26:14 Done.
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_SEARCH_TOKEN_VIEW_H_

Powered by Google App Engine
This is Rietveld 408576698