summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/bookmarks/bookmark_folder_editor_controller.cc18
-rw-r--r--chrome/browser/bookmarks/bookmark_folder_editor_controller.h17
-rw-r--r--chrome/browser/ui/input_window_dialog.h15
-rw-r--r--chrome/browser/ui/input_window_dialog_gtk.cc17
-rw-r--r--chrome/browser/ui/input_window_dialog_win.cc23
5 files changed, 44 insertions, 46 deletions
diff --git a/chrome/browser/bookmarks/bookmark_folder_editor_controller.cc b/chrome/browser/bookmarks/bookmark_folder_editor_controller.cc
index eb456d0..f3a0a31 100644
--- a/chrome/browser/bookmarks/bookmark_folder_editor_controller.cc
+++ b/chrome/browser/bookmarks/bookmark_folder_editor_controller.cc
@@ -39,6 +39,8 @@ BookmarkFolderEditorController::BookmarkFolderEditorController(
is_new_(type == NEW_BOOKMARK) {
DCHECK(is_new_ || node);
+ model_->AddObserver(this);
+
string16 title = is_new_ ?
l10n_util::GetStringUTF16(IDS_BOOMARK_FOLDER_EDITOR_WINDOW_TITLE_NEW) :
l10n_util::GetStringUTF16(IDS_BOOMARK_FOLDER_EDITOR_WINDOW_TITLE);
@@ -48,25 +50,19 @@ BookmarkFolderEditorController::BookmarkFolderEditorController(
l10n_util::GetStringUTF16(IDS_BOOMARK_EDITOR_NEW_FOLDER_NAME) :
node_->GetTitle();
- dialog_ = InputWindowDialog::Create(wnd,
- UTF16ToWideHack(title),
- UTF16ToWideHack(label),
- UTF16ToWideHack(contents),
- this);
- model_->AddObserver(this);
-
+ dialog_ = InputWindowDialog::Create(wnd, title, label, contents, this);
dialog_->Show();
}
-bool BookmarkFolderEditorController::IsValid(const std::wstring& text) {
+bool BookmarkFolderEditorController::IsValid(const string16& text) {
return !text.empty();
}
-void BookmarkFolderEditorController::InputAccepted(const std::wstring& text) {
+void BookmarkFolderEditorController::InputAccepted(const string16& text) {
if (is_new_)
- model_->AddFolder(node_, index_, WideToUTF16Hack(text));
+ model_->AddFolder(node_, index_, text);
else
- model_->SetTitle(node_, WideToUTF16Hack(text));
+ model_->SetTitle(node_, text);
}
void BookmarkFolderEditorController::InputCanceled() {
diff --git a/chrome/browser/bookmarks/bookmark_folder_editor_controller.h b/chrome/browser/bookmarks/bookmark_folder_editor_controller.h
index ac24897..4935692 100644
--- a/chrome/browser/bookmarks/bookmark_folder_editor_controller.h
+++ b/chrome/browser/bookmarks/bookmark_folder_editor_controller.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 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.
@@ -7,6 +7,7 @@
#pragma once
#include "base/basictypes.h"
+#include "base/compiler_specific.h"
#include "chrome/browser/bookmarks/base_bookmark_model_observer.h"
#include "chrome/browser/ui/input_window_dialog.h"
#include "ui/gfx/native_widget_types.h"
@@ -40,14 +41,14 @@ class BookmarkFolderEditorController : public InputWindowDialog::Delegate,
int index,
Type type);
- // Overridden from InputWindowDialog::Delegate:
- virtual bool IsValid(const std::wstring& text);
- virtual void InputAccepted(const std::wstring& text);
- virtual void InputCanceled();
+ // InputWindowDialog::Delegate:
+ virtual bool IsValid(const string16& text) OVERRIDE;
+ virtual void InputAccepted(const string16& text) OVERRIDE;
+ virtual void InputCanceled() OVERRIDE;
- // Overridden from BaseBookmarkModelObserver:
- virtual void BookmarkModelChanged();
- virtual void BookmarkModelBeingDeleted(BookmarkModel* model);
+ // BaseBookmarkModelObserver:
+ virtual void BookmarkModelChanged() OVERRIDE;
+ virtual void BookmarkModelBeingDeleted(BookmarkModel* model) OVERRIDE;
Profile* profile_;
diff --git a/chrome/browser/ui/input_window_dialog.h b/chrome/browser/ui/input_window_dialog.h
index 1934b38..9509d68 100644
--- a/chrome/browser/ui/input_window_dialog.h
+++ b/chrome/browser/ui/input_window_dialog.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 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.
@@ -6,9 +6,8 @@
#define CHROME_BROWSER_UI_INPUT_WINDOW_DIALOG_H_
#pragma once
-#include <string>
-
#include "base/basictypes.h"
+#include "base/string16.h"
#include "ui/gfx/native_widget_types.h"
// Cross platform access to a modal input window.
@@ -19,10 +18,10 @@ class InputWindowDialog {
virtual ~Delegate() {}
// Checks whether |text| is a valid input string.
- virtual bool IsValid(const std::wstring& text) = 0;
+ virtual bool IsValid(const string16& text) = 0;
// Callback for when the user clicks the OK button.
- virtual void InputAccepted(const std::wstring& text) = 0;
+ virtual void InputAccepted(const string16& text) = 0;
// Callback for when the user clicks the Cancel button.
virtual void InputCanceled() = 0;
@@ -31,9 +30,9 @@ class InputWindowDialog {
// Creates a new input window dialog parented to |parent|. Ownership of
// |delegate| is taken by InputWindowDialog or InputWindowDialog's owner.
static InputWindowDialog* Create(gfx::NativeWindow parent,
- const std::wstring& window_title,
- const std::wstring& label,
- const std::wstring& contents,
+ const string16& window_title,
+ const string16& label,
+ const string16& contents,
Delegate* delegate);
// Displays the window.
diff --git a/chrome/browser/ui/input_window_dialog_gtk.cc b/chrome/browser/ui/input_window_dialog_gtk.cc
index f14c6b5..53bd5dc 100644
--- a/chrome/browser/ui/input_window_dialog_gtk.cc
+++ b/chrome/browser/ui/input_window_dialog_gtk.cc
@@ -8,7 +8,6 @@
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
-#include "base/string_piece.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/ui/gtk/gtk_util.h"
#include "ui/base/gtk/gtk_signal.h"
@@ -104,7 +103,7 @@ void InputWindowDialogGtk::Close() {
}
void InputWindowDialogGtk::OnEntryChanged(GtkEditable* entry) {
- std::wstring value(UTF8ToWide(gtk_entry_get_text(GTK_ENTRY(entry))));
+ string16 value(UTF8ToUTF16(gtk_entry_get_text(GTK_ENTRY(entry))));
gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog_),
GTK_RESPONSE_ACCEPT,
delegate_->IsValid(value));
@@ -112,7 +111,7 @@ void InputWindowDialogGtk::OnEntryChanged(GtkEditable* entry) {
void InputWindowDialogGtk::OnResponse(GtkWidget* dialog, int response_id) {
if (response_id == GTK_RESPONSE_ACCEPT) {
- std::wstring value(UTF8ToWide(gtk_entry_get_text(GTK_ENTRY(input_))));
+ string16 value(UTF8ToUTF16(gtk_entry_get_text(GTK_ENTRY(input_))));
delegate_->InputAccepted(value);
} else {
delegate_->InputCanceled();
@@ -135,13 +134,13 @@ void InputWindowDialogGtk::OnWindowDestroy(GtkWidget* widget) {
}
InputWindowDialog* InputWindowDialog::Create(gfx::NativeWindow parent,
- const std::wstring& window_title,
- const std::wstring& label,
- const std::wstring& contents,
+ const string16& window_title,
+ const string16& label,
+ const string16& contents,
Delegate* delegate) {
return new InputWindowDialogGtk(parent,
- WideToUTF8(window_title),
- WideToUTF8(label),
- WideToUTF8(contents),
+ UTF16ToUTF8(window_title),
+ UTF16ToUTF8(label),
+ UTF16ToUTF8(contents),
delegate);
}
diff --git a/chrome/browser/ui/input_window_dialog_win.cc b/chrome/browser/ui/input_window_dialog_win.cc
index 1075271..3c1cc88 100644
--- a/chrome/browser/ui/input_window_dialog_win.cc
+++ b/chrome/browser/ui/input_window_dialog_win.cc
@@ -7,6 +7,7 @@
#include "base/compiler_specific.h"
#include "base/message_loop.h"
#include "base/task.h"
+#include "base/utf_string_conversions.h"
#include "grit/generated_resources.h"
#include "views/controls/label.h"
#include "views/controls/textfield/textfield.h"
@@ -16,10 +17,12 @@
#include "views/widget/widget.h"
#include "views/window/dialog_delegate.h"
-// Width to make the text field, in pixels.
-static const int kTextfieldWidth = 200;
+namespace {
-class ContentView;
+// Width of the text field, in pixels.
+const int kTextfieldWidth = 200;
+
+} // namespace
namespace views {
class Widget;
@@ -68,7 +71,7 @@ class ContentView : public views::DialogDelegateView,
DCHECK(delegate_);
}
- // views::DialogDelegate:
+ // views::DialogDelegateView:
virtual bool IsDialogButtonEnabled(
MessageBoxFlags::DialogButton button) const;
virtual bool Accept();
@@ -228,13 +231,13 @@ void WinInputWindowDialog::Close() {
// static
InputWindowDialog* InputWindowDialog::Create(HWND parent,
- const std::wstring& window_title,
- const std::wstring& label,
- const std::wstring& contents,
+ const string16& window_title,
+ const string16& label,
+ const string16& contents,
Delegate* delegate) {
return new WinInputWindowDialog(parent,
- window_title,
- label,
- contents,
+ UTF16ToWide(window_title),
+ UTF16ToWide(label),
+ UTF16ToWide(contents),
delegate);
}