Expose NotificationPresenter to public

This commit is contained in:
Cheng Zhao 2015-12-24 22:20:47 +08:00
parent 9897f3aab0
commit 6f81d1e29f
5 changed files with 57 additions and 58 deletions

View file

@ -4,15 +4,19 @@
#include "browser/browser_client.h"
#include "base/path_service.h"
#include "browser/browser_context.h"
#include "browser/browser_main_parts.h"
#include "browser/devtools_manager_delegate.h"
#include "browser/media/media_capture_devices_dispatcher.h"
#include "browser/platform_notification_service_impl.h"
#include "base/path_service.h"
#include "browser/notification_presenter.h"
#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 {
@ -38,6 +42,20 @@ BrowserContext* BrowserClient::browser_context() {
return browser_main_parts_->browser_context();
}
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());
}
return notification_presenter_.get();
}
BrowserMainParts* BrowserClient::OverrideCreateBrowserMainParts(
const content::MainFunctionParams&) {
return new BrowserMainParts;
@ -65,7 +83,9 @@ content::MediaObserver* BrowserClient::GetMediaObserver() {
}
content::PlatformNotificationService* BrowserClient::GetPlatformNotificationService() {
return PlatformNotificationServiceImpl::GetInstance();
if (!notification_service_)
notification_service_.reset(new PlatformNotificationService(this));
return notification_service_.get();
}
void BrowserClient::GetAdditionalAllowedSchemesForFileSystem(