parent
3b183854ff
commit
2d3c65beca
31 changed files with 200 additions and 152 deletions
|
@ -118,10 +118,10 @@ static void ApplySettings(IFileDialog* dialog, const DialogSettings& settings) {
|
|||
dialog->SetFileName(file_part.c_str());
|
||||
|
||||
if (!settings.title.empty())
|
||||
dialog->SetTitle(base::UTF8ToUTF16(settings.title).c_str());
|
||||
dialog->SetTitle(base::UTF8ToWide(settings.title).c_str());
|
||||
|
||||
if (!settings.button_label.empty())
|
||||
dialog->SetOkButtonLabel(base::UTF8ToUTF16(settings.button_label).c_str());
|
||||
dialog->SetOkButtonLabel(base::UTF8ToWide(settings.button_label).c_str());
|
||||
|
||||
std::vector<std::wstring> buffer;
|
||||
std::vector<COMDLG_FILTERSPEC> filterspec;
|
||||
|
|
|
@ -39,8 +39,8 @@ struct CommonButtonID {
|
|||
int button;
|
||||
int id;
|
||||
};
|
||||
CommonButtonID GetCommonID(const std::u16string& button) {
|
||||
std::u16string lower = base::ToLowerASCII(button);
|
||||
CommonButtonID GetCommonID(const std::wstring& button) {
|
||||
std::wstring lower = base::ToLowerASCII(button);
|
||||
if (lower == L"ok")
|
||||
return {TDCBF_OK_BUTTON, IDOK};
|
||||
else if (lower == L"yes")
|
||||
|
@ -63,15 +63,15 @@ void MapToCommonID(const std::vector<std::u16string>& buttons,
|
|||
TASKDIALOG_COMMON_BUTTON_FLAGS* button_flags,
|
||||
std::vector<TASKDIALOG_BUTTON>* dialog_buttons) {
|
||||
for (size_t i = 0; i < buttons.size(); ++i) {
|
||||
auto common = GetCommonID(buttons[i]);
|
||||
auto common = GetCommonID(base::UTF16ToWide(buttons[i]));
|
||||
if (common.button != -1) {
|
||||
// It is a common button.
|
||||
(*id_map)[common.id] = i;
|
||||
(*button_flags) |= common.button;
|
||||
} else {
|
||||
// It is a custom button.
|
||||
dialog_buttons->push_back(
|
||||
{static_cast<int>(i + kIDStart), buttons[i].c_str()});
|
||||
dialog_buttons->push_back({static_cast<int>(i + kIDStart),
|
||||
base::UTF16ToWide(buttons[i]).c_str()});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -107,11 +107,11 @@ DialogResult ShowTaskDialogUTF16(NativeWindow* parent,
|
|||
|
||||
// TaskDialogIndirect doesn't allow empty name, if we set empty title it
|
||||
// will show "electron.exe" in title.
|
||||
std::u16string app_name = base::UTF8ToUTF16(Browser::Get()->GetName());
|
||||
std::wstring app_name = base::UTF8ToWide(Browser::Get()->GetName());
|
||||
if (title.empty())
|
||||
config.pszWindowTitle = app_name.c_str();
|
||||
else
|
||||
config.pszWindowTitle = title.c_str();
|
||||
config.pszWindowTitle = base::UTF16ToWide(title).c_str();
|
||||
|
||||
base::win::ScopedHICON hicon;
|
||||
if (!icon.isNull()) {
|
||||
|
@ -138,14 +138,14 @@ DialogResult ShowTaskDialogUTF16(NativeWindow* parent,
|
|||
|
||||
// If "detail" is empty then don't make message highlighted.
|
||||
if (detail.empty()) {
|
||||
config.pszContent = message.c_str();
|
||||
config.pszContent = base::UTF16ToWide(message).c_str();
|
||||
} else {
|
||||
config.pszMainInstruction = message.c_str();
|
||||
config.pszContent = detail.c_str();
|
||||
config.pszMainInstruction = base::UTF16ToWide(message).c_str();
|
||||
config.pszContent = base::UTF16ToWide(detail).c_str();
|
||||
}
|
||||
|
||||
if (!checkbox_label.empty()) {
|
||||
config.pszVerificationText = checkbox_label.c_str();
|
||||
config.pszVerificationText = base::UTF16ToWide(checkbox_label).c_str();
|
||||
if (checkbox_checked)
|
||||
config.dwFlags |= TDF_VERIFICATION_FLAG_CHECKED;
|
||||
}
|
||||
|
@ -156,8 +156,8 @@ DialogResult ShowTaskDialogUTF16(NativeWindow* parent,
|
|||
std::vector<TASKDIALOG_BUTTON> dialog_buttons;
|
||||
if (no_link) {
|
||||
for (size_t i = 0; i < buttons.size(); ++i)
|
||||
dialog_buttons.push_back(
|
||||
{static_cast<int>(i + kIDStart), buttons[i].c_str()});
|
||||
dialog_buttons.push_back({static_cast<int>(i + kIDStart),
|
||||
base::UTF16ToWide(buttons[i]).c_str()});
|
||||
} else {
|
||||
MapToCommonID(buttons, &id_map, &config.dwCommonButtons, &dialog_buttons);
|
||||
}
|
||||
|
@ -222,7 +222,8 @@ void ShowMessageBox(const MessageBoxSettings& settings,
|
|||
void ShowErrorBox(const std::u16string& title, const std::u16string& content) {
|
||||
electron::UnresponsiveSuppressor suppressor;
|
||||
ShowTaskDialogUTF16(nullptr, MessageBoxType::kError, {}, -1, 0, false,
|
||||
L"Error", title, content, L"", false, gfx::ImageSkia());
|
||||
base::UTF8ToUTF16("Error"), title, content,
|
||||
base::UTF8ToUTF16(""), false, gfx::ImageSkia());
|
||||
}
|
||||
|
||||
} // namespace electron
|
||||
|
|
|
@ -158,7 +158,7 @@ JumpListCategory::JumpListCategory() = default;
|
|||
JumpListCategory::JumpListCategory(const JumpListCategory&) = default;
|
||||
JumpListCategory::~JumpListCategory() = default;
|
||||
|
||||
JumpList::JumpList(const std::u16string& app_id) : app_id_(app_id) {
|
||||
JumpList::JumpList(const std::wstring& app_id) : app_id_(app_id) {
|
||||
destinations_.CoCreateInstance(CLSID_DestinationList);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,9 +46,9 @@ struct JumpListItem {
|
|||
// For tasks this is the path to the program executable, for file links this
|
||||
// is the full filename.
|
||||
base::FilePath path;
|
||||
std::u16string arguments;
|
||||
std::u16string title;
|
||||
std::u16string description;
|
||||
std::wstring arguments;
|
||||
std::wstring title;
|
||||
std::wstring description;
|
||||
base::FilePath working_dir;
|
||||
base::FilePath icon_path;
|
||||
int icon_index = 0;
|
||||
|
@ -73,7 +73,7 @@ struct JumpListCategory {
|
|||
};
|
||||
|
||||
Type type = Type::kTasks;
|
||||
std::u16string name;
|
||||
std::wstring name;
|
||||
std::vector<JumpListItem> items;
|
||||
|
||||
JumpListCategory();
|
||||
|
@ -88,7 +88,7 @@ class JumpList {
|
|||
// |app_id| must be the Application User Model ID of the app for which the
|
||||
// custom Jump List should be created/removed, it's usually obtained by
|
||||
// calling GetCurrentProcessExplicitAppUserModelID().
|
||||
explicit JumpList(const std::u16string& app_id);
|
||||
explicit JumpList(const std::wstring& app_id);
|
||||
~JumpList();
|
||||
|
||||
// Starts a new transaction, must be called before appending any categories,
|
||||
|
@ -111,7 +111,7 @@ class JumpList {
|
|||
const std::vector<JumpListCategory>& categories);
|
||||
|
||||
private:
|
||||
std::u16string app_id_;
|
||||
std::wstring app_id_;
|
||||
CComPtr<ICustomDestinationList> destinations_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(JumpList);
|
||||
|
|
|
@ -141,7 +141,7 @@ void NotifyIcon::SetToolTip(const std::string& tool_tip) {
|
|||
NOTIFYICONDATA icon_data;
|
||||
InitIconData(&icon_data);
|
||||
icon_data.uFlags |= NIF_TIP;
|
||||
wcsncpy_s(icon_data.szTip, base::UTF8ToUTF16(tool_tip).c_str(), _TRUNCATE);
|
||||
wcsncpy_s(icon_data.szTip, base::UTF8ToWide(tool_tip).c_str(), _TRUNCATE);
|
||||
BOOL result = Shell_NotifyIcon(NIM_MODIFY, &icon_data);
|
||||
if (!result)
|
||||
LOG(WARNING) << "Unable to set tooltip for status tray icon";
|
||||
|
@ -151,8 +151,10 @@ void NotifyIcon::DisplayBalloon(const BalloonOptions& options) {
|
|||
NOTIFYICONDATA icon_data;
|
||||
InitIconData(&icon_data);
|
||||
icon_data.uFlags |= NIF_INFO;
|
||||
wcsncpy_s(icon_data.szInfoTitle, options.title.c_str(), _TRUNCATE);
|
||||
wcsncpy_s(icon_data.szInfo, options.content.c_str(), _TRUNCATE);
|
||||
wcsncpy_s(icon_data.szInfoTitle, base::UTF16ToWide(options.title).c_str(),
|
||||
_TRUNCATE);
|
||||
wcsncpy_s(icon_data.szInfo, base::UTF16ToWide(options.content).c_str(),
|
||||
_TRUNCATE);
|
||||
icon_data.uTimeout = 0;
|
||||
icon_data.hBalloonIcon = options.icon;
|
||||
icon_data.dwInfoFlags = ConvertIconType(options.icon_type);
|
||||
|
|
|
@ -104,7 +104,7 @@ bool TaskbarHost::SetThumbarButtons(HWND window,
|
|||
// Set tooltip.
|
||||
if (!button.tooltip.empty()) {
|
||||
thumb_button.dwMask |= THB_TOOLTIP;
|
||||
wcsncpy_s(thumb_button.szTip, base::UTF8ToUTF16(button.tooltip).c_str(),
|
||||
wcsncpy_s(thumb_button.szTip, base::UTF8ToWide(button.tooltip).c_str(),
|
||||
_TRUNCATE);
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ bool TaskbarHost::SetOverlayIcon(HWND window,
|
|||
|
||||
base::win::ScopedHICON icon(IconUtil::CreateHICONFromSkBitmap(overlay));
|
||||
return SUCCEEDED(taskbar_->SetOverlayIcon(window, icon.get(),
|
||||
base::UTF8ToUTF16(text).c_str()));
|
||||
base::UTF8ToWide(text).c_str()));
|
||||
}
|
||||
|
||||
bool TaskbarHost::SetThumbnailClip(HWND window, const gfx::Rect& region) {
|
||||
|
@ -193,8 +193,8 @@ bool TaskbarHost::SetThumbnailToolTip(HWND window, const std::string& tooltip) {
|
|||
if (!InitializeTaskbar())
|
||||
return false;
|
||||
|
||||
return SUCCEEDED(taskbar_->SetThumbnailTooltip(
|
||||
window, base::UTF8ToUTF16(tooltip).c_str()));
|
||||
return SUCCEEDED(
|
||||
taskbar_->SetThumbnailTooltip(window, base::UTF8ToWide(tooltip).c_str()));
|
||||
}
|
||||
|
||||
bool TaskbarHost::HandleThumbarButtonEvent(int button_id) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue