win: Fix assertion when creating Notification

This commit is contained in:
Cheng Zhao 2018-01-03 17:25:19 +09:00
parent 14de22a8c7
commit d6068759b6

View file

@ -14,6 +14,7 @@
#include "base/md5.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "base/threading/thread_restrictions.h"
#include "base/win/windows_version.h"
#include "brightray/browser/win/notification_presenter_win7.h"
#include "brightray/browser/win/windows_toast_notification.h"
@ -68,6 +69,7 @@ NotificationPresenterWin::~NotificationPresenterWin() {
}
bool NotificationPresenterWin::Init() {
base::ThreadRestrictions::ScopedAllowIO allow_io;
return temp_dir_.CreateUniqueTempDir();
}
@ -82,6 +84,7 @@ base::string16 NotificationPresenterWin::SaveIconToFilesystem(
filename = std::to_string(now.ToInternalValue()) + ".png";
}
base::ThreadRestrictions::ScopedAllowIO allow_io;
base::FilePath path = temp_dir_.GetPath().Append(base::UTF8ToUTF16(filename));
if (base::PathExists(path))
return path.value();