Turn NotificationPresenter into an abstract base class

This will allow us to have Mac-specific member variables without a bunch of
ifdefs.
This commit is contained in:
Adam Roben 2013-03-28 18:03:58 -04:00
parent 3c41af84a1
commit 651ab18a21
6 changed files with 42 additions and 19 deletions

View file

@ -42,8 +42,8 @@
'browser/mac/bry_inspectable_web_contents_view_private.h',
'browser/network_delegate.cc',
'browser/network_delegate.h',
'browser/notification_presenter.cc',
'browser/notification_presenter.h',
'browser/notification_presenter_mac.h',
'browser/notification_presenter_mac.mm',
'browser/url_request_context_getter.cc',
'browser/url_request_context_getter.h',

View file

@ -22,7 +22,7 @@ BrowserContext* BrowserClient::browser_context() {
NotificationPresenter* BrowserClient::notification_presenter() {
if (!notification_presenter_)
notification_presenter_.reset(new NotificationPresenter);
notification_presenter_.reset(NotificationPresenter::Create());
return notification_presenter_.get();
}

View file

@ -1,11 +0,0 @@
#include "browser/notification_presenter.h"
namespace brightray {
NotificationPresenter::NotificationPresenter() {
}
NotificationPresenter::~NotificationPresenter() {
}
}

View file

@ -9,13 +9,14 @@ namespace brightray {
class NotificationPresenter {
public:
NotificationPresenter();
~NotificationPresenter();
virtual ~NotificationPresenter() {};
void ShowNotification(
static NotificationPresenter* Create();
virtual void ShowNotification(
const content::ShowDesktopNotificationHostMsgParams&,
int render_process_id,
int render_view_id);
int render_view_id) = 0;
};
}

View file

@ -0,0 +1,23 @@
#ifndef BRIGHTRAY_BROWSER_NOTIFICATION_PRESENTER_MAC_H_
#define BRIGHTRAY_BROWSER_NOTIFICATION_PRESENTER_MAC_H_
#import "browser/notification_presenter.h"
#import "base/compiler_specific.h"
namespace brightray {
class NotificationPresenterMac : public NotificationPresenter {
public:
NotificationPresenterMac();
~NotificationPresenterMac();
virtual void ShowNotification(
const content::ShowDesktopNotificationHostMsgParams&,
int render_process_id,
int render_view_id) OVERRIDE;
};
}
#endif

View file

@ -1,4 +1,4 @@
#import "browser/notification_presenter.h"
#import "browser/notification_presenter_mac.h"
#import "base/strings/sys_string_conversions.h"
#import "content/public/browser/render_view_host.h"
@ -8,7 +8,17 @@
namespace brightray {
void NotificationPresenter::ShowNotification(
NotificationPresenter* NotificationPresenter::Create() {
return new NotificationPresenterMac;
}
NotificationPresenterMac::NotificationPresenterMac() {
}
NotificationPresenterMac::~NotificationPresenterMac() {
}
void NotificationPresenterMac::ShowNotification(
const content::ShowDesktopNotificationHostMsgParams& params,
int render_process_id,
int render_view_id) {