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

Unified Diff: chrome/browser/cocoa/location_bar/selected_keyword_decoration.h

Issue 2805070: [Mac] First part of Omnibox decoration refactor. Enable ev bubble. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: comment clarification Created 10 years, 5 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/cocoa/location_bar/selected_keyword_decoration.h
diff --git a/chrome/browser/cocoa/location_bar/selected_keyword_decoration.h b/chrome/browser/cocoa/location_bar/selected_keyword_decoration.h
new file mode 100644
index 0000000000000000000000000000000000000000..8df3ed77240cbe6da2f77fec52decd6630838538
--- /dev/null
+++ b/chrome/browser/cocoa/location_bar/selected_keyword_decoration.h
@@ -0,0 +1,39 @@
+// Copyright (c) 2010 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_COCOA_LOCATION_BAR_SELECTED_KEYWORD_DECORATION_H_
+#define CHROME_BROWSER_COCOA_LOCATION_BAR_SELECTED_KEYWORD_DECORATION_H_
+
+#include <string>
+
+#import <Cocoa/Cocoa.h>
+
+#include "chrome/browser/cocoa/location_bar/bubble_decoration.h"
+
+class SelectedKeywordDecoration : public BubbleDecoration {
+ public:
+ SelectedKeywordDecoration(NSFont* font);
+
+ // Calculates appropriate full and partial label strings based on
+ // inputs.
+ void SetKeyword(const std::wstring& keyword, bool is_extension_keyword);
+
+ // Determines what combination of labels and image will best fit
+ // within |width|, makes those current for |BubbleDecoration|, and
+ // return the resulting width.
+ virtual CGFloat GetWidthForSpace(CGFloat width);
+
+ private:
+ friend class SelectedKeywordDecorationTest;
+ FRIEND_TEST_ALL_PREFIXES(SelectedKeywordDecorationTest,
+ UsesPartialKeywordIfNarrow);
+
+ scoped_nsobject<NSImage> search_image_;
+ scoped_nsobject<NSString> full_string_;
+ scoped_nsobject<NSString> partial_string_;
+
+ DISALLOW_COPY_AND_ASSIGN(SelectedKeywordDecoration);
+};
+
+#endif // CHROME_BROWSER_COCOA_LOCATION_BAR_SELECTED_KEYWORD_DECORATION_H_

Powered by Google App Engine
This is Rietveld 408576698