🔧 Allow notifications debugging (Windows)

This commit is contained in:
Felix Rieseberg 2017-12-13 16:25:49 -08:00
parent 76d9756fb9
commit 8a8aaaf16c
2 changed files with 32 additions and 1 deletions

View file

@ -13,6 +13,7 @@
#include "base/md5.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "base/environment.h"
#include "base/win/windows_version.h"
#include "brightray/browser/win/notification_presenter_win7.h"
#include "brightray/browser/win/windows_toast_notification.h"
@ -26,6 +27,10 @@ namespace brightray {
namespace {
bool IsDebuggingNotifications() {
return base::Environment::Create()->HasVar("ELECTRON_DEBUG_NOTIFICATIONS");
}
bool SaveIconToPath(const SkBitmap& bitmap, const base::FilePath& path) {
std::vector<unsigned char> png_data;
if (!gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &png_data))
@ -49,6 +54,11 @@ NotificationPresenter* NotificationPresenter::Create() {
new NotificationPresenterWin);
if (!presenter->Init())
return nullptr;
if (IsDebuggingNotifications()) {
LOG(INFO) << "Successfully created Windows notifications presenter";
}
return presenter.release();
}