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

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

Issue 8113031: Change std::wstring to string16 for views::Label and views::Link (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 2 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 <vector>
8
7 #include "base/logging.h" 9 #include "base/logging.h"
8 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
9 #include "chrome/app/chrome_command_ids.h" 11 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/search_engines/template_url_service.h" 13 #include "chrome/browser/search_engines/template_url_service.h"
12 #include "chrome/browser/search_engines/template_url_service_factory.h" 14 #include "chrome/browser/search_engines/template_url_service_factory.h"
13 #include "grit/generated_resources.h" 15 #include "grit/generated_resources.h"
14 #include "grit/theme_resources.h" 16 #include "grit/theme_resources.h"
15 #include "third_party/skia/include/core/SkBitmap.h" 17 #include "third_party/skia/include/core/SkBitmap.h"
16 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 TemplateURLServiceFactory::GetForProfile(profile_); 60 TemplateURLServiceFactory::GetForProfile(profile_);
59 if (!url_service) 61 if (!url_service)
60 return; 62 return;
61 63
62 std::vector<size_t> content_param_offsets; 64 std::vector<size_t> content_param_offsets;
63 bool is_extension_keyword; 65 bool is_extension_keyword;
64 string16 short_name = url_service->GetKeywordShortName(keyword, 66 string16 short_name = url_service->GetKeywordShortName(keyword,
65 &is_extension_keyword); 67 &is_extension_keyword);
66 int message_id = is_extension_keyword ? 68 int message_id = is_extension_keyword ?
67 IDS_OMNIBOX_EXTENSION_KEYWORD_HINT : IDS_OMNIBOX_KEYWORD_HINT; 69 IDS_OMNIBOX_EXTENSION_KEYWORD_HINT : IDS_OMNIBOX_KEYWORD_HINT;
68 const std::wstring keyword_hint = 70 const string16 keyword_hint = l10n_util::GetStringFUTF16(
69 UTF16ToWide(l10n_util::GetStringFUTF16( 71 message_id,
70 message_id, 72 string16(),
71 string16(), 73 short_name,
72 short_name, 74 &content_param_offsets);
73 &content_param_offsets));
74 if (content_param_offsets.size() == 2) { 75 if (content_param_offsets.size() == 2) {
75 leading_label_->SetText( 76 leading_label_->SetText(
76 keyword_hint.substr(0, content_param_offsets.front())); 77 keyword_hint.substr(0, content_param_offsets.front()));
77 trailing_label_->SetText( 78 trailing_label_->SetText(
78 keyword_hint.substr(content_param_offsets.front())); 79 keyword_hint.substr(content_param_offsets.front()));
79 } else { 80 } else {
80 // See comments on an identical NOTREACHED() in search_provider.cc. 81 // See comments on an identical NOTREACHED() in search_provider.cc.
81 NOTREACHED(); 82 NOTREACHED();
82 } 83 }
83 } 84 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 127
127 if (show_labels) { 128 if (show_labels) {
128 pref = leading_label_->GetPreferredSize(); 129 pref = leading_label_->GetPreferredSize();
129 leading_label_->SetBounds(x, 0, pref.width(), height()); 130 leading_label_->SetBounds(x, 0, pref.width(), height());
130 131
131 x += pref.width() + kTabButtonBitmap->width(); 132 x += pref.width() + kTabButtonBitmap->width();
132 pref = trailing_label_->GetPreferredSize(); 133 pref = trailing_label_->GetPreferredSize();
133 trailing_label_->SetBounds(x, 0, pref.width(), height()); 134 trailing_label_->SetBounds(x, 0, pref.width(), height());
134 } 135 }
135 } 136 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698