chore: fix chromium-style errors in windows code
This commit is contained in:
parent
aa4ca406c8
commit
43c1a7778d
11 changed files with 56 additions and 47 deletions
|
@ -35,7 +35,7 @@ namespace brightray {
|
||||||
class NotificationPresenterWin : public NotificationPresenter {
|
class NotificationPresenterWin : public NotificationPresenter {
|
||||||
public:
|
public:
|
||||||
NotificationPresenterWin();
|
NotificationPresenterWin();
|
||||||
~NotificationPresenterWin();
|
~NotificationPresenterWin() override;
|
||||||
|
|
||||||
bool Init();
|
bool Init();
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,8 @@ brightray::Notification* NotificationPresenterWin7::CreateNotificationObject(
|
||||||
|
|
||||||
Win32Notification* NotificationPresenterWin7::GetNotificationObjectByRef(
|
Win32Notification* NotificationPresenterWin7::GetNotificationObjectByRef(
|
||||||
const DesktopNotificationController::Notification& ref) {
|
const DesktopNotificationController::Notification& ref) {
|
||||||
for (auto n : this->notifications()) {
|
for (auto* n : this->notifications()) {
|
||||||
auto w32n = static_cast<Win32Notification*>(n);
|
auto* w32n = static_cast<Win32Notification*>(n);
|
||||||
if (w32n->GetRef() == ref)
|
if (w32n->GetRef() == ref)
|
||||||
return w32n;
|
return w32n;
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,8 @@ Win32Notification* NotificationPresenterWin7::GetNotificationObjectByRef(
|
||||||
|
|
||||||
Win32Notification* NotificationPresenterWin7::GetNotificationObjectByTag(
|
Win32Notification* NotificationPresenterWin7::GetNotificationObjectByTag(
|
||||||
const std::string& tag) {
|
const std::string& tag) {
|
||||||
for (auto n : this->notifications()) {
|
for (auto* n : this->notifications()) {
|
||||||
auto w32n = static_cast<Win32Notification*>(n);
|
auto* w32n = static_cast<Win32Notification*>(n);
|
||||||
if (w32n->GetTag() == tag)
|
if (w32n->GetTag() == tag)
|
||||||
return w32n;
|
return w32n;
|
||||||
}
|
}
|
||||||
|
@ -35,14 +35,14 @@ Win32Notification* NotificationPresenterWin7::GetNotificationObjectByTag(
|
||||||
|
|
||||||
void NotificationPresenterWin7::OnNotificationClicked(
|
void NotificationPresenterWin7::OnNotificationClicked(
|
||||||
Notification& notification) {
|
Notification& notification) {
|
||||||
auto n = GetNotificationObjectByRef(notification);
|
auto* n = GetNotificationObjectByRef(notification);
|
||||||
if (n)
|
if (n)
|
||||||
n->NotificationClicked();
|
n->NotificationClicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationPresenterWin7::OnNotificationDismissed(
|
void NotificationPresenterWin7::OnNotificationDismissed(
|
||||||
Notification& notification) {
|
Notification& notification) {
|
||||||
auto n = GetNotificationObjectByRef(notification);
|
auto* n = GetNotificationObjectByRef(notification);
|
||||||
if (n)
|
if (n)
|
||||||
n->NotificationDismissed();
|
n->NotificationDismissed();
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ struct ScreenMetrics {
|
||||||
GetProcAddress(GetModuleHandle(TEXT("shcore")), "GetDpiForMonitor"));
|
GetProcAddress(GetModuleHandle(TEXT("shcore")), "GetDpiForMonitor"));
|
||||||
|
|
||||||
if (GetDpiForMonitor) {
|
if (GetDpiForMonitor) {
|
||||||
auto monitor = MonitorFromPoint({}, MONITOR_DEFAULTTOPRIMARY);
|
auto* monitor = MonitorFromPoint({}, MONITOR_DEFAULTTOPRIMARY);
|
||||||
if (GetDpiForMonitor(monitor, 0, &dpi_x, &dpi_y) == S_OK)
|
if (GetDpiForMonitor(monitor, 0, &dpi_x, &dpi_y) == S_OK)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ LRESULT CALLBACK DesktopNotificationController::WndProc(HWND hwnd,
|
||||||
LPARAM lparam) {
|
LPARAM lparam) {
|
||||||
switch (message) {
|
switch (message) {
|
||||||
case WM_CREATE: {
|
case WM_CREATE: {
|
||||||
auto& cs = reinterpret_cast<const CREATESTRUCT*&>(lparam);
|
auto*& cs = reinterpret_cast<const CREATESTRUCT*&>(lparam);
|
||||||
SetWindowLongPtr(hwnd, 0, (LONG_PTR)cs->lpCreateParams);
|
SetWindowLongPtr(hwnd, 0, (LONG_PTR)cs->lpCreateParams);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ LRESULT CALLBACK DesktopNotificationController::WndProc(HWND hwnd,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case WM_DISPLAYCHANGE: {
|
case WM_DISPLAYCHANGE: {
|
||||||
auto inst = Get(hwnd);
|
auto* inst = Get(hwnd);
|
||||||
inst->ClearAssets();
|
inst->ClearAssets();
|
||||||
inst->AnimateAll();
|
inst->AnimateAll();
|
||||||
} break;
|
} break;
|
||||||
|
@ -182,13 +182,13 @@ void DesktopNotificationController::AnimateAll() {
|
||||||
POINT origin = {work_area.right,
|
POINT origin = {work_area.right,
|
||||||
work_area.bottom - metrics.Y(toast_margin_)};
|
work_area.bottom - metrics.Y(toast_margin_)};
|
||||||
|
|
||||||
auto hdwp = BeginDeferWindowPos(static_cast<int>(instances_.size()));
|
auto* hdwp = BeginDeferWindowPos(static_cast<int>(instances_.size()));
|
||||||
|
|
||||||
for (auto&& inst : instances_) {
|
for (auto&& inst : instances_) {
|
||||||
if (!inst.hwnd)
|
if (!inst.hwnd)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto notification = Toast::Get(inst.hwnd);
|
auto* notification = Toast::Get(inst.hwnd);
|
||||||
hdwp = notification->Animate(hdwp, origin);
|
hdwp = notification->Animate(hdwp, origin);
|
||||||
if (!hdwp)
|
if (!hdwp)
|
||||||
break;
|
break;
|
||||||
|
@ -245,7 +245,7 @@ void DesktopNotificationController::AnimateAll() {
|
||||||
int target_pos = 0;
|
int target_pos = 0;
|
||||||
for (auto&& inst : instances_) {
|
for (auto&& inst : instances_) {
|
||||||
if (inst.hwnd) {
|
if (inst.hwnd) {
|
||||||
auto toast = Toast::Get(inst.hwnd);
|
auto* toast = Toast::Get(inst.hwnd);
|
||||||
|
|
||||||
if (toast->IsHighlighted())
|
if (toast->IsHighlighted())
|
||||||
target_pos = toast->GetVerticalPosition();
|
target_pos = toast->GetVerticalPosition();
|
||||||
|
@ -288,9 +288,9 @@ void DesktopNotificationController::CloseNotification(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dismiss active toast
|
// Dismiss active toast
|
||||||
auto hwnd = GetToast(notification.data_.get());
|
auto* hwnd = GetToast(notification.data_.get());
|
||||||
if (hwnd) {
|
if (hwnd) {
|
||||||
auto toast = Toast::Get(hwnd);
|
auto* toast = Toast::Get(hwnd);
|
||||||
toast->Dismiss();
|
toast->Dismiss();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -303,8 +303,8 @@ void DesktopNotificationController::CheckQueue() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesktopNotificationController::CreateToast(NotificationLink&& data) {
|
void DesktopNotificationController::CreateToast(NotificationLink&& data) {
|
||||||
auto hinstance = RegisterWndClasses();
|
auto* hinstance = RegisterWndClasses();
|
||||||
auto hwnd = Toast::Create(hinstance, data);
|
auto* hwnd = Toast::Create(hinstance, data);
|
||||||
if (hwnd) {
|
if (hwnd) {
|
||||||
int toast_pos = 0;
|
int toast_pos = 0;
|
||||||
if (!instances_.empty()) {
|
if (!instances_.empty()) {
|
||||||
|
@ -312,7 +312,7 @@ void DesktopNotificationController::CreateToast(NotificationLink&& data) {
|
||||||
_ASSERT(item.hwnd);
|
_ASSERT(item.hwnd);
|
||||||
|
|
||||||
ScreenMetrics scr;
|
ScreenMetrics scr;
|
||||||
auto toast = Toast::Get(item.hwnd);
|
auto* toast = Toast::Get(item.hwnd);
|
||||||
toast_pos = toast->GetVerticalPosition() + toast->GetHeight() +
|
toast_pos = toast->GetVerticalPosition() + toast->GetHeight() +
|
||||||
scr.Y(toast_margin_);
|
scr.Y(toast_margin_);
|
||||||
}
|
}
|
||||||
|
@ -326,7 +326,7 @@ void DesktopNotificationController::CreateToast(NotificationLink&& data) {
|
||||||
NULL, hinstance, this);
|
NULL, hinstance, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto toast = Toast::Get(hwnd);
|
auto* toast = Toast::Get(hwnd);
|
||||||
toast->PopUp(toast_pos);
|
toast->PopUp(toast_pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -356,12 +356,18 @@ void DesktopNotificationController::DestroyToast(ToastInstance& inst) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DesktopNotificationController::Notification::Notification() = default;
|
||||||
|
DesktopNotificationController::Notification::Notification(
|
||||||
|
const DesktopNotificationController::Notification&) = default;
|
||||||
|
|
||||||
DesktopNotificationController::Notification::Notification(
|
DesktopNotificationController::Notification::Notification(
|
||||||
const shared_ptr<NotificationData>& data)
|
const shared_ptr<NotificationData>& data)
|
||||||
: data_(data) {
|
: data_(data) {
|
||||||
_ASSERT(data != nullptr);
|
_ASSERT(data != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DesktopNotificationController::Notification::~Notification() = default;
|
||||||
|
|
||||||
bool DesktopNotificationController::Notification::operator==(
|
bool DesktopNotificationController::Notification::operator==(
|
||||||
const Notification& other) const {
|
const Notification& other) const {
|
||||||
return data_ == other.data_;
|
return data_ == other.data_;
|
||||||
|
@ -392,9 +398,9 @@ void DesktopNotificationController::Notification::Set(std::wstring caption,
|
||||||
data_->body_text = move(body_text);
|
data_->body_text = move(body_text);
|
||||||
data_->image = CopyBitmap(image);
|
data_->image = CopyBitmap(image);
|
||||||
|
|
||||||
auto hwnd = data_->controller->GetToast(data_.get());
|
auto* hwnd = data_->controller->GetToast(data_.get());
|
||||||
if (hwnd) {
|
if (hwnd) {
|
||||||
auto toast = Toast::Get(hwnd);
|
auto* toast = Toast::Get(hwnd);
|
||||||
toast->ResetContents();
|
toast->ResetContents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,7 +415,7 @@ DesktopNotificationController::NotificationLink::NotificationLink(
|
||||||
}
|
}
|
||||||
|
|
||||||
DesktopNotificationController::NotificationLink::~NotificationLink() {
|
DesktopNotificationController::NotificationLink::~NotificationLink() {
|
||||||
auto p = get();
|
auto* p = get();
|
||||||
if (p)
|
if (p)
|
||||||
p->controller = nullptr;
|
p->controller = nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,8 +88,10 @@ class DesktopNotificationController {
|
||||||
|
|
||||||
class DesktopNotificationController::Notification {
|
class DesktopNotificationController::Notification {
|
||||||
public:
|
public:
|
||||||
Notification() = default;
|
Notification();
|
||||||
explicit Notification(const std::shared_ptr<NotificationData>& data);
|
explicit Notification(const std::shared_ptr<NotificationData>& data);
|
||||||
|
Notification(const Notification&);
|
||||||
|
~Notification();
|
||||||
|
|
||||||
bool operator==(const Notification& other) const;
|
bool operator==(const Notification& other) const;
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ static HBITMAP StretchBitmap(HBITMAP bitmap, unsigned width, unsigned height) {
|
||||||
if (GetDIBits(hdc_screen, bitmap, 0, 0, 0,
|
if (GetDIBits(hdc_screen, bitmap, 0, 0, 0,
|
||||||
reinterpret_cast<BITMAPINFO*>(&bmi), DIB_RGB_COLORS) &&
|
reinterpret_cast<BITMAPINFO*>(&bmi), DIB_RGB_COLORS) &&
|
||||||
bmi.biSizeImage > 0 && (bmi.biSizeImage % 4) == 0) {
|
bmi.biSizeImage > 0 && (bmi.biSizeImage % 4) == 0) {
|
||||||
auto buf = reinterpret_cast<BYTE*>(
|
auto* buf = reinterpret_cast<BYTE*>(
|
||||||
_aligned_malloc(bmi.biSizeImage, sizeof(DWORD)));
|
_aligned_malloc(bmi.biSizeImage, sizeof(DWORD)));
|
||||||
|
|
||||||
if (buf) {
|
if (buf) {
|
||||||
|
@ -117,12 +117,12 @@ static HBITMAP StretchBitmap(HBITMAP bitmap, unsigned width, unsigned height) {
|
||||||
bmi.biCompression = BI_RGB;
|
bmi.biCompression = BI_RGB;
|
||||||
|
|
||||||
void* color_bits;
|
void* color_bits;
|
||||||
auto color_bitmap =
|
auto* color_bitmap =
|
||||||
CreateDIBSection(NULL, reinterpret_cast<BITMAPINFO*>(&bmi),
|
CreateDIBSection(NULL, reinterpret_cast<BITMAPINFO*>(&bmi),
|
||||||
DIB_RGB_COLORS, &color_bits, NULL, 0);
|
DIB_RGB_COLORS, &color_bits, NULL, 0);
|
||||||
|
|
||||||
void* alpha_bits;
|
void* alpha_bits;
|
||||||
auto alpha_bitmap =
|
auto* alpha_bitmap =
|
||||||
CreateDIBSection(NULL, reinterpret_cast<BITMAPINFO*>(&bmi),
|
CreateDIBSection(NULL, reinterpret_cast<BITMAPINFO*>(&bmi),
|
||||||
DIB_RGB_COLORS, &alpha_bits, NULL, 0);
|
DIB_RGB_COLORS, &alpha_bits, NULL, 0);
|
||||||
|
|
||||||
|
@ -148,9 +148,9 @@ static HBITMAP StretchBitmap(HBITMAP bitmap, unsigned width, unsigned height) {
|
||||||
GdiFlush();
|
GdiFlush();
|
||||||
|
|
||||||
// apply the alpha channel
|
// apply the alpha channel
|
||||||
auto dest = reinterpret_cast<BYTE*>(color_bits);
|
auto* dest = reinterpret_cast<BYTE*>(color_bits);
|
||||||
auto src = reinterpret_cast<const BYTE*>(alpha_bits);
|
auto* src = reinterpret_cast<const BYTE*>(alpha_bits);
|
||||||
auto end = src + (width * height * 4);
|
auto* end = src + (width * height * 4);
|
||||||
while (src != end) {
|
while (src != end) {
|
||||||
dest[3] = src[0];
|
dest[3] = src[0];
|
||||||
dest += 4;
|
dest += 4;
|
||||||
|
@ -214,10 +214,10 @@ LRESULT DesktopNotificationController::Toast::WndProc(HWND hwnd,
|
||||||
LPARAM lparam) {
|
LPARAM lparam) {
|
||||||
switch (message) {
|
switch (message) {
|
||||||
case WM_CREATE: {
|
case WM_CREATE: {
|
||||||
auto& cs = reinterpret_cast<const CREATESTRUCT*&>(lparam);
|
auto*& cs = reinterpret_cast<const CREATESTRUCT*&>(lparam);
|
||||||
auto data =
|
auto* data =
|
||||||
static_cast<shared_ptr<NotificationData>*>(cs->lpCreateParams);
|
static_cast<shared_ptr<NotificationData>*>(cs->lpCreateParams);
|
||||||
auto inst = new Toast(hwnd, data);
|
auto* inst = new Toast(hwnd, data);
|
||||||
SetWindowLongPtr(hwnd, 0, (LONG_PTR)inst);
|
SetWindowLongPtr(hwnd, 0, (LONG_PTR)inst);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
@ -236,7 +236,7 @@ LRESULT DesktopNotificationController::Toast::WndProc(HWND hwnd,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case WM_LBUTTONDOWN: {
|
case WM_LBUTTONDOWN: {
|
||||||
auto inst = Get(hwnd);
|
auto* inst = Get(hwnd);
|
||||||
|
|
||||||
inst->Dismiss();
|
inst->Dismiss();
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ LRESULT DesktopNotificationController::Toast::WndProc(HWND hwnd,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case WM_MOUSEMOVE: {
|
case WM_MOUSEMOVE: {
|
||||||
auto inst = Get(hwnd);
|
auto* inst = Get(hwnd);
|
||||||
if (!inst->is_highlighted_) {
|
if (!inst->is_highlighted_) {
|
||||||
inst->is_highlighted_ = true;
|
inst->is_highlighted_ = true;
|
||||||
|
|
||||||
|
@ -269,7 +269,7 @@ LRESULT DesktopNotificationController::Toast::WndProc(HWND hwnd,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case WM_MOUSELEAVE: {
|
case WM_MOUSELEAVE: {
|
||||||
auto inst = Get(hwnd);
|
auto* inst = Get(hwnd);
|
||||||
inst->is_highlighted_ = false;
|
inst->is_highlighted_ = false;
|
||||||
inst->is_close_hot_ = false;
|
inst->is_close_hot_ = false;
|
||||||
inst->UpdateContents();
|
inst->UpdateContents();
|
||||||
|
@ -283,7 +283,7 @@ LRESULT DesktopNotificationController::Toast::WndProc(HWND hwnd,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case WM_WINDOWPOSCHANGED: {
|
case WM_WINDOWPOSCHANGED: {
|
||||||
auto& wp = reinterpret_cast<WINDOWPOS*&>(lparam);
|
auto*& wp = reinterpret_cast<WINDOWPOS*&>(lparam);
|
||||||
if (wp->flags & SWP_HIDEWINDOW) {
|
if (wp->flags & SWP_HIDEWINDOW) {
|
||||||
if (!IsWindowVisible(hwnd))
|
if (!IsWindowVisible(hwnd))
|
||||||
Get(hwnd)->is_highlighted_ = false;
|
Get(hwnd)->is_highlighted_ = false;
|
||||||
|
@ -357,7 +357,7 @@ void DesktopNotificationController::Toast::Draw() {
|
||||||
|
|
||||||
// Draw background
|
// Draw background
|
||||||
{
|
{
|
||||||
auto brush = CreateSolidBrush(back_color);
|
auto* brush = CreateSolidBrush(back_color);
|
||||||
|
|
||||||
RECT rc = {0, 0, toast_size_.cx, toast_size_.cy};
|
RECT rc = {0, 0, toast_size_.cx, toast_size_.cy};
|
||||||
FillRect(hdc_, &rc, brush);
|
FillRect(hdc_, &rc, brush);
|
||||||
|
@ -368,8 +368,8 @@ void DesktopNotificationController::Toast::Draw() {
|
||||||
SetBkMode(hdc_, TRANSPARENT);
|
SetBkMode(hdc_, TRANSPARENT);
|
||||||
|
|
||||||
const auto close = L'\x2715';
|
const auto close = L'\x2715';
|
||||||
auto caption_font = data_->controller->GetCaptionFont();
|
auto* caption_font = data_->controller->GetCaptionFont();
|
||||||
auto body_font = data_->controller->GetBodyFont();
|
auto* body_font = data_->controller->GetBodyFont();
|
||||||
|
|
||||||
TEXTMETRIC tm_cap;
|
TEXTMETRIC tm_cap;
|
||||||
SelectFont(hdc_, caption_font);
|
SelectFont(hdc_, caption_font);
|
||||||
|
@ -520,7 +520,7 @@ void DesktopNotificationController::Toast::UpdateBufferSize() {
|
||||||
if (new_size.cx != this->toast_size_.cx ||
|
if (new_size.cx != this->toast_size_.cx ||
|
||||||
new_size.cy != this->toast_size_.cy) {
|
new_size.cy != this->toast_size_.cy) {
|
||||||
HDC hdc_screen = GetDC(NULL);
|
HDC hdc_screen = GetDC(NULL);
|
||||||
auto new_bitmap =
|
auto* new_bitmap =
|
||||||
CreateCompatibleBitmap(hdc_screen, new_size.cx, new_size.cy);
|
CreateCompatibleBitmap(hdc_screen, new_size.cx, new_size.cy);
|
||||||
ReleaseDC(NULL, hdc_screen);
|
ReleaseDC(NULL, hdc_screen);
|
||||||
|
|
||||||
|
@ -733,7 +733,7 @@ HDWP DesktopNotificationController::Toast::Animate(HDWP hdwp,
|
||||||
// ULWI fails, which can happen when one of the dimensions is zero (e.g.
|
// ULWI fails, which can happen when one of the dimensions is zero (e.g.
|
||||||
// at the beginning of ease-in).
|
// at the beginning of ease-in).
|
||||||
|
|
||||||
auto ulw_result = UpdateLayeredWindowIndirect(hwnd_, &ulw);
|
UpdateLayeredWindowIndirect(hwnd_, &ulw);
|
||||||
hdwp = DeferWindowPos(hdwp, hwnd_, HWND_TOPMOST, pt.x, pt.y, size.cx, size.cy,
|
hdwp = DeferWindowPos(hdwp, hwnd_, HWND_TOPMOST, pt.x, pt.y, size.cx, size.cy,
|
||||||
dwpFlags);
|
dwpFlags);
|
||||||
return hdwp;
|
return hdwp;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
namespace brightray {
|
namespace brightray {
|
||||||
|
|
||||||
void Win32Notification::Show(const NotificationOptions& options) {
|
void Win32Notification::Show(const NotificationOptions& options) {
|
||||||
auto presenter = static_cast<NotificationPresenterWin7*>(this->presenter());
|
auto* presenter = static_cast<NotificationPresenterWin7*>(this->presenter());
|
||||||
if (!presenter)
|
if (!presenter)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ WindowsToastNotification::~WindowsToastNotification() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowsToastNotification::Show(const NotificationOptions& options) {
|
void WindowsToastNotification::Show(const NotificationOptions& options) {
|
||||||
auto presenter_win = static_cast<NotificationPresenterWin*>(presenter());
|
auto* presenter_win = static_cast<NotificationPresenterWin*>(presenter());
|
||||||
std::wstring icon_path =
|
std::wstring icon_path =
|
||||||
presenter_win->SaveIconToFilesystem(options.icon, options.icon_url);
|
presenter_win->SaveIconToFilesystem(options.icon, options.icon_url);
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ class WindowsToastNotification : public Notification {
|
||||||
|
|
||||||
WindowsToastNotification(NotificationDelegate* delegate,
|
WindowsToastNotification(NotificationDelegate* delegate,
|
||||||
NotificationPresenter* presenter);
|
NotificationPresenter* presenter);
|
||||||
~WindowsToastNotification();
|
~WindowsToastNotification() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Notification:
|
// Notification:
|
||||||
|
@ -108,7 +108,7 @@ class ToastEventHandler : public RuntimeClass<RuntimeClassFlags<ClassicCom>,
|
||||||
DesktopToastFailedEventHandler> {
|
DesktopToastFailedEventHandler> {
|
||||||
public:
|
public:
|
||||||
explicit ToastEventHandler(Notification* notification);
|
explicit ToastEventHandler(Notification* notification);
|
||||||
~ToastEventHandler();
|
~ToastEventHandler() override;
|
||||||
|
|
||||||
IFACEMETHODIMP Invoke(
|
IFACEMETHODIMP Invoke(
|
||||||
ABI::Windows::UI::Notifications::IToastNotification* sender,
|
ABI::Windows::UI::Notifications::IToastNotification* sender,
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define BRIGHTRAY_COMMON_APPLICATION_INFO_H_
|
#define BRIGHTRAY_COMMON_APPLICATION_INFO_H_
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
|
#include "base/strings/string16.h"
|
||||||
#include "brightray/browser/win/scoped_hstring.h"
|
#include "brightray/browser/win/scoped_hstring.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -22,14 +22,14 @@ base::string16 g_app_user_model_id;
|
||||||
const wchar_t kAppUserModelIDFormat[] = L"electron.app.$1";
|
const wchar_t kAppUserModelIDFormat[] = L"electron.app.$1";
|
||||||
|
|
||||||
std::string GetApplicationName() {
|
std::string GetApplicationName() {
|
||||||
auto module = GetModuleHandle(nullptr);
|
auto* module = GetModuleHandle(nullptr);
|
||||||
std::unique_ptr<FileVersionInfo> info(
|
std::unique_ptr<FileVersionInfo> info(
|
||||||
FileVersionInfo::CreateFileVersionInfoForModule(module));
|
FileVersionInfo::CreateFileVersionInfoForModule(module));
|
||||||
return base::UTF16ToUTF8(info->product_name());
|
return base::UTF16ToUTF8(info->product_name());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GetApplicationVersion() {
|
std::string GetApplicationVersion() {
|
||||||
auto module = GetModuleHandle(nullptr);
|
auto* module = GetModuleHandle(nullptr);
|
||||||
std::unique_ptr<FileVersionInfo> info(
|
std::unique_ptr<FileVersionInfo> info(
|
||||||
FileVersionInfo::CreateFileVersionInfoForModule(module));
|
FileVersionInfo::CreateFileVersionInfoForModule(module));
|
||||||
return base::UTF16ToUTF8(info->product_version());
|
return base::UTF16ToUTF8(info->product_version());
|
||||||
|
|
Loading…
Add table
Reference in a new issue