summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-01 22:07:59 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-01 22:07:59 +0000
commitbc42505e55a9a0c0be7257474d9e67bc5eaf6aec (patch)
treea7e5e797a5c9123e104a51b833e60c8ef6568426
parent27812a9eb68a33fe9d94034de7c959d194a6538d (diff)
downloadchromium_src-bc42505e55a9a0c0be7257474d9e67bc5eaf6aec.zip
chromium_src-bc42505e55a9a0c0be7257474d9e67bc5eaf6aec.tar.gz
chromium_src-bc42505e55a9a0c0be7257474d9e67bc5eaf6aec.tar.bz2
views/examples: Make PrintStatus use char type instead wchar_t.
This avoids using the wstring versions of base::StringPrintf and base::StringAppendV. BUG=None TEST=None R=sky@chromium.org Review URL: http://codereview.chromium.org/7828010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99254 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--views/examples/button_example.cc2
-rw-r--r--views/examples/combobox_example.cc7
-rw-r--r--views/examples/example_base.cc4
-rw-r--r--views/examples/example_base.h4
-rw-r--r--views/examples/examples_main.cc5
-rw-r--r--views/examples/examples_main.h4
-rw-r--r--views/examples/link_example.cc2
-rw-r--r--views/examples/message_box_example.cc2
-rw-r--r--views/examples/native_theme_button_example.cc14
-rw-r--r--views/examples/native_theme_button_example.h2
-rw-r--r--views/examples/native_theme_checkbox_example.cc4
-rw-r--r--views/examples/radio_button_example.cc4
-rw-r--r--views/examples/tabbed_pane_example.cc2
-rw-r--r--views/examples/table2_example.cc2
-rw-r--r--views/examples/table_example.cc2
-rw-r--r--views/examples/textfield_example.cc6
16 files changed, 33 insertions, 33 deletions
diff --git a/views/examples/button_example.cc b/views/examples/button_example.cc
index e929858..dee6662e 100644
--- a/views/examples/button_example.cc
+++ b/views/examples/button_example.cc
@@ -38,7 +38,7 @@ void ButtonExample::CreateExampleView(views::View* container) {
void ButtonExample::ButtonPressed(views::Button* sender,
const views::Event& event) {
- PrintStatus(L"Pressed! count:%d", ++count_);
+ PrintStatus("Pressed! count:%d", ++count_);
if (event.IsControlDown()) {
if (event.IsShiftDown()) {
diff --git a/views/examples/combobox_example.cc b/views/examples/combobox_example.cc
index 6421384..ec711cd 100644
--- a/views/examples/combobox_example.cc
+++ b/views/examples/combobox_example.cc
@@ -21,7 +21,7 @@ class ComboboxModelExample : public ui::ComboboxModel {
// Overridden from ui::ComboboxModel:
virtual string16 GetItemAt(int index) OVERRIDE {
- return WideToUTF16Hack(base::StringPrintf(L"Item %d", index));
+ return UTF8ToUTF16(base::StringPrintf("Item %d", index));
}
private:
@@ -54,9 +54,8 @@ void ComboboxExample::CreateExampleView(views::View* container) {
void ComboboxExample::ItemChanged(views::Combobox* combo_box,
int prev_index,
int new_index) {
- PrintStatus(L"Selected: index=%d, label=%ls",
- new_index, UTF16ToWideHack(
- combo_box->model()->GetItemAt(new_index)).c_str());
+ PrintStatus("Selected: index=%d, label=%s",
+ new_index, UTF16ToUTF8(combo_box->model()->GetItemAt(new_index)).c_str());
}
} // namespace examples
diff --git a/views/examples/example_base.cc b/views/examples/example_base.cc
index 318d183..954c4af 100644
--- a/views/examples/example_base.cc
+++ b/views/examples/example_base.cc
@@ -61,10 +61,10 @@ ExampleBase::ExampleBase(ExamplesMain* main)
}
// Prints a message in the status area, at the bottom of the window.
-void ExampleBase::PrintStatus(const wchar_t* format, ...) {
+void ExampleBase::PrintStatus(const char* format, ...) {
va_list ap;
va_start(ap, format);
- std::wstring msg;
+ std::string msg;
base::StringAppendV(&msg, format, ap);
main_->SetStatus(msg);
}
diff --git a/views/examples/example_base.h b/views/examples/example_base.h
index d4e41bb..bc308a4 100644
--- a/views/examples/example_base.h
+++ b/views/examples/example_base.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -38,7 +38,7 @@ class ExampleBase {
virtual std::wstring GetExampleTitle() = 0;
// Prints a message in the status area, at the bottom of the window.
- void PrintStatus(const wchar_t* format, ...);
+ void PrintStatus(const char* format, ...);
// Converts an integer/boolean to wchat "on"/"off".
static const wchar_t* IntToOnOff(int value) {
diff --git a/views/examples/examples_main.cc b/views/examples/examples_main.cc
index a6da566..19e0ef2 100644
--- a/views/examples/examples_main.cc
+++ b/views/examples/examples_main.cc
@@ -8,6 +8,7 @@
#include "base/command_line.h"
#include "base/i18n/icu_util.h"
#include "base/process_util.h"
+#include "base/utf_string_conversions.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_paths.h"
#include "views/controls/button/text_button.h"
@@ -65,8 +66,8 @@ const views::Widget* ExamplesMain::GetWidget() const {
return contents_->GetWidget();
}
-void ExamplesMain::SetStatus(const std::wstring& status) {
- status_label_->SetText(status);
+void ExamplesMain::SetStatus(const std::string& status) {
+ status_label_->SetText(UTF8ToWide(status));
}
void ExamplesMain::Run() {
diff --git a/views/examples/examples_main.h b/views/examples/examples_main.h
index ce2124d..5998e04 100644
--- a/views/examples/examples_main.h
+++ b/views/examples/examples_main.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -32,7 +32,7 @@ class ExamplesMain : public views::WidgetDelegate {
virtual const views::Widget* GetWidget() const OVERRIDE;
// Prints a message in the status area, at the bottom of the window.
- void SetStatus(const std::wstring& status);
+ void SetStatus(const std::string& status);
// Creates all examples and runs the UI event loop.
void Run();
diff --git a/views/examples/link_example.cc b/views/examples/link_example.cc
index 458701a..6f4411b 100644
--- a/views/examples/link_example.cc
+++ b/views/examples/link_example.cc
@@ -29,7 +29,7 @@ void LinkExample::CreateExampleView(views::View* container) {
}
void LinkExample::LinkClicked(views::Link* source, int event_flags) {
- PrintStatus(L"Link clicked");
+ PrintStatus("Link clicked");
}
} // namespace examples
diff --git a/views/examples/message_box_example.cc b/views/examples/message_box_example.cc
index f6e8ddb..ae314e7 100644
--- a/views/examples/message_box_example.cc
+++ b/views/examples/message_box_example.cc
@@ -58,7 +58,7 @@ void MessageBoxExample::ButtonPressed(views::Button* sender,
message_box_view_->SetCheckBoxLabel(
IntToOnOff(message_box_view_->IsCheckBoxSelected()));
PrintStatus(message_box_view_->IsCheckBoxSelected() ?
- L"Check Box Selected" : L"Check Box Not Selected");
+ "Check Box Selected" : "Check Box Not Selected");
} else if (sender == toggle_) {
message_box_view_->SetCheckBoxSelected(
!message_box_view_->IsCheckBoxSelected());
diff --git a/views/examples/native_theme_button_example.cc b/views/examples/native_theme_button_example.cc
index 1b20281..1b71d2f 100644
--- a/views/examples/native_theme_button_example.cc
+++ b/views/examples/native_theme_button_example.cc
@@ -11,8 +11,8 @@
#include "ui/base/models/combobox_model.h"
#include "ui/gfx/canvas.h"
#include "views/controls/label.h"
-#include "views/native_theme_painter.h"
#include "views/layout/grid_layout.h"
+#include "views/native_theme_painter.h"
namespace {
@@ -84,15 +84,15 @@ ExampleNativeThemeButton::ExampleNativeThemeButton(
ExampleNativeThemeButton::~ExampleNativeThemeButton() {
}
-std::wstring ExampleNativeThemeButton::MessWithState() {
- const wchar_t* message = NULL;
+std::string ExampleNativeThemeButton::MessWithState() {
+ const char* message = NULL;
switch(GetThemePart()) {
case gfx::NativeTheme::kPushButton:
- message = L"Pressed! count:%d";
+ message = "Pressed! count:%d";
break;
case gfx::NativeTheme::kRadio:
is_checked_ = !is_checked_;
- message = is_checked_ ? L"Checked! count:%d" : L"Unchecked! count:%d";
+ message = is_checked_ ? "Checked! count:%d" : "Unchecked! count:%d";
break;
case gfx::NativeTheme::kCheckbox:
if (is_indeterminate_) {
@@ -105,8 +105,8 @@ std::wstring ExampleNativeThemeButton::MessWithState() {
is_indeterminate_ = true;
}
- message = is_checked_ ? L"Checked! count:%d" :
- is_indeterminate_ ? L"Indeterminate! count:%d" : L"Unchecked! count:%d";
+ message = is_checked_ ? "Checked! count:%d" :
+ is_indeterminate_ ? "Indeterminate! count:%d" : "Unchecked! count:%d";
break;
default:
DCHECK(false);
diff --git a/views/examples/native_theme_button_example.h b/views/examples/native_theme_button_example.h
index bf37849d..06b0f57 100644
--- a/views/examples/native_theme_button_example.h
+++ b/views/examples/native_theme_button_example.h
@@ -31,7 +31,7 @@ class ExampleNativeThemeButton : public views::CustomButton,
views::Combobox* cb_state);
virtual ~ExampleNativeThemeButton();
- std::wstring MessWithState();
+ std::string MessWithState();
private:
// Overridden from View:
diff --git a/views/examples/native_theme_checkbox_example.cc b/views/examples/native_theme_checkbox_example.cc
index 57b3f40..b3306da 100644
--- a/views/examples/native_theme_checkbox_example.cc
+++ b/views/examples/native_theme_checkbox_example.cc
@@ -31,8 +31,8 @@ void NativeThemeCheckboxExample::CreateExampleView(views::View* container) {
}
void NativeThemeCheckboxExample::ButtonPressed(views::Button* sender,
- const views::Event& event) {
- PrintStatus(base::StringPrintf(L"Pressed! count:%d", ++count_).c_str());
+ const views::Event& event) {
+ PrintStatus(base::StringPrintf("Pressed! count:%d", ++count_).c_str());
}
} // namespace examples
diff --git a/views/examples/radio_button_example.cc b/views/examples/radio_button_example.cc
index a8be3c0..1dc4c45 100644
--- a/views/examples/radio_button_example.cc
+++ b/views/examples/radio_button_example.cc
@@ -55,12 +55,12 @@ void RadioButtonExample::ButtonPressed(views::Button* sender,
radio_buttons_[2]->SetChecked(true);
} else if (sender == status_) {
// Show the state of radio buttons.
- PrintStatus(L"Group: 1:%ls, 2:%ls, 3:%ls",
+ PrintStatus("Group: 1:%ls, 2:%ls, 3:%ls",
IntToOnOff(radio_buttons_[0]->checked()),
IntToOnOff(radio_buttons_[1]->checked()),
IntToOnOff(radio_buttons_[2]->checked()));
} else {
- PrintStatus(L"Pressed! count:%d", ++count_);
+ PrintStatus("Pressed! count:%d", ++count_);
}
}
diff --git a/views/examples/tabbed_pane_example.cc b/views/examples/tabbed_pane_example.cc
index fd290a9..3e59476 100644
--- a/views/examples/tabbed_pane_example.cc
+++ b/views/examples/tabbed_pane_example.cc
@@ -81,7 +81,7 @@ void TabbedPaneExample::TabSelectedAt(int index) {
}
void TabbedPaneExample::PrintStatus() {
- ExampleBase::PrintStatus(L"Tab Count:%d, Selected Tab:%d",
+ ExampleBase::PrintStatus("Tab Count:%d, Selected Tab:%d",
tabbed_pane_->GetTabCount(),
tabbed_pane_->GetSelectedTabIndex());
}
diff --git a/views/examples/table2_example.cc b/views/examples/table2_example.cc
index 70d6374..d197528 100644
--- a/views/examples/table2_example.cc
+++ b/views/examples/table2_example.cc
@@ -133,7 +133,7 @@ void Table2Example::ButtonPressed(views::Button* sender,
}
void Table2Example::OnSelectionChanged() {
- PrintStatus(L"Selection changed: %d", table_->GetFirstSelectedRow());
+ PrintStatus("Selection changed: %d", table_->GetFirstSelectedRow());
}
void Table2Example::OnDoubleClick() {
diff --git a/views/examples/table_example.cc b/views/examples/table_example.cc
index b2f6f78..b653459 100644
--- a/views/examples/table_example.cc
+++ b/views/examples/table_example.cc
@@ -101,7 +101,7 @@ SkBitmap TableExample::GetIcon(int row) {
void TableExample::SetObserver(ui::TableModelObserver* observer) {}
void TableExample::OnSelectionChanged() {
- PrintStatus(L"Selection changed");
+ PrintStatus("Selection changed");
}
void TableExample::OnDoubleClick() {}
diff --git a/views/examples/textfield_example.cc b/views/examples/textfield_example.cc
index af0f2b9..562b59a 100644
--- a/views/examples/textfield_example.cc
+++ b/views/examples/textfield_example.cc
@@ -66,9 +66,9 @@ void TextfieldExample::CreateExampleView(views::View* container) {
void TextfieldExample::ContentsChanged(views::Textfield* sender,
const string16& new_contents) {
if (sender == name_) {
- PrintStatus(L"Name [%ls]", UTF16ToWideHack(new_contents).c_str());
+ PrintStatus("Name [%s]", UTF16ToUTF8(new_contents).c_str());
} else if (sender == password_) {
- PrintStatus(L"Password [%ls]", UTF16ToWideHack(new_contents).c_str());
+ PrintStatus("Password [%s]", UTF16ToUTF8(new_contents).c_str());
}
}
@@ -80,7 +80,7 @@ bool TextfieldExample::HandleKeyEvent(views::Textfield* sender,
void TextfieldExample::ButtonPressed(views::Button* sender,
const views::Event& event) {
if (sender == show_password_) {
- PrintStatus(L"Password [%ls]", UTF16ToWideHack(password_->text()).c_str());
+ PrintStatus("Password [%s]", UTF16ToUTF8(password_->text()).c_str());
} else if (sender == clear_all_) {
string16 empty;
name_->SetText(empty);