| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_COCOA_LOCATION_BAR_KEYWORD_HINT_DECORATION_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_LOCATION_BAR_KEYWORD_HINT_DECORATION_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_KEYWORD_HINT_DECORATION_H_ | 6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_KEYWORD_HINT_DECORATION_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #import "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h" | 10 #import "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h" |
| 11 | 11 |
| 12 #import "base/memory/scoped_nsobject.h" | 12 #import "base/mac/scoped_nsobject.h" |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 | 14 |
| 15 // Draws the keyword hint, "Press [tab] to search <site>". | 15 // Draws the keyword hint, "Press [tab] to search <site>". |
| 16 | 16 |
| 17 class KeywordHintDecoration : public LocationBarDecoration { | 17 class KeywordHintDecoration : public LocationBarDecoration { |
| 18 public: | 18 public: |
| 19 KeywordHintDecoration(); | 19 KeywordHintDecoration(); |
| 20 virtual ~KeywordHintDecoration(); | 20 virtual ~KeywordHintDecoration(); |
| 21 | 21 |
| 22 // Calculates the message to display and where to place the [tab] | 22 // Calculates the message to display and where to place the [tab] |
| 23 // image. | 23 // image. |
| 24 void SetKeyword(const string16& keyword, bool is_extension_keyword); | 24 void SetKeyword(const string16& keyword, bool is_extension_keyword); |
| 25 | 25 |
| 26 // Implement |LocationBarDecoration|. | 26 // Implement |LocationBarDecoration|. |
| 27 virtual void DrawInFrame(NSRect frame, NSView* control_view) OVERRIDE; | 27 virtual void DrawInFrame(NSRect frame, NSView* control_view) OVERRIDE; |
| 28 virtual CGFloat GetWidthForSpace(CGFloat width) OVERRIDE; | 28 virtual CGFloat GetWidthForSpace(CGFloat width) OVERRIDE; |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 // Fetch and cache the [tab] image. | 31 // Fetch and cache the [tab] image. |
| 32 NSImage* GetHintImage(); | 32 NSImage* GetHintImage(); |
| 33 | 33 |
| 34 // Attributes for drawing the hint string, such as font and color. | 34 // Attributes for drawing the hint string, such as font and color. |
| 35 scoped_nsobject<NSDictionary> attributes_; | 35 base::scoped_nsobject<NSDictionary> attributes_; |
| 36 | 36 |
| 37 // Cache for the [tab] image. | 37 // Cache for the [tab] image. |
| 38 scoped_nsobject<NSImage> hint_image_; | 38 base::scoped_nsobject<NSImage> hint_image_; |
| 39 | 39 |
| 40 // The text to display to the left and right of the hint image. | 40 // The text to display to the left and right of the hint image. |
| 41 scoped_nsobject<NSString> hint_prefix_; | 41 base::scoped_nsobject<NSString> hint_prefix_; |
| 42 scoped_nsobject<NSString> hint_suffix_; | 42 base::scoped_nsobject<NSString> hint_suffix_; |
| 43 | 43 |
| 44 DISALLOW_COPY_AND_ASSIGN(KeywordHintDecoration); | 44 DISALLOW_COPY_AND_ASSIGN(KeywordHintDecoration); |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_KEYWORD_HINT_DECORATION_H_ | 47 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_KEYWORD_HINT_DECORATION_H_ |
| OLD | NEW |