OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/views/new_profile_dialog.h" | 5 #include "chrome/browser/views/new_profile_dialog.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/message_box_flags.h" | 10 #include "app/message_box_flags.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 views::View* NewProfileDialog::GetInitiallyFocusedView() { | 58 views::View* NewProfileDialog::GetInitiallyFocusedView() { |
59 views::Textfield* text_box = message_box_view_->text_box(); | 59 views::Textfield* text_box = message_box_view_->text_box(); |
60 DCHECK(text_box); | 60 DCHECK(text_box); |
61 return text_box; | 61 return text_box; |
62 } | 62 } |
63 | 63 |
64 bool NewProfileDialog::IsDialogButtonEnabled( | 64 bool NewProfileDialog::IsDialogButtonEnabled( |
65 MessageBoxFlags::DialogButton button) const { | 65 MessageBoxFlags::DialogButton button) const { |
66 if (button == MessageBoxFlags::DIALOGBUTTON_OK) { | 66 if (button == MessageBoxFlags::DIALOGBUTTON_OK) { |
67 std::wstring profile_name = message_box_view_->GetInputText(); | 67 std::wstring profile_name = message_box_view_->GetInputText(); |
68 // TODO(munjal): Refactor the function ReplaceIllegalCharacters in | 68 |
69 // file_util to something that just checks if there are illegal chars | 69 #if defined(OS_POSIX) |
70 // since that's what we really need. Also, replaceIllegalChars seems to | 70 std::string profile_name_narrow = WideToUTF8(profile_name); |
71 // be expensive since it builds a list of illegal characters for each call. | 71 file_util::ReplaceIllegalCharactersInPath(&profile_name_narrow, '_'); |
72 // So at the least fix that. | 72 profile_name = UTF8ToWide(profile_name_narrow); |
73 file_util::ReplaceIllegalCharacters(&profile_name, L'_'); | 73 #else |
| 74 file_util::ReplaceIllegalCharactersInPath(&profile_name, '_'); |
| 75 #endif |
74 return !profile_name.empty() && | 76 return !profile_name.empty() && |
75 profile_name == message_box_view_->GetInputText(); | 77 profile_name == message_box_view_->GetInputText(); |
76 } | 78 } |
77 return true; | 79 return true; |
78 } | 80 } |
79 | 81 |
80 std::wstring NewProfileDialog::GetWindowTitle() const { | 82 std::wstring NewProfileDialog::GetWindowTitle() const { |
81 return l10n_util::GetString(IDS_NEW_PROFILE_DIALOG_TITLE); | 83 return l10n_util::GetString(IDS_NEW_PROFILE_DIALOG_TITLE); |
82 } | 84 } |
83 | 85 |
(...skipping 17 matching lines...) Expand all Loading... |
101 UserDataManager::Get()->CreateDesktopShortcutForProfile( | 103 UserDataManager::Get()->CreateDesktopShortcutForProfile( |
102 profile_name); | 104 profile_name); |
103 | 105 |
104 UserDataManager::Get()->LaunchChromeForProfile(profile_name); | 106 UserDataManager::Get()->LaunchChromeForProfile(profile_name); |
105 return true; | 107 return true; |
106 } | 108 } |
107 | 109 |
108 views::View* NewProfileDialog::GetContentsView() { | 110 views::View* NewProfileDialog::GetContentsView() { |
109 return message_box_view_; | 111 return message_box_view_; |
110 } | 112 } |
OLD | NEW |