Use NotificationPresenterWin7 on Windows 7

This commit is contained in:
Ales Pergl 2017-03-15 13:58:53 +01:00
parent fe05b66a6c
commit 0fa6c82b3f
2 changed files with 6 additions and 10 deletions

View file

@ -13,10 +13,6 @@
#include "browser/platform_notification_service.h"
#include "content/public/common/url_constants.h"
#if defined(OS_WIN)
#include "base/win/windows_version.h"
#endif
namespace brightray {
namespace {
@ -39,12 +35,6 @@ BrowserClient::~BrowserClient() {
}
NotificationPresenter* BrowserClient::GetNotificationPresenter() {
#if defined(OS_WIN)
// Bail out if on Windows 7 or even lower, no operating will follow
if (base::win::GetVersion() < base::win::VERSION_WIN8)
return nullptr;
#endif
if (!notification_presenter_) {
// Create a new presenter if on OS X, Linux, or Windows 8+
notification_presenter_.reset(NotificationPresenter::Create());

View file

@ -10,6 +10,7 @@
#include "base/md5.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/windows_version.h"
#include "browser/win/notification_presenter_win7.h"
#include "browser/win/windows_toast_notification.h"
#include "content/public/browser/desktop_notification_delegate.h"
#include "content/public/common/platform_notification_data.h"
@ -36,6 +37,11 @@ bool SaveIconToPath(const SkBitmap& bitmap, const base::FilePath& path) {
// static
NotificationPresenter* NotificationPresenter::Create() {
auto version = base::win::GetVersion();
if (version < base::win::VERSION_WIN7)
return nullptr;
if (version < base::win::VERSION_WIN8)
return new NotificationPresenterWin7;
if (!WindowsToastNotification::Initialize())
return nullptr;
std::unique_ptr<NotificationPresenterWin> presenter(