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

Side by Side Diff: chrome/browser/ui/views/location_bar/keyword_hint_view.cc

Issue 6291003: Revert 71485 - Remove wstring from TemplateURL and friends.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" 5 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 void KeywordHintView::SetKeyword(const std::wstring& keyword) { 51 void KeywordHintView::SetKeyword(const std::wstring& keyword) {
52 keyword_ = keyword; 52 keyword_ = keyword;
53 if (keyword_.empty()) 53 if (keyword_.empty())
54 return; 54 return;
55 DCHECK(profile_); 55 DCHECK(profile_);
56 if (!profile_->GetTemplateURLModel()) 56 if (!profile_->GetTemplateURLModel())
57 return; 57 return;
58 58
59 std::vector<size_t> content_param_offsets; 59 std::vector<size_t> content_param_offsets;
60 bool is_extension_keyword; 60 bool is_extension_keyword;
61 string16 short_name = profile_->GetTemplateURLModel()-> 61 std::wstring short_name = profile_->GetTemplateURLModel()->
62 GetKeywordShortName(WideToUTF16Hack(keyword), &is_extension_keyword); 62 GetKeywordShortName(keyword, &is_extension_keyword);
63 int message_id = is_extension_keyword ? 63 int message_id = is_extension_keyword ?
64 IDS_OMNIBOX_EXTENSION_KEYWORD_HINT : IDS_OMNIBOX_KEYWORD_HINT; 64 IDS_OMNIBOX_EXTENSION_KEYWORD_HINT : IDS_OMNIBOX_KEYWORD_HINT;
65 const std::wstring keyword_hint = 65 const std::wstring keyword_hint =
66 UTF16ToWide(l10n_util::GetStringFUTF16( 66 UTF16ToWide(l10n_util::GetStringFUTF16(
67 message_id, 67 message_id,
68 string16(), 68 string16(),
69 short_name, 69 WideToUTF16(short_name),
70 &content_param_offsets)); 70 &content_param_offsets));
71 if (content_param_offsets.size() == 2) { 71 if (content_param_offsets.size() == 2) {
72 leading_label_->SetText( 72 leading_label_->SetText(
73 keyword_hint.substr(0, content_param_offsets.front())); 73 keyword_hint.substr(0, content_param_offsets.front()));
74 trailing_label_->SetText( 74 trailing_label_->SetText(
75 keyword_hint.substr(content_param_offsets.front())); 75 keyword_hint.substr(content_param_offsets.front()));
76 } else { 76 } else {
77 // See comments on an identical NOTREACHED() in search_provider.cc. 77 // See comments on an identical NOTREACHED() in search_provider.cc.
78 NOTREACHED(); 78 NOTREACHED();
79 } 79 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 if (show_labels) { 124 if (show_labels) {
125 pref = leading_label_->GetPreferredSize(); 125 pref = leading_label_->GetPreferredSize();
126 leading_label_->SetBounds(x, 0, pref.width(), height()); 126 leading_label_->SetBounds(x, 0, pref.width(), height());
127 127
128 x += pref.width() + kTabButtonBitmap->width(); 128 x += pref.width() + kTabButtonBitmap->width();
129 pref = trailing_label_->GetPreferredSize(); 129 pref = trailing_label_->GetPreferredSize();
130 trailing_label_->SetBounds(x, 0, pref.width(), height()); 130 trailing_label_->SetBounds(x, 0, pref.width(), height());
131 } 131 }
132 } 132 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/omnibox/location_bar_util.cc ('k') | chrome/browser/ui/views/location_bar/location_bar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698