diff --git a/atom/browser/api/atom_api_notification.cc b/atom/browser/api/atom_api_notification.cc index 06d22455c70..81272fc180b 100644 --- a/atom/browser/api/atom_api_notification.cc +++ b/atom/browser/api/atom_api_notification.cc @@ -5,13 +5,13 @@ #include "atom/browser/api/atom_api_notification.h" #include "atom/browser/api/atom_api_menu.h" +#include "atom/browser/atom_browser_client.h" #include "atom/browser/browser.h" #include "atom/common/native_mate_converters/gfx_converter.h" #include "atom/common/native_mate_converters/image_converter.h" #include "atom/common/native_mate_converters/string16_converter.h" #include "base/guid.h" #include "base/strings/utf_string_conversions.h" -#include "brightray/browser/browser_client.h" #include "native_mate/constructor.h" #include "native_mate/dictionary.h" #include "native_mate/object_template_builder.h" @@ -22,10 +22,10 @@ namespace mate { template <> -struct Converter { +struct Converter { static bool FromV8(v8::Isolate* isolate, v8::Local val, - brightray::NotificationAction* out) { + atom::NotificationAction* out) { mate::Dictionary dict; if (!ConvertFromV8(isolate, val, &dict)) return false; @@ -38,7 +38,7 @@ struct Converter { } static v8::Local ToV8(v8::Isolate* isolate, - brightray::NotificationAction val) { + atom::NotificationAction val) { mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate); dict.Set("text", val.text); dict.Set("type", val.type); @@ -56,7 +56,8 @@ Notification::Notification(v8::Isolate* isolate, mate::Arguments* args) { InitWith(isolate, wrapper); - presenter_ = brightray::BrowserClient::Get()->GetNotificationPresenter(); + presenter_ = static_cast(AtomBrowserClient::Get()) + ->GetNotificationPresenter(); mate::Dictionary opts; if (args->GetNext(&opts)) { @@ -119,7 +120,7 @@ base::string16 Notification::GetSound() const { return sound_; } -std::vector Notification::GetActions() const { +std::vector Notification::GetActions() const { return actions_; } @@ -157,7 +158,7 @@ void Notification::SetSound(const base::string16& new_sound) { } void Notification::SetActions( - const std::vector& actions) { + const std::vector& actions) { actions_ = actions; } @@ -200,7 +201,7 @@ void Notification::Show() { if (presenter_) { notification_ = presenter_->CreateNotification(this, base::GenerateGUID()); if (notification_) { - brightray::NotificationOptions options; + atom::NotificationOptions options; options.title = title_; options.subtitle = subtitle_; options.msg = body_; @@ -218,7 +219,8 @@ void Notification::Show() { } bool Notification::IsSupported() { - return !!brightray::BrowserClient::Get()->GetNotificationPresenter(); + return !!static_cast(AtomBrowserClient::Get()) + ->GetNotificationPresenter(); } // static diff --git a/atom/browser/api/atom_api_notification.h b/atom/browser/api/atom_api_notification.h index 91a5b72c983..814ad045540 100644 --- a/atom/browser/api/atom_api_notification.h +++ b/atom/browser/api/atom_api_notification.h @@ -10,10 +10,10 @@ #include #include "atom/browser/api/trackable_object.h" +#include "atom/browser/notifications/notification.h" +#include "atom/browser/notifications/notification_delegate.h" +#include "atom/browser/notifications/notification_presenter.h" #include "base/strings/utf_string_conversions.h" -#include "brightray/browser/notification.h" -#include "brightray/browser/notification_delegate.h" -#include "brightray/browser/notification_presenter.h" #include "native_mate/handle.h" #include "ui/gfx/image/image.h" @@ -22,7 +22,7 @@ namespace atom { namespace api { class Notification : public mate::TrackableObject, - public brightray::NotificationDelegate { + public NotificationDelegate { public: static mate::WrappableBase* New(mate::Arguments* args); static bool IsSupported(); @@ -55,7 +55,7 @@ class Notification : public mate::TrackableObject, bool GetHasReply() const; base::string16 GetReplyPlaceholder() const; base::string16 GetSound() const; - std::vector GetActions() const; + std::vector GetActions() const; base::string16 GetCloseButtonText() const; // Prop Setters @@ -66,7 +66,7 @@ class Notification : public mate::TrackableObject, void SetHasReply(bool new_has_reply); void SetReplyPlaceholder(const base::string16& new_reply_placeholder); void SetSound(const base::string16& sound); - void SetActions(const std::vector& actions); + void SetActions(const std::vector& actions); void SetCloseButtonText(const base::string16& text); private: @@ -80,12 +80,12 @@ class Notification : public mate::TrackableObject, bool has_reply_ = false; base::string16 reply_placeholder_; base::string16 sound_; - std::vector actions_; + std::vector actions_; base::string16 close_button_text_; - brightray::NotificationPresenter* presenter_; + atom::NotificationPresenter* presenter_; - base::WeakPtr notification_; + base::WeakPtr notification_; DISALLOW_COPY_AND_ASSIGN(Notification); }; diff --git a/atom/browser/atom_browser_client.cc b/atom/browser/atom_browser_client.cc index 3ecb928a43e..2d195818f6a 100644 --- a/atom/browser/atom_browser_client.cc +++ b/atom/browser/atom_browser_client.cc @@ -23,6 +23,8 @@ #include "atom/browser/child_web_contents_tracker.h" #include "atom/browser/io_thread.h" #include "atom/browser/native_window.h" +#include "atom/browser/notifications/notification_presenter.h" +#include "atom/browser/notifications/platform_notification_service.h" #include "atom/browser/session_preferences.h" #include "atom/browser/web_contents_permission_helper.h" #include "atom/browser/web_contents_preferences.h" @@ -675,4 +677,19 @@ AtomBrowserClient::CreateThrottlesForNavigation( return throttles; } +NotificationPresenter* AtomBrowserClient::GetNotificationPresenter() { + if (!notification_presenter_) { + notification_presenter_.reset(NotificationPresenter::Create()); + } + return notification_presenter_.get(); +} + +content::PlatformNotificationService* +AtomBrowserClient::GetPlatformNotificationService() { + if (!notification_service_) { + notification_service_.reset(new PlatformNotificationService(this)); + } + return notification_service_.get(); +} + } // namespace atom diff --git a/atom/browser/atom_browser_client.h b/atom/browser/atom_browser_client.h index dbf776c746a..d182862e96c 100644 --- a/atom/browser/atom_browser_client.h +++ b/atom/browser/atom_browser_client.h @@ -27,6 +27,8 @@ class SSLCertRequestInfo; namespace atom { class AtomResourceDispatcherHostDelegate; +class NotificationPresenter; +class PlatformNotificationService; class AtomBrowserClient : public brightray::BrowserClient, public content::RenderProcessHostObserver { @@ -47,6 +49,12 @@ class AtomBrowserClient : public brightray::BrowserClient, static void SetCustomServiceWorkerSchemes( const std::vector& schemes); + NotificationPresenter* GetNotificationPresenter(); + + void WebNotificationAllowed(int render_process_id, + const base::Callback& callback); + + // content::NavigatorDelegate std::vector> CreateThrottlesForNavigation(content::NavigationHandle* handle) override; @@ -117,13 +125,12 @@ class AtomBrowserClient : public brightray::BrowserClient, std::unique_ptr GetServiceManifestOverlay( base::StringPiece name) override; net::NetLog* GetNetLog() override; + content::PlatformNotificationService* GetPlatformNotificationService() + override; // brightray::BrowserClient: brightray::BrowserMainParts* OverrideCreateBrowserMainParts( const content::MainFunctionParams&) override; - void WebNotificationAllowed( - int render_process_id, - const base::Callback& callback) override; // content::RenderProcessHostObserver: void RenderProcessHostDestroyed(content::RenderProcessHost* host) override; @@ -170,6 +177,9 @@ class AtomBrowserClient : public brightray::BrowserClient, std::unique_ptr resource_dispatcher_host_delegate_; + std::unique_ptr notification_service_; + std::unique_ptr notification_presenter_; + Delegate* delegate_ = nullptr; DISALLOW_COPY_AND_ASSIGN(AtomBrowserClient); diff --git a/brightray/browser/linux/libnotify_loader.cc b/atom/browser/notifications/linux/libnotify_loader.cc similarity index 94% rename from brightray/browser/linux/libnotify_loader.cc rename to atom/browser/notifications/linux/libnotify_loader.cc index a6a08e21869..4a9bfe6da4c 100644 --- a/brightray/browser/linux/libnotify_loader.cc +++ b/atom/browser/notifications/linux/libnotify_loader.cc @@ -1,8 +1,8 @@ -// This is generated file. Do not modify directly. -// Path to the code generator: -// tools/generate_library_loader/generate_library_loader.py . +// Copyright (c) 2015 GitHub, Inc. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. -#include "brightray/browser/linux/libnotify_loader.h" +#include "atom/browser/notifications/linux/libnotify_loader.h" #include diff --git a/brightray/browser/linux/libnotify_loader.h b/atom/browser/notifications/linux/libnotify_loader.h similarity index 74% rename from brightray/browser/linux/libnotify_loader.h rename to atom/browser/notifications/linux/libnotify_loader.h index 16ea7db3b69..51189e6b2f7 100644 --- a/brightray/browser/linux/libnotify_loader.h +++ b/atom/browser/notifications/linux/libnotify_loader.h @@ -1,9 +1,12 @@ -// This is generated file. Do not modify directly. -// Path to the code generator: -// tools/generate_library_loader/generate_library_loader.py . +// Copyright (c) 2015 GitHub, Inc. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. -#ifndef BRIGHTRAY_BROWSER_LINUX_LIBNOTIFY_LOADER_H_ -#define BRIGHTRAY_BROWSER_LINUX_LIBNOTIFY_LOADER_H_ +#ifndef ATOM_BROWSER_NOTIFICATIONS_LINUX_LIBNOTIFY_LOADER_H_ +#define ATOM_BROWSER_NOTIFICATIONS_LINUX_LIBNOTIFY_LOADER_H_ + +// FIXME Generate during build using +// //tools/generate_library_loader/generate_library_loader.gni #include #include @@ -43,4 +46,4 @@ class LibNotifyLoader { void operator=(const LibNotifyLoader&); }; -#endif // BRIGHTRAY_BROWSER_LINUX_LIBNOTIFY_LOADER_H_ +#endif // ATOM_BROWSER_NOTIFICATIONS_LINUX_LIBNOTIFY_LOADER_H_ diff --git a/brightray/browser/linux/libnotify_notification.cc b/atom/browser/notifications/linux/libnotify_notification.cc similarity index 94% rename from brightray/browser/linux/libnotify_notification.cc rename to atom/browser/notifications/linux/libnotify_notification.cc index 0725ffded98..dfe007aedf6 100644 --- a/brightray/browser/linux/libnotify_notification.cc +++ b/atom/browser/notifications/linux/libnotify_notification.cc @@ -2,24 +2,24 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. -#include "brightray/browser/linux/libnotify_notification.h" +#include "atom/browser/notifications/linux/libnotify_notification.h" #include #include #include +#include "atom/browser/notifications/notification_delegate.h" #include "base/files/file_enumerator.h" #include "base/logging.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" -#include "brightray/browser/notification_delegate.h" #include "brightray/common/application_info.h" #include "brightray/common/platform_util.h" #include "chrome/browser/ui/libgtkui/gtk_util.h" #include "chrome/browser/ui/libgtkui/skia_utils_gtk.h" #include "third_party/skia/include/core/SkBitmap.h" -namespace brightray { +namespace atom { namespace { @@ -66,7 +66,7 @@ bool LibnotifyNotification::Initialize() { return false; } if (!libnotify_loader_.notify_is_initted() && - !libnotify_loader_.notify_init(GetApplicationName().c_str())) { + !libnotify_loader_.notify_init(brightray::GetApplicationName().c_str())) { LOG(WARNING) << "Unable to initialize libnotify; notifications disabled"; return false; } @@ -127,7 +127,7 @@ void LibnotifyNotification::Show(const NotificationOptions& options) { // Send the desktop name to identify the application // The desktop-entry is the part before the .desktop std::string desktop_id; - if (platform_util::GetDesktopName(&desktop_id)) { + if (brightray::platform_util::GetDesktopName(&desktop_id)) { const std::string suffix{".desktop"}; if (base::EndsWith(desktop_id, suffix, base::CompareCase::INSENSITIVE_ASCII)) { @@ -173,4 +173,4 @@ void LibnotifyNotification::OnNotificationView(NotifyNotification* notification, NotificationClicked(); } -} // namespace brightray +} // namespace atom diff --git a/brightray/browser/linux/libnotify_notification.h b/atom/browser/notifications/linux/libnotify_notification.h similarity index 73% rename from brightray/browser/linux/libnotify_notification.h rename to atom/browser/notifications/linux/libnotify_notification.h index db0b9f04a87..4dbdb1f51b7 100644 --- a/brightray/browser/linux/libnotify_notification.h +++ b/atom/browser/notifications/linux/libnotify_notification.h @@ -2,17 +2,17 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. -#ifndef BRIGHTRAY_BROWSER_LINUX_LIBNOTIFY_NOTIFICATION_H_ -#define BRIGHTRAY_BROWSER_LINUX_LIBNOTIFY_NOTIFICATION_H_ +#ifndef ATOM_BROWSER_NOTIFICATIONS_LINUX_LIBNOTIFY_NOTIFICATION_H_ +#define ATOM_BROWSER_NOTIFICATIONS_LINUX_LIBNOTIFY_NOTIFICATION_H_ #include #include -#include "brightray/browser/linux/libnotify_loader.h" -#include "brightray/browser/notification.h" +#include "atom/browser/notifications/linux/libnotify_loader.h" +#include "atom/browser/notifications/notification.h" #include "ui/base/glib/glib_signal.h" -namespace brightray { +namespace atom { class LibnotifyNotification : public Notification { public: @@ -42,6 +42,6 @@ class LibnotifyNotification : public Notification { DISALLOW_COPY_AND_ASSIGN(LibnotifyNotification); }; -} // namespace brightray +} // namespace atom -#endif // BRIGHTRAY_BROWSER_LINUX_LIBNOTIFY_NOTIFICATION_H_ +#endif // ATOM_BROWSER_NOTIFICATIONS_LINUX_LIBNOTIFY_NOTIFICATION_H_ diff --git a/brightray/browser/linux/notification_presenter_linux.cc b/atom/browser/notifications/linux/notification_presenter_linux.cc similarity index 79% rename from brightray/browser/linux/notification_presenter_linux.cc rename to atom/browser/notifications/linux/notification_presenter_linux.cc index bea8ae04f92..5726c83edea 100644 --- a/brightray/browser/linux/notification_presenter_linux.cc +++ b/atom/browser/notifications/linux/notification_presenter_linux.cc @@ -3,11 +3,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE-CHROMIUM file. -#include "brightray/browser/linux/notification_presenter_linux.h" +#include "atom/browser/notifications/linux/notification_presenter_linux.h" -#include "brightray/browser/linux/libnotify_notification.h" +#include "atom/browser/notifications/linux/libnotify_notification.h" -namespace brightray { +namespace atom { // static NotificationPresenter* NotificationPresenter::Create() { @@ -25,4 +25,4 @@ Notification* NotificationPresenterLinux::CreateNotificationObject( return new LibnotifyNotification(delegate, this); } -} // namespace brightray +} // namespace atom diff --git a/brightray/browser/linux/notification_presenter_linux.h b/atom/browser/notifications/linux/notification_presenter_linux.h similarity index 63% rename from brightray/browser/linux/notification_presenter_linux.h rename to atom/browser/notifications/linux/notification_presenter_linux.h index 1ae4b2d1cc9..32fcdda3ef4 100644 --- a/brightray/browser/linux/notification_presenter_linux.h +++ b/atom/browser/notifications/linux/notification_presenter_linux.h @@ -3,12 +3,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE-CHROMIUM file. -#ifndef BRIGHTRAY_BROWSER_LINUX_NOTIFICATION_PRESENTER_LINUX_H_ -#define BRIGHTRAY_BROWSER_LINUX_NOTIFICATION_PRESENTER_LINUX_H_ +#ifndef ATOM_BROWSER_NOTIFICATIONS_LINUX_NOTIFICATION_PRESENTER_LINUX_H_ +#define ATOM_BROWSER_NOTIFICATIONS_LINUX_NOTIFICATION_PRESENTER_LINUX_H_ -#include "brightray/browser/notification_presenter.h" +#include "atom/browser/notifications/notification_presenter.h" -namespace brightray { +namespace atom { class NotificationPresenterLinux : public NotificationPresenter { public: @@ -22,6 +22,6 @@ class NotificationPresenterLinux : public NotificationPresenter { DISALLOW_COPY_AND_ASSIGN(NotificationPresenterLinux); }; -} // namespace brightray +} // namespace atom -#endif // BRIGHTRAY_BROWSER_LINUX_NOTIFICATION_PRESENTER_LINUX_H_ +#endif // ATOM_BROWSER_NOTIFICATIONS_LINUX_NOTIFICATION_PRESENTER_LINUX_H_ diff --git a/brightray/browser/mac/cocoa_notification.h b/atom/browser/notifications/mac/cocoa_notification.h similarity index 80% rename from brightray/browser/mac/cocoa_notification.h rename to atom/browser/notifications/mac/cocoa_notification.h index 3221a8d09dd..b78818ae472 100644 --- a/brightray/browser/mac/cocoa_notification.h +++ b/atom/browser/notifications/mac/cocoa_notification.h @@ -2,8 +2,8 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. -#ifndef BRIGHTRAY_BROWSER_MAC_COCOA_NOTIFICATION_H_ -#define BRIGHTRAY_BROWSER_MAC_COCOA_NOTIFICATION_H_ +#ifndef ATOM_BROWSER_NOTIFICATIONS_MAC_COCOA_NOTIFICATION_H_ +#define ATOM_BROWSER_NOTIFICATIONS_MAC_COCOA_NOTIFICATION_H_ #import @@ -11,10 +11,10 @@ #include #include +#include "atom/browser/notifications/notification.h" #include "base/mac/scoped_nsobject.h" -#include "brightray/browser/notification.h" -namespace brightray { +namespace atom { class CocoaNotification : public Notification { public: @@ -45,6 +45,6 @@ class CocoaNotification : public Notification { DISALLOW_COPY_AND_ASSIGN(CocoaNotification); }; -} // namespace brightray +} // namespace atom -#endif // BRIGHTRAY_BROWSER_MAC_COCOA_NOTIFICATION_H_ +#endif // ATOM_BROWSER_NOTIFICATIONS_MAC_COCOA_NOTIFICATION_H_ diff --git a/brightray/browser/mac/cocoa_notification.mm b/atom/browser/notifications/mac/cocoa_notification.mm similarity index 95% rename from brightray/browser/mac/cocoa_notification.mm rename to atom/browser/notifications/mac/cocoa_notification.mm index 57f53931e97..5723ca63521 100644 --- a/brightray/browser/mac/cocoa_notification.mm +++ b/atom/browser/notifications/mac/cocoa_notification.mm @@ -2,16 +2,16 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. -#include "brightray/browser/mac/cocoa_notification.h" +#include "atom/browser/notifications/mac/cocoa_notification.h" +#include "atom/browser/notifications/notification_delegate.h" +#include "atom/browser/notifications/notification_presenter.h" #include "base/mac/mac_util.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" -#include "brightray/browser/notification_delegate.h" -#include "brightray/browser/notification_presenter.h" #include "skia/ext/skia_utils_mac.h" -namespace brightray { +namespace atom { int g_identifier_ = 1; @@ -171,4 +171,4 @@ void CocoaNotification::LogAction(const char* action) { } } -} // namespace brightray +} // namespace atom diff --git a/atom/browser/notifications/mac/notification_center_delegate.h b/atom/browser/notifications/mac/notification_center_delegate.h new file mode 100644 index 00000000000..b1a7b18e88e --- /dev/null +++ b/atom/browser/notifications/mac/notification_center_delegate.h @@ -0,0 +1,22 @@ +// Copyright (c) 2015 GitHub, Inc. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +#ifndef ATOM_BROWSER_NOTIFICATIONS_MAC_NOTIFICATION_CENTER_DELEGATE_H_ +#define ATOM_BROWSER_NOTIFICATIONS_MAC_NOTIFICATION_CENTER_DELEGATE_H_ + +#import + +namespace atom { +class NotificationPresenterMac; +} + +@interface NotificationCenterDelegate + : NSObject { + @private + atom::NotificationPresenterMac* presenter_; +} +- (instancetype)initWithPresenter:(atom::NotificationPresenterMac*)presenter; +@end + +#endif // ATOM_BROWSER_NOTIFICATIONS_MAC_NOTIFICATION_CENTER_DELEGATE_H_ diff --git a/brightray/browser/mac/notification_center_delegate.mm b/atom/browser/notifications/mac/notification_center_delegate.mm similarity index 91% rename from brightray/browser/mac/notification_center_delegate.mm rename to atom/browser/notifications/mac/notification_center_delegate.mm index ddf0cbfa888..55725448ef3 100644 --- a/brightray/browser/mac/notification_center_delegate.mm +++ b/atom/browser/notifications/mac/notification_center_delegate.mm @@ -2,15 +2,14 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. -#include "brightray/browser/mac/notification_center_delegate.h" +#include "atom/browser/notifications/mac/notification_center_delegate.h" -#include "brightray/browser/mac/cocoa_notification.h" -#include "brightray/browser/mac/notification_presenter_mac.h" +#include "atom/browser/notifications/mac/cocoa_notification.h" +#include "atom/browser/notifications/mac/notification_presenter_mac.h" @implementation NotificationCenterDelegate -- (instancetype)initWithPresenter: - (brightray::NotificationPresenterMac*)presenter { +- (instancetype)initWithPresenter:(atom::NotificationPresenterMac*)presenter { self = [super init]; if (!self) return nil; diff --git a/brightray/browser/mac/notification_presenter_mac.h b/atom/browser/notifications/mac/notification_presenter_mac.h similarity index 66% rename from brightray/browser/mac/notification_presenter_mac.h rename to atom/browser/notifications/mac/notification_presenter_mac.h index b23e10b82f0..b951d59af3e 100644 --- a/brightray/browser/mac/notification_presenter_mac.h +++ b/atom/browser/notifications/mac/notification_presenter_mac.h @@ -3,14 +3,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE-CHROMIUM file. -#ifndef BRIGHTRAY_BROWSER_MAC_NOTIFICATION_PRESENTER_MAC_H_ -#define BRIGHTRAY_BROWSER_MAC_NOTIFICATION_PRESENTER_MAC_H_ +#ifndef ATOM_BROWSER_NOTIFICATIONS_MAC_NOTIFICATION_PRESENTER_MAC_H_ +#define ATOM_BROWSER_NOTIFICATIONS_MAC_NOTIFICATION_PRESENTER_MAC_H_ +#include "atom/browser/notifications/mac/notification_center_delegate.h" +#include "atom/browser/notifications/notification_presenter.h" #include "base/mac/scoped_nsobject.h" -#include "brightray/browser/mac/notification_center_delegate.h" -#include "brightray/browser/notification_presenter.h" -namespace brightray { +namespace atom { class CocoaNotification; @@ -31,6 +31,6 @@ class NotificationPresenterMac : public NotificationPresenter { DISALLOW_COPY_AND_ASSIGN(NotificationPresenterMac); }; -} // namespace brightray +} // namespace atom -#endif // BRIGHTRAY_BROWSER_MAC_NOTIFICATION_PRESENTER_MAC_H_ +#endif // ATOM_BROWSER_NOTIFICATIONS_MAC_NOTIFICATION_PRESENTER_MAC_H_ diff --git a/brightray/browser/mac/notification_presenter_mac.mm b/atom/browser/notifications/mac/notification_presenter_mac.mm similarity index 84% rename from brightray/browser/mac/notification_presenter_mac.mm rename to atom/browser/notifications/mac/notification_presenter_mac.mm index db1805c2db7..63af7051c23 100644 --- a/brightray/browser/mac/notification_presenter_mac.mm +++ b/atom/browser/notifications/mac/notification_presenter_mac.mm @@ -2,12 +2,12 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. -#include "brightray/browser/mac/notification_presenter_mac.h" +#include "atom/browser/notifications/mac/notification_presenter_mac.h" -#include "brightray/browser/mac/cocoa_notification.h" -#include "brightray/browser/mac/notification_center_delegate.h" +#include "atom/browser/notifications/mac/cocoa_notification.h" +#include "atom/browser/notifications/mac/notification_center_delegate.h" -namespace brightray { +namespace atom { // static NotificationPresenter* NotificationPresenter::Create() { @@ -47,4 +47,4 @@ Notification* NotificationPresenterMac::CreateNotificationObject( return new CocoaNotification(delegate, this); } -} // namespace brightray +} // namespace atom diff --git a/brightray/browser/notification.cc b/atom/browser/notifications/notification.cc similarity index 81% rename from brightray/browser/notification.cc rename to atom/browser/notifications/notification.cc index 0d0fd5870a2..b51c9eb3e06 100644 --- a/brightray/browser/notification.cc +++ b/atom/browser/notifications/notification.cc @@ -2,12 +2,12 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. -#include "brightray/browser/notification.h" +#include "atom/browser/notifications/notification.h" -#include "brightray/browser/notification_delegate.h" -#include "brightray/browser/notification_presenter.h" +#include "atom/browser/notifications/notification_delegate.h" +#include "atom/browser/notifications/notification_presenter.h" -namespace brightray { +namespace atom { NotificationOptions::NotificationOptions() = default; NotificationOptions::~NotificationOptions() = default; @@ -43,4 +43,4 @@ void Notification::Destroy() { presenter()->RemoveNotification(this); } -} // namespace brightray +} // namespace atom diff --git a/brightray/browser/notification.h b/atom/browser/notifications/notification.h similarity index 91% rename from brightray/browser/notification.h rename to atom/browser/notifications/notification.h index efb8752f359..d95c768e6a7 100644 --- a/brightray/browser/notification.h +++ b/atom/browser/notifications/notification.h @@ -2,8 +2,8 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. -#ifndef BRIGHTRAY_BROWSER_NOTIFICATION_H_ -#define BRIGHTRAY_BROWSER_NOTIFICATION_H_ +#ifndef ATOM_BROWSER_NOTIFICATIONS_NOTIFICATION_H_ +#define ATOM_BROWSER_NOTIFICATIONS_NOTIFICATION_H_ #include #include @@ -13,7 +13,7 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "url/gurl.h" -namespace brightray { +namespace atom { class NotificationDelegate; class NotificationPresenter; @@ -84,6 +84,6 @@ class Notification { DISALLOW_COPY_AND_ASSIGN(Notification); }; -} // namespace brightray +} // namespace atom -#endif // BRIGHTRAY_BROWSER_NOTIFICATION_H_ +#endif // ATOM_BROWSER_NOTIFICATIONS_NOTIFICATION_H_ diff --git a/brightray/browser/notification_delegate.h b/atom/browser/notifications/notification_delegate.h similarity index 76% rename from brightray/browser/notification_delegate.h rename to atom/browser/notifications/notification_delegate.h index 751fa902431..37098841df9 100644 --- a/brightray/browser/notification_delegate.h +++ b/atom/browser/notifications/notification_delegate.h @@ -2,12 +2,12 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. -#ifndef BRIGHTRAY_BROWSER_NOTIFICATION_DELEGATE_H_ -#define BRIGHTRAY_BROWSER_NOTIFICATION_DELEGATE_H_ +#ifndef ATOM_BROWSER_NOTIFICATIONS_NOTIFICATION_DELEGATE_H_ +#define ATOM_BROWSER_NOTIFICATIONS_NOTIFICATION_DELEGATE_H_ #include -namespace brightray { +namespace atom { class NotificationDelegate { public: @@ -30,6 +30,6 @@ class NotificationDelegate { ~NotificationDelegate() = default; }; -} // namespace brightray +} // namespace atom -#endif // BRIGHTRAY_BROWSER_NOTIFICATION_DELEGATE_H_ +#endif // ATOM_BROWSER_NOTIFICATIONS_NOTIFICATION_DELEGATE_H_ diff --git a/brightray/browser/notification_presenter.cc b/atom/browser/notifications/notification_presenter.cc similarity index 88% rename from brightray/browser/notification_presenter.cc rename to atom/browser/notifications/notification_presenter.cc index bb42c90526c..d8be278b013 100644 --- a/brightray/browser/notification_presenter.cc +++ b/atom/browser/notifications/notification_presenter.cc @@ -2,13 +2,13 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. -#include "brightray/browser/notification_presenter.h" +#include "atom/browser/notifications/notification_presenter.h" #include -#include "brightray/browser/notification.h" +#include "atom/browser/notifications/notification.h" -namespace brightray { +namespace atom { NotificationPresenter::NotificationPresenter() {} @@ -41,4 +41,4 @@ void NotificationPresenter::CloseNotificationWithId( (*it)->Dismiss(); } -} // namespace brightray +} // namespace atom diff --git a/brightray/browser/notification_presenter.h b/atom/browser/notifications/notification_presenter.h similarity index 81% rename from brightray/browser/notification_presenter.h rename to atom/browser/notifications/notification_presenter.h index 096b9f4a2f6..f1647d47897 100644 --- a/brightray/browser/notification_presenter.h +++ b/atom/browser/notifications/notification_presenter.h @@ -2,15 +2,15 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. -#ifndef BRIGHTRAY_BROWSER_NOTIFICATION_PRESENTER_H_ -#define BRIGHTRAY_BROWSER_NOTIFICATION_PRESENTER_H_ +#ifndef ATOM_BROWSER_NOTIFICATIONS_NOTIFICATION_PRESENTER_H_ +#define ATOM_BROWSER_NOTIFICATIONS_NOTIFICATION_PRESENTER_H_ #include #include #include "base/memory/weak_ptr.h" -namespace brightray { +namespace atom { class Notification; class NotificationDelegate; @@ -43,6 +43,6 @@ class NotificationPresenter { DISALLOW_COPY_AND_ASSIGN(NotificationPresenter); }; -} // namespace brightray +} // namespace atom -#endif // BRIGHTRAY_BROWSER_NOTIFICATION_PRESENTER_H_ +#endif // ATOM_BROWSER_NOTIFICATIONS_NOTIFICATION_PRESENTER_H_ diff --git a/brightray/browser/platform_notification_service.cc b/atom/browser/notifications/platform_notification_service.cc similarity index 89% rename from brightray/browser/platform_notification_service.cc rename to atom/browser/notifications/platform_notification_service.cc index ef62e238828..bd771202b53 100644 --- a/brightray/browser/platform_notification_service.cc +++ b/atom/browser/notifications/platform_notification_service.cc @@ -2,20 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE-CHROMIUM file. -#include "brightray/browser/platform_notification_service.h" +#include "atom/browser/notifications/platform_notification_service.h" +#include "atom/browser/atom_browser_client.h" +#include "atom/browser/notifications/notification.h" +#include "atom/browser/notifications/notification_delegate.h" +#include "atom/browser/notifications/notification_presenter.h" #include "base/strings/utf_string_conversions.h" -#include "brightray/browser/browser_client.h" -#include "brightray/browser/notification.h" -#include "brightray/browser/notification_delegate.h" -#include "brightray/browser/notification_presenter.h" #include "content/public/browser/notification_event_dispatcher.h" #include "content/public/browser/render_process_host.h" #include "content/public/common/notification_resources.h" #include "content/public/common/platform_notification_data.h" #include "third_party/skia/include/core/SkBitmap.h" -namespace brightray { +namespace atom { namespace { @@ -27,7 +27,7 @@ void OnWebNotificationAllowed(base::WeakPtr notification, if (!notification) return; if (allowed) { - brightray::NotificationOptions options; + atom::NotificationOptions options; options.title = data.title; options.msg = data.body; options.tag = data.tag; @@ -41,7 +41,7 @@ void OnWebNotificationAllowed(base::WeakPtr notification, } } -class NotificationDelegateImpl final : public brightray::NotificationDelegate { +class NotificationDelegateImpl final : public atom::NotificationDelegate { public: explicit NotificationDelegateImpl(const std::string& notification_id) : notification_id_(notification_id) {} @@ -72,7 +72,7 @@ class NotificationDelegateImpl final : public brightray::NotificationDelegate { } // namespace PlatformNotificationService::PlatformNotificationService( - BrowserClient* browser_client) + AtomBrowserClient* browser_client) : browser_client_(browser_client) {} PlatformNotificationService::~PlatformNotificationService() {} @@ -130,4 +130,4 @@ int64_t PlatformNotificationService::ReadNextPersistentNotificationId( return 0; } -} // namespace brightray +} // namespace atom diff --git a/brightray/browser/platform_notification_service.h b/atom/browser/notifications/platform_notification_service.h similarity index 82% rename from brightray/browser/platform_notification_service.h rename to atom/browser/notifications/platform_notification_service.h index b8c7b793d03..7ca6c1efa8d 100644 --- a/brightray/browser/platform_notification_service.h +++ b/atom/browser/notifications/platform_notification_service.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE-CHROMIUM file. -#ifndef BRIGHTRAY_BROWSER_PLATFORM_NOTIFICATION_SERVICE_H_ -#define BRIGHTRAY_BROWSER_PLATFORM_NOTIFICATION_SERVICE_H_ +#ifndef ATOM_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_H_ +#define ATOM_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_H_ #include #include @@ -11,14 +11,14 @@ #include "content/public/browser/browser_context.h" #include "content/public/browser/platform_notification_service.h" -namespace brightray { +namespace atom { -class BrowserClient; +class AtomBrowserClient; class PlatformNotificationService : public content::PlatformNotificationService { public: - explicit PlatformNotificationService(BrowserClient* browser_client); + explicit PlatformNotificationService(AtomBrowserClient* browser_client); ~PlatformNotificationService() override; protected: @@ -48,11 +48,11 @@ class PlatformNotificationService content::BrowserContext* browser_context) override; private: - BrowserClient* browser_client_; + AtomBrowserClient* browser_client_; DISALLOW_COPY_AND_ASSIGN(PlatformNotificationService); }; -} // namespace brightray +} // namespace atom -#endif // BRIGHTRAY_BROWSER_PLATFORM_NOTIFICATION_SERVICE_H_ +#endif // ATOM_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_H_ diff --git a/brightray/browser/win/notification_presenter_win.cc b/atom/browser/notifications/win/notification_presenter_win.cc similarity index 92% rename from brightray/browser/win/notification_presenter_win.cc rename to atom/browser/notifications/win/notification_presenter_win.cc index 4687bba1742..df49b8ceba1 100644 --- a/brightray/browser/win/notification_presenter_win.cc +++ b/atom/browser/notifications/win/notification_presenter_win.cc @@ -4,12 +4,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE-CHROMIUM file. -#include "brightray/browser/win/notification_presenter_win.h" +#include "atom/browser/notifications/win/notification_presenter_win.h" #include #include #include +#include "atom/browser/notifications/win/notification_presenter_win7.h" +#include "atom/browser/notifications/win/windows_toast_notification.h" #include "base/environment.h" #include "base/files/file_util.h" #include "base/md5.h" @@ -17,15 +19,13 @@ #include "base/threading/thread_restrictions.h" #include "base/time/time.h" #include "base/win/windows_version.h" -#include "brightray/browser/win/notification_presenter_win7.h" -#include "brightray/browser/win/windows_toast_notification.h" #include "content/public/common/platform_notification_data.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/codec/png_codec.h" #pragma comment(lib, "runtimeobject.lib") -namespace brightray { +namespace atom { namespace { @@ -98,4 +98,4 @@ Notification* NotificationPresenterWin::CreateNotificationObject( return new WindowsToastNotification(delegate, this); } -} // namespace brightray +} // namespace atom diff --git a/brightray/browser/win/notification_presenter_win.h b/atom/browser/notifications/win/notification_presenter_win.h similarity index 81% rename from brightray/browser/win/notification_presenter_win.h rename to atom/browser/notifications/win/notification_presenter_win.h index f954489704c..874a9d0cb2c 100644 --- a/brightray/browser/win/notification_presenter_win.h +++ b/atom/browser/notifications/win/notification_presenter_win.h @@ -20,17 +20,17 @@ // console.log("Notification dismissed") // }; -#ifndef BRIGHTRAY_BROWSER_WIN_NOTIFICATION_PRESENTER_WIN_H_ -#define BRIGHTRAY_BROWSER_WIN_NOTIFICATION_PRESENTER_WIN_H_ +#ifndef ATOM_BROWSER_NOTIFICATIONS_WIN_NOTIFICATION_PRESENTER_WIN_H_ +#define ATOM_BROWSER_NOTIFICATIONS_WIN_NOTIFICATION_PRESENTER_WIN_H_ +#include "atom/browser/notifications/notification_presenter.h" #include "base/files/scoped_temp_dir.h" #include "base/strings/string16.h" -#include "brightray/browser/notification_presenter.h" class GURL; class SkBitmap; -namespace brightray { +namespace atom { class NotificationPresenterWin : public NotificationPresenter { public: @@ -50,6 +50,6 @@ class NotificationPresenterWin : public NotificationPresenter { DISALLOW_COPY_AND_ASSIGN(NotificationPresenterWin); }; -} // namespace brightray +} // namespace atom -#endif // BRIGHTRAY_BROWSER_WIN_NOTIFICATION_PRESENTER_WIN_H_ +#endif // ATOM_BROWSER_NOTIFICATIONS_WIN_NOTIFICATION_PRESENTER_WIN_H_ diff --git a/brightray/browser/win/notification_presenter_win7.cc b/atom/browser/notifications/win/notification_presenter_win7.cc similarity index 68% rename from brightray/browser/win/notification_presenter_win7.cc rename to atom/browser/notifications/win/notification_presenter_win7.cc index cbfea8360b9..e4d11ead2d3 100644 --- a/brightray/browser/win/notification_presenter_win7.cc +++ b/atom/browser/notifications/win/notification_presenter_win7.cc @@ -1,12 +1,16 @@ -#include "brightray/browser/win/notification_presenter_win7.h" +// Copyright (c) 2015 GitHub, Inc. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +#include "atom/browser/notifications/win/notification_presenter_win7.h" #include -#include "brightray/browser/win/win32_notification.h" +#include "atom/browser/notifications/win/win32_notification.h" -namespace brightray { +namespace atom { -brightray::Notification* NotificationPresenterWin7::CreateNotificationObject( +atom::Notification* NotificationPresenterWin7::CreateNotificationObject( NotificationDelegate* delegate) { return new Win32Notification(delegate, this); } @@ -34,17 +38,17 @@ Win32Notification* NotificationPresenterWin7::GetNotificationObjectByTag( } void NotificationPresenterWin7::OnNotificationClicked( - Notification& notification) { + const Notification& notification) { auto* n = GetNotificationObjectByRef(notification); if (n) n->NotificationClicked(); } void NotificationPresenterWin7::OnNotificationDismissed( - Notification& notification) { + const Notification& notification) { auto* n = GetNotificationObjectByRef(notification); if (n) n->NotificationDismissed(); } -} // namespace brightray +} // namespace atom diff --git a/atom/browser/notifications/win/notification_presenter_win7.h b/atom/browser/notifications/win/notification_presenter_win7.h new file mode 100644 index 00000000000..0f8992beca4 --- /dev/null +++ b/atom/browser/notifications/win/notification_presenter_win7.h @@ -0,0 +1,39 @@ +// Copyright (c) 2015 GitHub, Inc. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +#ifndef ATOM_BROWSER_NOTIFICATIONS_WIN_NOTIFICATION_PRESENTER_WIN7_H_ +#define ATOM_BROWSER_NOTIFICATIONS_WIN_NOTIFICATION_PRESENTER_WIN7_H_ + +#include + +#include "atom/browser/notifications/notification_presenter.h" +#include "atom/browser/notifications/win/win32_desktop_notifications/desktop_notification_controller.h" + +namespace atom { + +class Win32Notification; + +class NotificationPresenterWin7 : public NotificationPresenter, + public DesktopNotificationController { + public: + NotificationPresenterWin7() = default; + + Win32Notification* GetNotificationObjectByRef( + const DesktopNotificationController::Notification& ref); + + Win32Notification* GetNotificationObjectByTag(const std::string& tag); + + private: + atom::Notification* CreateNotificationObject( + NotificationDelegate* delegate) override; + + void OnNotificationClicked(const Notification& notification) override; + void OnNotificationDismissed(const Notification& notification) override; + + DISALLOW_COPY_AND_ASSIGN(NotificationPresenterWin7); +}; + +} // namespace atom + +#endif // ATOM_BROWSER_NOTIFICATIONS_WIN_NOTIFICATION_PRESENTER_WIN7_H_ diff --git a/brightray/browser/win/win32_desktop_notifications/common.h b/atom/browser/notifications/win/win32_desktop_notifications/common.h similarity index 76% rename from brightray/browser/win/win32_desktop_notifications/common.h rename to atom/browser/notifications/win/win32_desktop_notifications/common.h index f07d43105fc..8b409bbb1a5 100644 --- a/brightray/browser/win/win32_desktop_notifications/common.h +++ b/atom/browser/notifications/win/win32_desktop_notifications/common.h @@ -1,7 +1,13 @@ -#pragma once +// Copyright (c) 2015 GitHub, Inc. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +#ifndef ATOM_BROWSER_NOTIFICATIONS_WIN_WIN32_DESKTOP_NOTIFICATIONS_COMMON_H_ +#define ATOM_BROWSER_NOTIFICATIONS_WIN_WIN32_DESKTOP_NOTIFICATIONS_COMMON_H_ + #include -namespace brightray { +namespace atom { struct NotificationData { DesktopNotificationController* controller = nullptr; @@ -57,4 +63,6 @@ struct ScreenMetrics { } }; -} // namespace brightray +} // namespace atom + +#endif // ATOM_BROWSER_NOTIFICATIONS_WIN_WIN32_DESKTOP_NOTIFICATIONS_COMMON_H_ diff --git a/brightray/browser/win/win32_desktop_notifications/desktop_notification_controller.cc b/atom/browser/notifications/win/win32_desktop_notifications/desktop_notification_controller.cc similarity index 93% rename from brightray/browser/win/win32_desktop_notifications/desktop_notification_controller.cc rename to atom/browser/notifications/win/win32_desktop_notifications/desktop_notification_controller.cc index a13e37a1aba..e89e374668d 100644 --- a/brightray/browser/win/win32_desktop_notifications/desktop_notification_controller.cc +++ b/atom/browser/notifications/win/win32_desktop_notifications/desktop_notification_controller.cc @@ -1,20 +1,29 @@ +// Copyright (c) 2015 GitHub, Inc. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + #ifndef NOMINMAX #define NOMINMAX #endif + #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif -#include "brightray/browser/win/win32_desktop_notifications/desktop_notification_controller.h" + +#include "atom/browser/notifications/win/win32_desktop_notifications/desktop_notification_controller.h" + #include #include +#include #include -#include "brightray/browser/win/win32_desktop_notifications/common.h" -#include "brightray/browser/win/win32_desktop_notifications/toast.h" + +#include "atom/browser/notifications/win/win32_desktop_notifications/common.h" +#include "atom/browser/notifications/win/win32_desktop_notifications/toast.h" using std::make_shared; using std::shared_ptr; -namespace brightray { +namespace atom { HBITMAP CopyBitmap(HBITMAP bitmap) { HBITMAP ret = NULL; @@ -78,7 +87,7 @@ DesktopNotificationController::DesktopNotificationController( DesktopNotificationController::~DesktopNotificationController() { for (auto&& inst : instances_) - DestroyToast(inst); + DestroyToast(&inst); if (hwnd_controller_) DestroyWindow(hwnd_controller_); ClearAssets(); @@ -233,7 +242,7 @@ void DesktopNotificationController::AnimateAll() { it = stable_partition(it, it2, is_alive); // purge the dead items - for_each(it, it2, [this](auto&& inst) { DestroyToast(inst); }); + for_each(it, it2, [this](auto&& inst) { DestroyToast(&inst); }); if (it2 == instances_.end()) { instances_.erase(it, it2); @@ -285,7 +294,7 @@ DesktopNotificationController::AddNotification(std::wstring caption, } void DesktopNotificationController::CloseNotification( - Notification& notification) { + const Notification& notification) { // Remove it from the queue auto it = find(queue_.begin(), queue_.end(), notification.data_); if (it != queue_.end()) { @@ -351,12 +360,12 @@ HWND DesktopNotificationController::GetToast( return (it != instances_.cend()) ? it->hwnd : NULL; } -void DesktopNotificationController::DestroyToast(ToastInstance& inst) { - if (inst.hwnd) { - auto data = Toast::Get(inst.hwnd)->GetNotification(); +void DesktopNotificationController::DestroyToast(ToastInstance* inst) { + if (inst->hwnd) { + auto data = Toast::Get(inst->hwnd)->GetNotification(); - DestroyWindow(inst.hwnd); - inst.hwnd = NULL; + DestroyWindow(inst->hwnd); + inst->hwnd = NULL; Notification notification(data); OnNotificationClosed(notification); @@ -427,4 +436,4 @@ DesktopNotificationController::NotificationLink::~NotificationLink() { p->controller = nullptr; } -} // namespace brightray +} // namespace atom diff --git a/brightray/browser/win/win32_desktop_notifications/desktop_notification_controller.h b/atom/browser/notifications/win/win32_desktop_notifications/desktop_notification_controller.h similarity index 76% rename from brightray/browser/win/win32_desktop_notifications/desktop_notification_controller.h rename to atom/browser/notifications/win/win32_desktop_notifications/desktop_notification_controller.h index d6d8fd35a29..3ba9409b011 100644 --- a/brightray/browser/win/win32_desktop_notifications/desktop_notification_controller.h +++ b/atom/browser/notifications/win/win32_desktop_notifications/desktop_notification_controller.h @@ -1,11 +1,17 @@ -#pragma once +// Copyright (c) 2015 GitHub, Inc. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +#ifndef ATOM_BROWSER_NOTIFICATIONS_WIN_WIN32_DESKTOP_NOTIFICATIONS_DESKTOP_NOTIFICATION_CONTROLLER_H_ +#define ATOM_BROWSER_NOTIFICATIONS_WIN_WIN32_DESKTOP_NOTIFICATIONS_DESKTOP_NOTIFICATION_CONTROLLER_H_ + #include #include #include #include #include -namespace brightray { +namespace atom { struct NotificationData; @@ -18,13 +24,13 @@ class DesktopNotificationController { Notification AddNotification(std::wstring caption, std::wstring body_text, HBITMAP image); - void CloseNotification(Notification& notification); + void CloseNotification(const Notification& notification); // Event handlers -- override to receive the events private: - virtual void OnNotificationClosed(Notification& notification) {} - virtual void OnNotificationClicked(Notification& notification) {} - virtual void OnNotificationDismissed(Notification& notification) {} + virtual void OnNotificationClosed(const Notification& notification) {} + virtual void OnNotificationClicked(const Notification& notification) {} + virtual void OnNotificationDismissed(const Notification& notification) {} private: static HINSTANCE RegisterWndClasses(); @@ -73,7 +79,7 @@ class DesktopNotificationController { void CheckQueue(); void CreateToast(NotificationLink&& data); HWND GetToast(const NotificationData* data) const; - void DestroyToast(ToastInstance& inst); + void DestroyToast(ToastInstance* inst); private: static const TCHAR class_name_[]; @@ -103,4 +109,6 @@ class DesktopNotificationController::Notification { friend class DesktopNotificationController; }; -} // namespace brightray +} // namespace atom + +#endif // ATOM_BROWSER_NOTIFICATIONS_WIN_WIN32_DESKTOP_NOTIFICATIONS_DESKTOP_NOTIFICATION_CONTROLLER_H_ diff --git a/brightray/browser/win/win32_desktop_notifications/toast.cc b/atom/browser/notifications/win/win32_desktop_notifications/toast.cc similarity index 98% rename from brightray/browser/win/win32_desktop_notifications/toast.cc rename to atom/browser/notifications/win/win32_desktop_notifications/toast.cc index d550d4d76b8..eca973277f4 100644 --- a/brightray/browser/win/win32_desktop_notifications/toast.cc +++ b/atom/browser/notifications/win/win32_desktop_notifications/toast.cc @@ -1,7 +1,11 @@ +// Copyright (c) 2015 GitHub, Inc. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + #ifndef NOMINMAX #define NOMINMAX #endif -#include "brightray/browser/win/win32_desktop_notifications/toast.h" +#include "atom/browser/notifications/win/win32_desktop_notifications/toast.h" #include @@ -11,9 +15,9 @@ #include #include +#include "atom/browser/notifications/win/win32_desktop_notifications/common.h" +#include "atom/browser/notifications/win/win32_desktop_notifications/toast_uia.h" #include "base/logging.h" -#include "brightray/browser/win/win32_desktop_notifications/common.h" -#include "brightray/browser/win/win32_desktop_notifications/toast_uia.h" #pragma comment(lib, "msimg32.lib") #pragma comment(lib, "uxtheme.lib") @@ -21,7 +25,7 @@ using std::min; using std::shared_ptr; -namespace brightray { +namespace atom { static COLORREF GetAccentColor() { bool success = false; @@ -346,7 +350,7 @@ LRESULT DesktopNotificationController::Toast::WndProc(HWND hwnd, HWND DesktopNotificationController::Toast::Create( HINSTANCE hinstance, - shared_ptr& data) { + shared_ptr data) { return CreateWindowEx(WS_EX_LAYERED | WS_EX_NOACTIVATE | WS_EX_TOPMOST, class_name_, nullptr, WS_POPUP, 0, 0, 0, 0, NULL, NULL, hinstance, &data); @@ -851,4 +855,4 @@ float DesktopNotificationController::Toast::AnimateStackCollapse() { return pos; } -} // namespace brightray +} // namespace atom diff --git a/brightray/browser/win/win32_desktop_notifications/toast.h b/atom/browser/notifications/win/win32_desktop_notifications/toast.h similarity index 79% rename from brightray/browser/win/win32_desktop_notifications/toast.h rename to atom/browser/notifications/win/win32_desktop_notifications/toast.h index 4e8ba8949e5..1d8a7b79046 100644 --- a/brightray/browser/win/win32_desktop_notifications/toast.h +++ b/atom/browser/notifications/win/win32_desktop_notifications/toast.h @@ -1,13 +1,21 @@ -#pragma once -#include "brightray/browser/win/win32_desktop_notifications/desktop_notification_controller.h" +// Copyright (c) 2015 GitHub, Inc. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. -namespace brightray { +#ifndef ATOM_BROWSER_NOTIFICATIONS_WIN_WIN32_DESKTOP_NOTIFICATIONS_TOAST_H_ +#define ATOM_BROWSER_NOTIFICATIONS_WIN_WIN32_DESKTOP_NOTIFICATIONS_TOAST_H_ + +#include + +#include "atom/browser/notifications/win/win32_desktop_notifications/desktop_notification_controller.h" + +namespace atom { class DesktopNotificationController::Toast { public: static void Register(HINSTANCE hinstance); static HWND Create(HINSTANCE hinstance, - std::shared_ptr& data); + std::shared_ptr data); static Toast* Get(HWND hwnd) { return reinterpret_cast(GetWindowLongPtr(hwnd, 0)); } @@ -92,4 +100,6 @@ class DesktopNotificationController::Toast { float ease_in_pos_ = 0, ease_out_pos_ = 0, stack_collapse_pos_ = 0; }; -} // namespace brightray +} // namespace atom + +#endif // ATOM_BROWSER_NOTIFICATIONS_WIN_WIN32_DESKTOP_NOTIFICATIONS_TOAST_H_ diff --git a/brightray/browser/win/win32_desktop_notifications/toast_uia.cc b/atom/browser/notifications/win/win32_desktop_notifications/toast_uia.cc similarity index 94% rename from brightray/browser/win/win32_desktop_notifications/toast_uia.cc rename to atom/browser/notifications/win/win32_desktop_notifications/toast_uia.cc index 0d51c61967e..349b82b73c8 100644 --- a/brightray/browser/win/win32_desktop_notifications/toast_uia.cc +++ b/atom/browser/notifications/win/win32_desktop_notifications/toast_uia.cc @@ -1,10 +1,14 @@ -#include "brightray/browser/win/win32_desktop_notifications/toast_uia.h" +// Copyright (c) 2015 GitHub, Inc. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +#include "atom/browser/notifications/win/win32_desktop_notifications/toast_uia.h" #include -#include "brightray/browser/win/win32_desktop_notifications/common.h" +#include "atom/browser/notifications/win/win32_desktop_notifications/common.h" #pragma comment(lib, "uiautomationcore.lib") -namespace brightray { +namespace atom { DesktopNotificationController::Toast::UIAutomationInterface:: UIAutomationInterface(Toast* toast) @@ -247,4 +251,4 @@ HRESULT DesktopNotificationController::Toast::UIAutomationInterface:: return S_OK; } -} // namespace brightray +} // namespace atom diff --git a/brightray/browser/win/win32_desktop_notifications/toast_uia.h b/atom/browser/notifications/win/win32_desktop_notifications/toast_uia.h similarity index 82% rename from brightray/browser/win/win32_desktop_notifications/toast_uia.h rename to atom/browser/notifications/win/win32_desktop_notifications/toast_uia.h index 4f14e480fc9..e814674840f 100644 --- a/brightray/browser/win/win32_desktop_notifications/toast_uia.h +++ b/atom/browser/notifications/win/win32_desktop_notifications/toast_uia.h @@ -1,13 +1,17 @@ -#ifndef BRIGHTRAY_BROWSER_WIN_WIN32_DESKTOP_NOTIFICATIONS_TOAST_UIA_H_ -#define BRIGHTRAY_BROWSER_WIN_WIN32_DESKTOP_NOTIFICATIONS_TOAST_UIA_H_ +// Copyright (c) 2015 GitHub, Inc. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. -#include "brightray/browser/win/win32_desktop_notifications/toast.h" +#ifndef ATOM_BROWSER_NOTIFICATIONS_WIN_WIN32_DESKTOP_NOTIFICATIONS_TOAST_UIA_H_ +#define ATOM_BROWSER_NOTIFICATIONS_WIN_WIN32_DESKTOP_NOTIFICATIONS_TOAST_UIA_H_ + +#include "atom/browser/notifications/win/win32_desktop_notifications/toast.h" #include #include -namespace brightray { +namespace atom { class DesktopNotificationController::Toast::UIAutomationInterface : public IRawElementProviderSimple, @@ -75,6 +79,6 @@ class DesktopNotificationController::Toast::UIAutomationInterface std::wstring text_; }; -} // namespace brightray +} // namespace atom -#endif // BRIGHTRAY_BROWSER_WIN_WIN32_DESKTOP_NOTIFICATIONS_TOAST_UIA_H_ +#endif // ATOM_BROWSER_NOTIFICATIONS_WIN_WIN32_DESKTOP_NOTIFICATIONS_TOAST_UIA_H_ diff --git a/brightray/browser/win/win32_notification.cc b/atom/browser/notifications/win/win32_notification.cc similarity index 86% rename from brightray/browser/win/win32_notification.cc rename to atom/browser/notifications/win/win32_notification.cc index db7714b214b..aba61f49101 100644 --- a/brightray/browser/win/win32_notification.cc +++ b/atom/browser/notifications/win/win32_notification.cc @@ -1,8 +1,12 @@ +// Copyright (c) 2015 GitHub, Inc. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif -#include "brightray/browser/win/win32_notification.h" +#include "atom/browser/notifications/win/win32_notification.h" #include #include @@ -11,7 +15,7 @@ #include "third_party/skia/include/core/SkBitmap.h" -namespace brightray { +namespace atom { void Win32Notification::Show(const NotificationOptions& options) { auto* presenter = static_cast(this->presenter()); @@ -60,4 +64,4 @@ void Win32Notification::Dismiss() { notification_ref_.Close(); } -} // namespace brightray +} // namespace atom diff --git a/atom/browser/notifications/win/win32_notification.h b/atom/browser/notifications/win/win32_notification.h new file mode 100644 index 00000000000..0b128877e80 --- /dev/null +++ b/atom/browser/notifications/win/win32_notification.h @@ -0,0 +1,38 @@ +// Copyright (c) 2015 GitHub, Inc. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +#ifndef ATOM_BROWSER_NOTIFICATIONS_WIN_WIN32_NOTIFICATION_H_ +#define ATOM_BROWSER_NOTIFICATIONS_WIN_WIN32_NOTIFICATION_H_ + +#include + +#include "atom/browser/notifications/notification.h" +#include "atom/browser/notifications/win/notification_presenter_win7.h" + +namespace atom { + +class Win32Notification : public atom::Notification { + public: + Win32Notification(NotificationDelegate* delegate, + NotificationPresenterWin7* presenter) + : Notification(delegate, presenter) {} + void Show(const NotificationOptions& options) override; + void Dismiss() override; + + const DesktopNotificationController::Notification& GetRef() const { + return notification_ref_; + } + + const std::string& GetTag() const { return tag_; } + + private: + DesktopNotificationController::Notification notification_ref_; + std::string tag_; + + DISALLOW_COPY_AND_ASSIGN(Win32Notification); +}; + +} // namespace atom + +#endif // ATOM_BROWSER_NOTIFICATIONS_WIN_WIN32_NOTIFICATION_H_ diff --git a/brightray/browser/win/windows_toast_notification.cc b/atom/browser/notifications/win/windows_toast_notification.cc similarity index 97% rename from brightray/browser/win/windows_toast_notification.cc rename to atom/browser/notifications/win/windows_toast_notification.cc index 4f1fe9cba5c..f1e210019be 100644 --- a/brightray/browser/win/windows_toast_notification.cc +++ b/atom/browser/notifications/win/windows_toast_notification.cc @@ -6,15 +6,15 @@ // this code // and released it as MIT to the world. -#include "brightray/browser/win/windows_toast_notification.h" +#include "atom/browser/notifications/win/windows_toast_notification.h" #include #include +#include "atom/browser/notifications/notification_delegate.h" +#include "atom/browser/notifications/win/notification_presenter_win.h" #include "base/environment.h" #include "base/strings/utf_string_conversions.h" -#include "brightray/browser/notification_delegate.h" -#include "brightray/browser/win/notification_presenter_win.h" #include "brightray/browser/win/scoped_hstring.h" #include "brightray/common/application_info.h" #include "content/public/browser/browser_thread.h" @@ -27,7 +27,7 @@ using ABI::Windows::Data::Xml::Dom::IXmlNode; using ABI::Windows::Data::Xml::Dom::IXmlNodeList; using ABI::Windows::Data::Xml::Dom::IXmlText; -namespace brightray { +namespace atom { namespace { @@ -58,13 +58,13 @@ bool WindowsToastNotification::Initialize() { &toast_manager_))) return false; - if (IsRunningInDesktopBridge()) { + if (brightray::IsRunningInDesktopBridge()) { // Ironically, the Desktop Bridge / UWP environment // requires us to not give Windows an appUserModelId. return SUCCEEDED(toast_manager_->CreateToastNotifier(&toast_notifier_)); } else { ScopedHString app_id; - if (!GetAppUserModelID(&app_id)) + if (!brightray::GetAppUserModelID(&app_id)) return false; return SUCCEEDED( @@ -444,4 +444,4 @@ IFACEMETHODIMP ToastEventHandler::Invoke( return S_OK; } -} // namespace brightray +} // namespace atom diff --git a/brightray/browser/win/windows_toast_notification.h b/atom/browser/notifications/win/windows_toast_notification.h similarity index 93% rename from brightray/browser/win/windows_toast_notification.h rename to atom/browser/notifications/win/windows_toast_notification.h index 6e368fb38dc..3d415a885ab 100644 --- a/brightray/browser/win/windows_toast_notification.h +++ b/atom/browser/notifications/win/windows_toast_notification.h @@ -6,8 +6,8 @@ // this code // and released it as MIT to the world. -#ifndef BRIGHTRAY_BROWSER_WIN_WINDOWS_TOAST_NOTIFICATION_H_ -#define BRIGHTRAY_BROWSER_WIN_WINDOWS_TOAST_NOTIFICATION_H_ +#ifndef ATOM_BROWSER_NOTIFICATIONS_WIN_WINDOWS_TOAST_NOTIFICATION_H_ +#define ATOM_BROWSER_NOTIFICATIONS_WIN_WINDOWS_TOAST_NOTIFICATION_H_ #include #include @@ -15,7 +15,7 @@ #include #include -#include "brightray/browser/notification.h" +#include "atom/browser/notifications/notification.h" using Microsoft::WRL::ClassicCom; using Microsoft::WRL::ComPtr; @@ -25,7 +25,7 @@ using Microsoft::WRL::RuntimeClassFlags; class ScopedHString; -namespace brightray { +namespace atom { using DesktopToastActivatedEventHandler = ABI::Windows::Foundation::ITypedEventHandler< @@ -126,6 +126,6 @@ class ToastEventHandler : public RuntimeClass, DISALLOW_COPY_AND_ASSIGN(ToastEventHandler); }; -} // namespace brightray +} // namespace atom -#endif // BRIGHTRAY_BROWSER_WIN_WINDOWS_TOAST_NOTIFICATION_H_ +#endif // ATOM_BROWSER_NOTIFICATIONS_WIN_WINDOWS_TOAST_NOTIFICATION_H_ diff --git a/brightray/BUILD.gn b/brightray/BUILD.gn index 6d7ebbffb6d..b1a0d22fc97 100644 --- a/brightray/BUILD.gn +++ b/brightray/BUILD.gn @@ -50,22 +50,10 @@ static_library("brightray") { "browser/inspectable_web_contents_view_delegate.h", "browser/inspectable_web_contents_view_mac.h", "browser/inspectable_web_contents_view_mac.mm", - "browser/linux/libnotify_loader.cc", - "browser/linux/libnotify_loader.h", - "browser/linux/libnotify_notification.cc", - "browser/linux/libnotify_notification.h", - "browser/linux/notification_presenter_linux.cc", - "browser/linux/notification_presenter_linux.h", "browser/mac/bry_inspectable_web_contents_view.h", "browser/mac/bry_inspectable_web_contents_view.mm", - "browser/mac/cocoa_notification.h", - "browser/mac/cocoa_notification.mm", "browser/mac/event_dispatching_window.h", "browser/mac/event_dispatching_window.mm", - "browser/mac/notification_center_delegate.h", - "browser/mac/notification_center_delegate.mm", - "browser/mac/notification_presenter_mac.h", - "browser/mac/notification_presenter_mac.mm", "browser/media/media_capture_devices_dispatcher.cc", "browser/media/media_capture_devices_dispatcher.h", "browser/media/media_device_id_salt.cc", @@ -74,36 +62,14 @@ static_library("brightray") { "browser/media/media_stream_devices_controller.h", "browser/net/require_ct_delegate.cc", "browser/net/require_ct_delegate.h", - "browser/notification.cc", - "browser/notification.h", - "browser/notification_delegate.h", - "browser/notification_presenter.cc", - "browser/notification_presenter.h", - "browser/platform_notification_service.cc", - "browser/platform_notification_service.h", "browser/views/inspectable_web_contents_view_views.cc", "browser/views/inspectable_web_contents_view_views.h", "browser/views/views_delegate.cc", "browser/views/views_delegate.h", "browser/web_ui_controller_factory.cc", "browser/web_ui_controller_factory.h", - "browser/win/notification_presenter_win.cc", - "browser/win/notification_presenter_win.h", - "browser/win/notification_presenter_win7.cc", - "browser/win/notification_presenter_win7.h", "browser/win/scoped_hstring.cc", "browser/win/scoped_hstring.h", - "browser/win/win32_desktop_notifications/common.h", - "browser/win/win32_desktop_notifications/desktop_notification_controller.cc", - "browser/win/win32_desktop_notifications/desktop_notification_controller.h", - "browser/win/win32_desktop_notifications/toast.cc", - "browser/win/win32_desktop_notifications/toast.h", - "browser/win/win32_desktop_notifications/toast_uia.cc", - "browser/win/win32_desktop_notifications/toast_uia.h", - "browser/win/win32_notification.cc", - "browser/win/win32_notification.h", - "browser/win/windows_toast_notification.cc", - "browser/win/windows_toast_notification.h", "browser/zoom_level_delegate.cc", "browser/zoom_level_delegate.h", "common/application_info.cc", diff --git a/brightray/browser/browser_client.cc b/brightray/browser/browser_client.cc index ff9c8c71dc5..0e73b194207 100644 --- a/brightray/browser/browser_client.cc +++ b/brightray/browser/browser_client.cc @@ -10,8 +10,6 @@ #include "brightray/browser/browser_main_parts.h" #include "brightray/browser/devtools_manager_delegate.h" #include "brightray/browser/media/media_capture_devices_dispatcher.h" -#include "brightray/browser/notification_presenter.h" -#include "brightray/browser/platform_notification_service.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/url_constants.h" @@ -59,20 +57,6 @@ BrowserClient::BrowserClient() : browser_main_parts_(nullptr) { BrowserClient::~BrowserClient() {} -void BrowserClient::WebNotificationAllowed( - int render_process_id, - const base::Callback& callback) { - callback.Run(false, true); -} - -NotificationPresenter* BrowserClient::GetNotificationPresenter() { - if (!notification_presenter_) { - // Create a new presenter if on OS X, Linux, or Windows 7+ - notification_presenter_.reset(NotificationPresenter::Create()); - } - return notification_presenter_.get(); -} - BrowserMainParts* BrowserClient::OverrideCreateBrowserMainParts( const content::MainFunctionParams&) { return new BrowserMainParts; @@ -89,13 +73,6 @@ content::MediaObserver* BrowserClient::GetMediaObserver() { return MediaCaptureDevicesDispatcher::GetInstance(); } -content::PlatformNotificationService* -BrowserClient::GetPlatformNotificationService() { - if (!notification_service_) - notification_service_.reset(new PlatformNotificationService(this)); - return notification_service_.get(); -} - void BrowserClient::GetAdditionalAllowedSchemesForFileSystem( std::vector* additional_schemes) { additional_schemes->push_back(content::kChromeDevToolsScheme); diff --git a/brightray/browser/browser_client.h b/brightray/browser/browser_client.h index fea45cfac19..3e59448c307 100644 --- a/brightray/browser/browser_client.h +++ b/brightray/browser/browser_client.h @@ -14,8 +14,6 @@ namespace brightray { class BrowserMainParts; -class NotificationPresenter; -class PlatformNotificationService; class BrowserClient : public content::ContentBrowserClient { public: @@ -27,20 +25,11 @@ class BrowserClient : public content::ContentBrowserClient { BrowserMainParts* browser_main_parts() { return browser_main_parts_; } - NotificationPresenter* GetNotificationPresenter(); - - // Subclasses should override this to enable or disable WebNotification. - virtual void WebNotificationAllowed( - int render_process_id, - const base::Callback& callback); - // Subclasses that override this (e.g., to provide their own protocol // handlers) should call this implementation after doing their own work. content::BrowserMainParts* CreateBrowserMainParts( const content::MainFunctionParams&) override; content::MediaObserver* GetMediaObserver() override; - content::PlatformNotificationService* GetPlatformNotificationService() - override; void GetAdditionalAllowedSchemesForFileSystem( std::vector* additional_schemes) override; void GetAdditionalWebUISchemes( @@ -59,9 +48,6 @@ class BrowserClient : public content::ContentBrowserClient { private: BrowserMainParts* browser_main_parts_; - std::unique_ptr notification_service_; - std::unique_ptr notification_presenter_; - DISALLOW_COPY_AND_ASSIGN(BrowserClient); }; diff --git a/brightray/browser/mac/notification_center_delegate.h b/brightray/browser/mac/notification_center_delegate.h deleted file mode 100644 index 49e2c87c306..00000000000 --- a/brightray/browser/mac/notification_center_delegate.h +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) 2015 GitHub, Inc. -// Use of this source code is governed by the MIT license that can be -// found in the LICENSE file. - -#ifndef BROWSER_MAC_NOTIFICATION_DELEGATE_H_ -#define BROWSER_MAC_NOTIFICATION_DELEGATE_H_ - -#import - -namespace brightray { -class NotificationPresenterMac; -} - -@interface NotificationCenterDelegate - : NSObject { - @private - brightray::NotificationPresenterMac* presenter_; -} -- (instancetype)initWithPresenter: - (brightray::NotificationPresenterMac*)presenter; -@end - -#endif // BROWSER_MAC_NOTIFICATION_DELEGATE_H_ diff --git a/brightray/browser/win/notification_presenter_win7.h b/brightray/browser/win/notification_presenter_win7.h deleted file mode 100644 index 26e6f644c15..00000000000 --- a/brightray/browser/win/notification_presenter_win7.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once -#include "brightray/browser/notification_presenter.h" -#include "brightray/browser/win/win32_desktop_notifications/desktop_notification_controller.h" - -namespace brightray { - -class Win32Notification; - -class NotificationPresenterWin7 : public NotificationPresenter, - public DesktopNotificationController { - public: - NotificationPresenterWin7() = default; - - Win32Notification* GetNotificationObjectByRef( - const DesktopNotificationController::Notification& ref); - - Win32Notification* GetNotificationObjectByTag(const std::string& tag); - - private: - brightray::Notification* CreateNotificationObject( - NotificationDelegate* delegate) override; - - void OnNotificationClicked(Notification& notification) override; - void OnNotificationDismissed(Notification& notification) override; - - DISALLOW_COPY_AND_ASSIGN(NotificationPresenterWin7); -}; - -} // namespace brightray diff --git a/brightray/browser/win/win32_notification.h b/brightray/browser/win/win32_notification.h deleted file mode 100644 index 62b66ba23e3..00000000000 --- a/brightray/browser/win/win32_notification.h +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once -#include "brightray/browser/notification.h" -#include "brightray/browser/win/notification_presenter_win7.h" - -namespace brightray { - -class Win32Notification : public brightray::Notification { - public: - Win32Notification(NotificationDelegate* delegate, - NotificationPresenterWin7* presenter) - : Notification(delegate, presenter) {} - void Show(const NotificationOptions& options) override; - void Dismiss() override; - - const DesktopNotificationController::Notification& GetRef() const { - return notification_ref_; - } - - const std::string& GetTag() const { return tag_; } - - private: - DesktopNotificationController::Notification notification_ref_; - std::string tag_; - - DISALLOW_COPY_AND_ASSIGN(Win32Notification); -}; - -} // namespace brightray diff --git a/filenames.gni b/filenames.gni index 28e700afaaa..e45a0cd7770 100644 --- a/filenames.gni +++ b/filenames.gni @@ -321,6 +321,40 @@ filenames = { "atom/browser/net/url_request_fetch_job.h", "atom/browser/net/url_request_stream_job.cc", "atom/browser/net/url_request_stream_job.h", + "atom/browser/notifications/linux/libnotify_loader.cc", + "atom/browser/notifications/linux/libnotify_loader.h", + "atom/browser/notifications/linux/libnotify_notification.cc", + "atom/browser/notifications/linux/libnotify_notification.h", + "atom/browser/notifications/linux/notification_presenter_linux.cc", + "atom/browser/notifications/linux/notification_presenter_linux.h", + "atom/browser/notifications/mac/cocoa_notification.h", + "atom/browser/notifications/mac/cocoa_notification.mm", + "atom/browser/notifications/mac/notification_center_delegate.h", + "atom/browser/notifications/mac/notification_center_delegate.mm", + "atom/browser/notifications/mac/notification_presenter_mac.h", + "atom/browser/notifications/mac/notification_presenter_mac.mm", + "atom/browser/notifications/notification.cc", + "atom/browser/notifications/notification.h", + "atom/browser/notifications/notification_delegate.h", + "atom/browser/notifications/notification_presenter.cc", + "atom/browser/notifications/notification_presenter.h", + "atom/browser/notifications/platform_notification_service.cc", + "atom/browser/notifications/platform_notification_service.h", + "atom/browser/notifications/win/notification_presenter_win.cc", + "atom/browser/notifications/win/notification_presenter_win.h", + "atom/browser/notifications/win/notification_presenter_win7.cc", + "atom/browser/notifications/win/notification_presenter_win7.h", + "atom/browser/notifications/win/win32_desktop_notifications/common.h", + "atom/browser/notifications/win/win32_desktop_notifications/desktop_notification_controller.cc", + "atom/browser/notifications/win/win32_desktop_notifications/desktop_notification_controller.h", + "atom/browser/notifications/win/win32_desktop_notifications/toast.cc", + "atom/browser/notifications/win/win32_desktop_notifications/toast.h", + "atom/browser/notifications/win/win32_desktop_notifications/toast_uia.cc", + "atom/browser/notifications/win/win32_desktop_notifications/toast_uia.h", + "atom/browser/notifications/win/win32_notification.cc", + "atom/browser/notifications/win/win32_notification.h", + "atom/browser/notifications/win/windows_toast_notification.cc", + "atom/browser/notifications/win/windows_toast_notification.h", "atom/browser/node_debugger.cc", "atom/browser/node_debugger.h", "atom/browser/pref_store_delegate.cc", diff --git a/script/lint.js b/script/lint.js index 372e46efa93..f9465311b52 100755 --- a/script/lint.js +++ b/script/lint.js @@ -13,6 +13,7 @@ const BLACKLIST = new Set([ ['atom', 'browser', 'mac', 'atom_application.h'], ['atom', 'browser', 'mac', 'atom_application_delegate.h'], ['atom', 'browser', 'resources', 'win', 'resource.h'], + ['atom', 'browser', 'notifications', 'mac', 'notification_center_delegate.h'], ['atom', 'browser', 'ui', 'cocoa', 'atom_menu_controller.h'], ['atom', 'browser', 'ui', 'cocoa', 'atom_ns_window.h'], ['atom', 'browser', 'ui', 'cocoa', 'atom_ns_window_delegate.h'], @@ -28,15 +29,6 @@ const BLACKLIST = new Set([ ['atom', 'node', 'osfhandle.cc'], ['brightray', 'browser', 'mac', 'bry_inspectable_web_contents_view.h'], ['brightray', 'browser', 'mac', 'event_dispatching_window.h'], - ['brightray', 'browser', 'mac', 'notification_center_delegate.h'], - ['brightray', 'browser', 'win', 'notification_presenter_win7.h'], - ['brightray', 'browser', 'win', 'win32_desktop_notifications', 'common.h'], - ['brightray', 'browser', 'win', 'win32_desktop_notifications', - 'desktop_notification_controller.cc'], - ['brightray', 'browser', 'win', 'win32_desktop_notifications', - 'desktop_notification_controller.h'], - ['brightray', 'browser', 'win', 'win32_desktop_notifications', 'toast.h'], - ['brightray', 'browser', 'win', 'win32_notification.h'], ['spec', 'static', 'jquery-2.0.3.min.js'] ].map(tokens => path.join(SOURCE_ROOT, ...tokens)))