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

Unified Diff: chrome/browser/ui/cocoa/location_bar/search_token_decoration.h

Issue 12042002: Alternate NTP: Add search token to omnibox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments Created 7 years, 11 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: chrome/browser/ui/cocoa/location_bar/search_token_decoration.h
diff --git a/chrome/browser/ui/cocoa/location_bar/search_token_decoration.h b/chrome/browser/ui/cocoa/location_bar/search_token_decoration.h
new file mode 100644
index 0000000000000000000000000000000000000000..ee63740537f2b7880c4b77879094ea25e37664bb
--- /dev/null
+++ b/chrome/browser/ui/cocoa/location_bar/search_token_decoration.h
@@ -0,0 +1,35 @@
+// Copyright (c) 2013 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_COCOA_LOCATION_BAR_SEARCH_TOKEN_DECORATION_H_
+#define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_SEARCH_TOKEN_DECORATION_H_
+
+#import "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h"
+
+#import "base/memory/scoped_nsobject.h"
+#include "base/string16.h"
+
+// This class is used to draw a label on the right side of the omnibox when
+// the user does a search. For example, if the default search provider is
+// google.com and the user does a search then the decoration would display
+// "Google Search".
+class SearchTokenDecoration : public LocationBarDecoration {
+ public:
+ SearchTokenDecoration();
+ virtual ~SearchTokenDecoration();
+
+ void SetSearchProviderName(const string16& search_provider_name);
+
+ // Implement LocationBarDecoration:
+ virtual void DrawInFrame(NSRect frame, NSView* control_view) OVERRIDE;
+ virtual CGFloat GetWidthForSpace(CGFloat width, CGFloat text_width) OVERRIDE;
+
+ private:
+ string16 search_provider_name_;
+ scoped_nsobject<NSAttributedString> search_provider_attributed_string_;
+
+ DISALLOW_COPY_AND_ASSIGN(SearchTokenDecoration);
+};
+
+#endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_SEARCH_TOKEN_DECORATION_H_

Powered by Google App Engine
This is Rietveld 408576698