summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-30 16:16:19 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-30 16:16:19 +0000
commita98396cd8879950b01602d5101b92a506baa1889 (patch)
tree59ecc9d68ac03a27997205c65cb33546c6d38de8
parente8bac552eec6672febd57c04058c3bd2e3d1279d (diff)
downloadchromium_src-a98396cd8879950b01602d5101b92a506baa1889.zip
chromium_src-a98396cd8879950b01602d5101b92a506baa1889.tar.gz
chromium_src-a98396cd8879950b01602d5101b92a506baa1889.tar.bz2
Use FilePath in UserDataDirDialog to remove the use of FilePath::FromWStringHack.
Patch by tfarina. BUG=None TEST=None Review URL: http://codereview.chromium.org/334017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30584 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/browser_main.cc3
-rw-r--r--chrome/browser/views/user_data_dir_dialog.cc10
-rw-r--r--chrome/browser/views/user_data_dir_dialog.h11
3 files changed, 12 insertions, 12 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 2cd48e4..df1947f 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -552,8 +552,7 @@ int BrowserMain(const MainFunctionParams& parameters) {
// prompt the user to pick a different user-data-dir and restart chrome
// with the new dir.
// http://code.google.com/p/chromium/issues/detail?id=11510
- user_data_dir = FilePath::FromWStringHack(
- UserDataDirDialog::RunUserDataDirDialog(user_data_dir.ToWStringHack()));
+ user_data_dir = UserDataDirDialog::RunUserDataDirDialog(user_data_dir);
if (!parameters.ui_task && browser_shutdown::delete_resources_on_shutdown) {
// Only delete the resources if we're not running tests. If we're running
// tests the resources need to be reused as many places in the UI cache
diff --git a/chrome/browser/views/user_data_dir_dialog.cc b/chrome/browser/views/user_data_dir_dialog.cc
index 70f9924..59a8a8a 100644
--- a/chrome/browser/views/user_data_dir_dialog.cc
+++ b/chrome/browser/views/user_data_dir_dialog.cc
@@ -13,20 +13,20 @@
#include "views/window/window.h"
// static
-std::wstring UserDataDirDialog::RunUserDataDirDialog(
- const std::wstring& user_data_dir) {
+FilePath UserDataDirDialog::RunUserDataDirDialog(
+ const FilePath& user_data_dir) {
// When the window closes, it will delete itself.
UserDataDirDialog* dlg = new UserDataDirDialog(user_data_dir);
MessageLoopForUI::current()->Run(dlg);
return dlg->user_data_dir();
}
-UserDataDirDialog::UserDataDirDialog(const std::wstring& user_data_dir)
+UserDataDirDialog::UserDataDirDialog(const FilePath& user_data_dir)
: ALLOW_THIS_IN_INITIALIZER_LIST(
select_file_dialog_(SelectFileDialog::Create(this))),
is_blocking_(true) {
std::wstring message_text = l10n_util::GetStringF(
- IDS_CANT_WRITE_USER_DIRECTORY_SUMMARY, user_data_dir);
+ IDS_CANT_WRITE_USER_DIRECTORY_SUMMARY, user_data_dir.ToWStringHack());
const int kDialogWidth = 400;
message_box_view_ = new MessageBoxView(MessageBoxFlags::kIsConfirmMessageBox,
message_text.c_str(), std::wstring(), kDialogWidth);
@@ -91,7 +91,7 @@ bool UserDataDirDialog::Dispatch(const MSG& msg) {
void UserDataDirDialog::FileSelected(const FilePath& path,
int index, void* params) {
- user_data_dir_ = path.ToWStringHack();
+ user_data_dir_ = path;
is_blocking_ = false;
}
diff --git a/chrome/browser/views/user_data_dir_dialog.h b/chrome/browser/views/user_data_dir_dialog.h
index 5e658c23..a4421d9 100644
--- a/chrome/browser/views/user_data_dir_dialog.h
+++ b/chrome/browser/views/user_data_dir_dialog.h
@@ -13,6 +13,7 @@
#include "chrome/browser/shell_dialogs.h"
#include "views/window/dialog_delegate.h"
+class FilePath;
class MessageBoxView;
namespace views {
class Window;
@@ -26,10 +27,10 @@ class UserDataDirDialog : public views::DialogDelegate,
// while the dialog is showing. If the user picks a directory, this method
// returns the chosen directory. |user_data_dir| is the value of the
// directory we were not able to use.
- static std::wstring RunUserDataDirDialog(const std::wstring& user_data_dir);
+ static FilePath RunUserDataDirDialog(const FilePath& user_data_dir);
virtual ~UserDataDirDialog();
- std::wstring user_data_dir() { return user_data_dir_; }
+ FilePath user_data_dir() const { return user_data_dir_; }
// views::DialogDelegate Methods:
virtual std::wstring GetDialogButtonLabel(
@@ -52,10 +53,10 @@ class UserDataDirDialog : public views::DialogDelegate,
virtual void FileSelectionCanceled(void* params);
private:
- explicit UserDataDirDialog(const std::wstring& user_data_dir);
+ explicit UserDataDirDialog(const FilePath& user_data_dir);
// Empty until the user picks a directory.
- std::wstring user_data_dir_;
+ FilePath user_data_dir_;
MessageBoxView* message_box_view_;
scoped_refptr<SelectFileDialog> select_file_dialog_;
@@ -64,7 +65,7 @@ class UserDataDirDialog : public views::DialogDelegate,
// waiting for the user to dismiss the dialog).
bool is_blocking_;
- DISALLOW_EVIL_CONSTRUCTORS(UserDataDirDialog);
+ DISALLOW_COPY_AND_ASSIGN(UserDataDirDialog);
};
#endif // CHROME_BROWSER_USER_DATA_DIR_DIALOG_H__