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

Side by Side Diff: chrome/browser/speech/speech_input_bubble_views.cc

Issue 8142026: Revert 104076 - Change std::wstring to string16 for views::Link (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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/speech/speech_input_bubble.h" 5 #include "chrome/browser/speech/speech_input_bubble.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 ContentView::ContentView(SpeechInputBubbleDelegate* delegate) 77 ContentView::ContentView(SpeechInputBubbleDelegate* delegate)
78 : delegate_(delegate), 78 : delegate_(delegate),
79 display_mode_(SpeechInputBubbleBase::DISPLAY_MODE_WARM_UP), 79 display_mode_(SpeechInputBubbleBase::DISPLAY_MODE_WARM_UP),
80 kIconLayoutMinWidth(ResourceBundle::GetSharedInstance().GetBitmapNamed( 80 kIconLayoutMinWidth(ResourceBundle::GetSharedInstance().GetBitmapNamed(
81 IDR_SPEECH_INPUT_MIC_EMPTY)->width()) { 81 IDR_SPEECH_INPUT_MIC_EMPTY)->width()) {
82 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 82 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
83 const gfx::Font& font = rb.GetFont(ResourceBundle::MediumFont); 83 const gfx::Font& font = rb.GetFont(ResourceBundle::MediumFont);
84 84
85 heading_ = new views::Label( 85 heading_ = new views::Label(
86 l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_BUBBLE_HEADING)); 86 UTF16ToWide(l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_BUBBLE_HEADING)));
87 heading_->set_border(views::Border::CreateEmptyBorder( 87 heading_->set_border(views::Border::CreateEmptyBorder(
88 kBubbleHeadingVertMargin, 0, kBubbleHeadingVertMargin, 0)); 88 kBubbleHeadingVertMargin, 0, kBubbleHeadingVertMargin, 0));
89 heading_->SetFont(font); 89 heading_->SetFont(font);
90 heading_->SetHorizontalAlignment(views::Label::ALIGN_CENTER); 90 heading_->SetHorizontalAlignment(views::Label::ALIGN_CENTER);
91 heading_->SetText( 91 heading_->SetText(UTF16ToWide(
92 l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_BUBBLE_HEADING)); 92 l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_BUBBLE_HEADING)));
93 AddChildView(heading_); 93 AddChildView(heading_);
94 94
95 message_ = new views::Label(); 95 message_ = new views::Label();
96 message_->SetFont(font); 96 message_->SetFont(font);
97 message_->SetHorizontalAlignment(views::Label::ALIGN_CENTER); 97 message_->SetHorizontalAlignment(views::Label::ALIGN_CENTER);
98 message_->SetMultiLine(true); 98 message_->SetMultiLine(true);
99 AddChildView(message_); 99 AddChildView(message_);
100 100
101 icon_ = new views::ImageView(); 101 icon_ = new views::ImageView();
102 icon_->SetHorizontalAlignment(views::ImageView::CENTER); 102 icon_->SetHorizontalAlignment(views::ImageView::CENTER);
103 AddChildView(icon_); 103 AddChildView(icon_);
104 104
105 cancel_ = new views::NativeTextButton( 105 cancel_ = new views::NativeTextButton(
106 this, 106 this,
107 UTF16ToWide(l10n_util::GetStringUTF16(IDS_CANCEL))); 107 UTF16ToWide(l10n_util::GetStringUTF16(IDS_CANCEL)));
108 AddChildView(cancel_); 108 AddChildView(cancel_);
109 109
110 try_again_ = new views::NativeTextButton( 110 try_again_ = new views::NativeTextButton(
111 this, 111 this,
112 UTF16ToWide(l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_TRY_AGAIN))); 112 UTF16ToWide(l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_TRY_AGAIN)));
113 AddChildView(try_again_); 113 AddChildView(try_again_);
114 114
115 mic_settings_ = new views::Link( 115 mic_settings_ = new views::Link(
116 l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_MIC_SETTINGS)); 116 UTF16ToWide(l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_MIC_SETTINGS)));
117 mic_settings_->set_listener(this); 117 mic_settings_->set_listener(this);
118 AddChildView(mic_settings_); 118 AddChildView(mic_settings_);
119 } 119 }
120 120
121 void ContentView::UpdateLayout(SpeechInputBubbleBase::DisplayMode mode, 121 void ContentView::UpdateLayout(SpeechInputBubbleBase::DisplayMode mode,
122 const string16& message_text, 122 const string16& message_text,
123 const SkBitmap& image) { 123 const SkBitmap& image) {
124 display_mode_ = mode; 124 display_mode_ = mode;
125 bool is_message = (mode == SpeechInputBubbleBase::DISPLAY_MODE_MESSAGE); 125 bool is_message = (mode == SpeechInputBubbleBase::DISPLAY_MODE_MESSAGE);
126 icon_->SetVisible(!is_message); 126 icon_->SetVisible(!is_message);
127 message_->SetVisible(is_message); 127 message_->SetVisible(is_message);
128 mic_settings_->SetVisible(is_message); 128 mic_settings_->SetVisible(is_message);
129 try_again_->SetVisible(is_message); 129 try_again_->SetVisible(is_message);
130 cancel_->SetVisible(mode != SpeechInputBubbleBase::DISPLAY_MODE_WARM_UP); 130 cancel_->SetVisible(mode != SpeechInputBubbleBase::DISPLAY_MODE_WARM_UP);
131 heading_->SetVisible(mode == SpeechInputBubbleBase::DISPLAY_MODE_RECORDING); 131 heading_->SetVisible(mode == SpeechInputBubbleBase::DISPLAY_MODE_RECORDING);
132 132
133 if (is_message) { 133 if (is_message) {
134 message_->SetText(message_text); 134 message_->SetText(UTF16ToWideHack(message_text));
135 } else { 135 } else {
136 SetImage(image); 136 SetImage(image);
137 } 137 }
138 138
139 if (icon_->IsVisible()) 139 if (icon_->IsVisible())
140 icon_->ResetImageSize(); 140 icon_->ResetImageSize();
141 141
142 // When moving from warming up to recording state, the size of the content 142 // When moving from warming up to recording state, the size of the content
143 // stays the same. So we wouldn't get a resize/layout call from the view 143 // stays the same. So we wouldn't get a resize/layout call from the view
144 // system and we do it ourselves. 144 // system and we do it ourselves.
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 } 395 }
396 396
397 } // namespace 397 } // namespace
398 398
399 SpeechInputBubble* SpeechInputBubble::CreateNativeBubble( 399 SpeechInputBubble* SpeechInputBubble::CreateNativeBubble(
400 TabContents* tab_contents, 400 TabContents* tab_contents,
401 SpeechInputBubble::Delegate* delegate, 401 SpeechInputBubble::Delegate* delegate,
402 const gfx::Rect& element_rect) { 402 const gfx::Rect& element_rect) {
403 return new SpeechInputBubbleImpl(tab_contents, delegate, element_rect); 403 return new SpeechInputBubbleImpl(tab_contents, delegate, element_rect);
404 } 404 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/options/wifi_config_view.cc ('k') | chrome/browser/ui/input_window_dialog_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698