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

Unified Diff: chrome/browser/cocoa/location_bar_view_mac.mm

Issue 2078021: First pass at experimental omnibox API. There are plenty of rough edges and (Closed)
Patch Set: no prefer_keyword Created 10 years, 7 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_view_mac.mm
diff --git a/chrome/browser/cocoa/location_bar_view_mac.mm b/chrome/browser/cocoa/location_bar_view_mac.mm
index 5bca3f124eff75d0516d4a5187e747477a1ced6a..f339d1469bac0de672cd0c9b3e7c11569550d8c0 100644
--- a/chrome/browser/cocoa/location_bar_view_mac.mm
+++ b/chrome/browser/cocoa/location_bar_view_mac.mm
@@ -255,6 +255,7 @@ void LocationBarViewMac::OnChangedImpl(AutocompleteTextField* field,
const std::wstring& keyword,
const std::wstring& short_name,
const bool is_keyword_hint,
+ const bool is_extension_keyword,
NSImage* image) {
AutocompleteTextFieldCell* cell = [field autocompleteTextFieldCell];
const CGFloat availableWidth([field availableDecorationWidth]);
@@ -266,15 +267,15 @@ void LocationBarViewMac::OnChangedImpl(AutocompleteTextField* field,
const std::wstring min_name(CalculateMinString(short_name));
NSString* partial_string = nil;
+ int message_id = is_extension_keyword ?
+ IDS_OMNIBOX_EXTENSION_KEYWORD_TEXT : IDS_OMNIBOX_KEYWORD_TEXT;
if (!min_name.empty()) {
partial_string =
- l10n_util::GetNSStringF(IDS_OMNIBOX_KEYWORD_TEXT,
- WideToUTF16(min_name));
+ l10n_util::GetNSStringF(message_id, WideToUTF16(min_name));
}
NSString* keyword_string =
- l10n_util::GetNSStringF(IDS_OMNIBOX_KEYWORD_TEXT,
- WideToUTF16(short_name));
+ l10n_util::GetNSStringF(message_id, WideToUTF16(short_name));
[cell setKeywordString:keyword_string
partialString:partial_string
availableWidth:availableWidth];
@@ -283,8 +284,10 @@ void LocationBarViewMac::OnChangedImpl(AutocompleteTextField* field,
// is a parameter to be replaced by an image. "Engine" is a
// parameter to be replaced by text based on the keyword.
std::vector<size_t> content_param_offsets;
+ int message_id = is_extension_keyword ?
+ IDS_OMNIBOX_EXTENSION_KEYWORD_HINT : IDS_OMNIBOX_KEYWORD_HINT;
const std::wstring keyword_hint(
- l10n_util::GetStringF(IDS_OMNIBOX_KEYWORD_HINT,
+ l10n_util::GetStringF(message_id,
std::wstring(), short_name,
&content_param_offsets));
@@ -318,8 +321,10 @@ void LocationBarViewMac::OnChanged() {
// here where we have a Profile and pass it into OnChangedImpl().
const std::wstring keyword(edit_view_->model()->keyword());
std::wstring short_name;
+ bool is_extension_keyword = false;
if (!keyword.empty()) {
- short_name = GetKeywordName(profile_, keyword);
+ short_name = profile_->GetTemplateURLModel()->
+ GetKeywordShortName(keyword, &is_extension_keyword);
}
// TODO(shess): Implementation exported to a static so that it can
@@ -329,6 +334,7 @@ void LocationBarViewMac::OnChanged() {
keyword,
short_name,
edit_view_->model()->is_keyword_hint(),
+ is_extension_keyword,
GetTabButtonImage());
}
« no previous file with comments | « chrome/browser/cocoa/location_bar_view_mac.h ('k') | chrome/browser/cocoa/location_bar_view_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698