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

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..4cb6a70c22350c8aa42bdc8003582845098dc891
--- /dev/null
+++ b/chrome/browser/ui/cocoa/location_bar/search_token_decoration.h
@@ -0,0 +1,39 @@
+// 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".
Scott Hess - ex-Googler 2013/01/28 21:37:27 Is this going to replace KeywordHintDecoration?
sail 2013/01/29 22:31:08 No it won't. The search token is only shown for th
Scott Hess - ex-Googler 2013/01/29 23:28:36 Looking closer, it looks like this is exactly like
+class SearchTokenDecoration : public LocationBarDecoration {
+ public:
+ SearchTokenDecoration();
+ virtual ~SearchTokenDecoration();
+
+ void set_search_provider_name(const string16& search_provider_name) {
+ search_provider_name_ = search_provider_name;
+ }
+
+ // Implement LocationBarDecoration:
+ virtual void DrawInFrame(NSRect frame, NSView* control_view) OVERRIDE;
+ virtual CGFloat GetWidthForSpace(CGFloat width) OVERRIDE;
+ virtual bool ShouldAutoCollapse() const OVERRIDE;
+
+ private:
+ NSAttributedString* GetAttributedString() const;
+
+ string16 search_provider_name_;
+
+ 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