Chromium Code Reviews| 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..33b65db3353007b2e11f068cd17b9638ef7d84a5 |
| --- /dev/null |
| +++ b/chrome/browser/ui/cocoa/location_bar/search_token_decoration.h |
| @@ -0,0 +1,38 @@ |
| +// 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 set_search_provider_name(const string16& search_provider_name) { |
| + search_provider_name_ = search_provider_name; |
|
Scott Hess - ex-Googler
2013/01/29 23:28:37
Is there any value to storing the original search_
sail
2013/01/30 01:40:56
None really. I'd rather have it simply store the s
Scott Hess - ex-Googler
2013/01/30 23:48:42
Why I suggested is because this code never actuall
sail
2013/01/31 03:08:01
Done.
Ahh, scary. Changed to cache the attributed
|
| + } |
| + |
| + // Implement LocationBarDecoration: |
| + virtual void DrawInFrame(NSRect frame, NSView* control_view) OVERRIDE; |
| + virtual CGFloat GetWidthForSpace(CGFloat width, CGFloat text_width) 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_ |