FOR_EACH_OBSERVER is removed
This commit is contained in:
parent
85749e4dbd
commit
e91eed6758
7 changed files with 123 additions and 98 deletions
|
@ -7,6 +7,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "atom/browser/atom_browser_main_parts.h"
|
#include "atom/browser/atom_browser_main_parts.h"
|
||||||
|
#include "atom/browser/browser_observer.h"
|
||||||
#include "atom/browser/native_window.h"
|
#include "atom/browser/native_window.h"
|
||||||
#include "atom/browser/window_list.h"
|
#include "atom/browser/window_list.h"
|
||||||
#include "base/files/file_util.h"
|
#include "base/files/file_util.h"
|
||||||
|
@ -82,7 +83,8 @@ void Browser::Shutdown() {
|
||||||
is_shutdown_ = true;
|
is_shutdown_ = true;
|
||||||
is_quiting_ = true;
|
is_quiting_ = true;
|
||||||
|
|
||||||
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnQuit());
|
for (BrowserObserver& observer : observers_)
|
||||||
|
observer.OnQuit();
|
||||||
|
|
||||||
if (base::MessageLoop::current()) {
|
if (base::MessageLoop::current()) {
|
||||||
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||||
|
@ -127,25 +129,25 @@ int Browser::GetBadgeCount() {
|
||||||
|
|
||||||
bool Browser::OpenFile(const std::string& file_path) {
|
bool Browser::OpenFile(const std::string& file_path) {
|
||||||
bool prevent_default = false;
|
bool prevent_default = false;
|
||||||
FOR_EACH_OBSERVER(BrowserObserver,
|
for (BrowserObserver& observer : observers_)
|
||||||
observers_,
|
observer.OnOpenFile(&prevent_default, file_path);
|
||||||
OnOpenFile(&prevent_default, file_path));
|
|
||||||
|
|
||||||
return prevent_default;
|
return prevent_default;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Browser::OpenURL(const std::string& url) {
|
void Browser::OpenURL(const std::string& url) {
|
||||||
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnOpenURL(url));
|
for (BrowserObserver& observer : observers_)
|
||||||
|
observer.OnOpenURL(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Browser::Activate(bool has_visible_windows) {
|
void Browser::Activate(bool has_visible_windows) {
|
||||||
FOR_EACH_OBSERVER(BrowserObserver,
|
for (BrowserObserver& observer : observers_)
|
||||||
observers_,
|
observer.OnActivate(has_visible_windows);
|
||||||
OnActivate(has_visible_windows));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Browser::WillFinishLaunching() {
|
void Browser::WillFinishLaunching() {
|
||||||
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnWillFinishLaunching());
|
for (BrowserObserver& observer : observers_)
|
||||||
|
observer.OnWillFinishLaunching();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Browser::DidFinishLaunching(const base::DictionaryValue& launch_info) {
|
void Browser::DidFinishLaunching(const base::DictionaryValue& launch_info) {
|
||||||
|
@ -155,22 +157,20 @@ void Browser::DidFinishLaunching(const base::DictionaryValue& launch_info) {
|
||||||
base::CreateDirectoryAndGetError(user_data, nullptr);
|
base::CreateDirectoryAndGetError(user_data, nullptr);
|
||||||
|
|
||||||
is_ready_ = true;
|
is_ready_ = true;
|
||||||
FOR_EACH_OBSERVER(BrowserObserver, observers_,
|
for (BrowserObserver& observer : observers_)
|
||||||
OnFinishLaunching(launch_info));
|
observer.OnFinishLaunching(launch_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Browser::OnAccessibilitySupportChanged() {
|
void Browser::OnAccessibilitySupportChanged() {
|
||||||
FOR_EACH_OBSERVER(BrowserObserver,
|
for (BrowserObserver& observer : observers_)
|
||||||
observers_,
|
observer.OnAccessibilitySupportChanged();
|
||||||
OnAccessibilitySupportChanged());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Browser::RequestLogin(
|
void Browser::RequestLogin(
|
||||||
LoginHandler* login_handler,
|
LoginHandler* login_handler,
|
||||||
std::unique_ptr<base::DictionaryValue> request_details) {
|
std::unique_ptr<base::DictionaryValue> request_details) {
|
||||||
FOR_EACH_OBSERVER(BrowserObserver,
|
for (BrowserObserver& observer : observers_)
|
||||||
observers_,
|
observer.OnLogin(login_handler, *(request_details.get()));
|
||||||
OnLogin(login_handler, *(request_details.get())));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Browser::NotifyAndShutdown() {
|
void Browser::NotifyAndShutdown() {
|
||||||
|
@ -178,7 +178,8 @@ void Browser::NotifyAndShutdown() {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool prevent_default = false;
|
bool prevent_default = false;
|
||||||
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnWillQuit(&prevent_default));
|
for (BrowserObserver& observer : observers_)
|
||||||
|
observer.OnWillQuit(&prevent_default);
|
||||||
|
|
||||||
if (prevent_default) {
|
if (prevent_default) {
|
||||||
is_quiting_ = false;
|
is_quiting_ = false;
|
||||||
|
@ -190,9 +191,8 @@ void Browser::NotifyAndShutdown() {
|
||||||
|
|
||||||
bool Browser::HandleBeforeQuit() {
|
bool Browser::HandleBeforeQuit() {
|
||||||
bool prevent_default = false;
|
bool prevent_default = false;
|
||||||
FOR_EACH_OBSERVER(BrowserObserver,
|
for (BrowserObserver& observer : observers_)
|
||||||
observers_,
|
observer.OnBeforeQuit(&prevent_default);
|
||||||
OnBeforeQuit(&prevent_default));
|
|
||||||
|
|
||||||
return !prevent_default;
|
return !prevent_default;
|
||||||
}
|
}
|
||||||
|
@ -205,12 +205,14 @@ void Browser::OnWindowCloseCancelled(NativeWindow* window) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Browser::OnWindowAllClosed() {
|
void Browser::OnWindowAllClosed() {
|
||||||
if (is_exiting_)
|
if (is_exiting_) {
|
||||||
Shutdown();
|
Shutdown();
|
||||||
else if (is_quiting_)
|
} else if (is_quiting_) {
|
||||||
NotifyAndShutdown();
|
NotifyAndShutdown();
|
||||||
else
|
} else {
|
||||||
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnWindowAllClosed());
|
for (BrowserObserver& observer : observers_)
|
||||||
|
observer.OnWindowAllClosed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
|
@ -146,9 +146,8 @@ std::string Browser::GetCurrentActivityType() {
|
||||||
bool Browser::ContinueUserActivity(const std::string& type,
|
bool Browser::ContinueUserActivity(const std::string& type,
|
||||||
const base::DictionaryValue& user_info) {
|
const base::DictionaryValue& user_info) {
|
||||||
bool prevent_default = false;
|
bool prevent_default = false;
|
||||||
FOR_EACH_OBSERVER(BrowserObserver,
|
for (BrowserObserver& observer : observers_)
|
||||||
observers_,
|
observer.OnContinueUserActivity(&prevent_default, type, user_info);
|
||||||
OnContinueUserActivity(&prevent_default, type, user_info));
|
|
||||||
return prevent_default;
|
return prevent_default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -390,9 +390,8 @@ void NativeWindow::CloseFilePreview() {
|
||||||
|
|
||||||
void NativeWindow::RequestToClosePage() {
|
void NativeWindow::RequestToClosePage() {
|
||||||
bool prevent_default = false;
|
bool prevent_default = false;
|
||||||
FOR_EACH_OBSERVER(NativeWindowObserver,
|
for (NativeWindowObserver& observer : observers_)
|
||||||
observers_,
|
observer.WillCloseWindow(&prevent_default);
|
||||||
WillCloseWindow(&prevent_default));
|
|
||||||
if (prevent_default) {
|
if (prevent_default) {
|
||||||
WindowList::WindowCloseCancelled(this);
|
WindowList::WindowCloseCancelled(this);
|
||||||
return;
|
return;
|
||||||
|
@ -423,8 +422,8 @@ void NativeWindow::CloseContents(content::WebContents* source) {
|
||||||
inspectable_web_contents_ = nullptr;
|
inspectable_web_contents_ = nullptr;
|
||||||
Observe(nullptr);
|
Observe(nullptr);
|
||||||
|
|
||||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_,
|
for (NativeWindowObserver& observer : observers_)
|
||||||
WillDestroyNativeObject());
|
observer.WillDestroyNativeObject();
|
||||||
|
|
||||||
// When the web contents is gone, close the window immediately, but the
|
// When the web contents is gone, close the window immediately, but the
|
||||||
// memory will not be freed until you call delete.
|
// memory will not be freed until you call delete.
|
||||||
|
@ -450,7 +449,8 @@ void NativeWindow::RendererUnresponsive(content::WebContents* source) {
|
||||||
|
|
||||||
void NativeWindow::RendererResponsive(content::WebContents* source) {
|
void NativeWindow::RendererResponsive(content::WebContents* source) {
|
||||||
window_unresposive_closure_.Cancel();
|
window_unresposive_closure_.Cancel();
|
||||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnRendererResponsive());
|
for (NativeWindowObserver& observer : observers_)
|
||||||
|
observer.OnRendererResponsive();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::NotifyWindowClosed() {
|
void NativeWindow::NotifyWindowClosed() {
|
||||||
|
@ -460,104 +460,116 @@ void NativeWindow::NotifyWindowClosed() {
|
||||||
WindowList::RemoveWindow(this);
|
WindowList::RemoveWindow(this);
|
||||||
|
|
||||||
is_closed_ = true;
|
is_closed_ = true;
|
||||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowClosed());
|
for (NativeWindowObserver& observer : observers_)
|
||||||
|
observer.OnWindowClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::NotifyWindowBlur() {
|
void NativeWindow::NotifyWindowBlur() {
|
||||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowBlur());
|
for (NativeWindowObserver& observer : observers_)
|
||||||
|
observer.OnWindowBlur();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::NotifyWindowFocus() {
|
void NativeWindow::NotifyWindowFocus() {
|
||||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowFocus());
|
for (NativeWindowObserver& observer : observers_)
|
||||||
|
observer.OnWindowFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::NotifyWindowShow() {
|
void NativeWindow::NotifyWindowShow() {
|
||||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowShow());
|
for (NativeWindowObserver& observer : observers_)
|
||||||
|
observer.OnWindowShow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::NotifyWindowHide() {
|
void NativeWindow::NotifyWindowHide() {
|
||||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowHide());
|
for (NativeWindowObserver& observer : observers_)
|
||||||
|
observer.OnWindowHide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::NotifyWindowMaximize() {
|
void NativeWindow::NotifyWindowMaximize() {
|
||||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowMaximize());
|
for (NativeWindowObserver& observer : observers_)
|
||||||
|
observer.OnWindowMaximize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::NotifyWindowUnmaximize() {
|
void NativeWindow::NotifyWindowUnmaximize() {
|
||||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowUnmaximize());
|
for (NativeWindowObserver& observer : observers_)
|
||||||
|
observer.OnWindowUnmaximize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::NotifyWindowMinimize() {
|
void NativeWindow::NotifyWindowMinimize() {
|
||||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowMinimize());
|
for (NativeWindowObserver& observer : observers_)
|
||||||
|
observer.OnWindowMinimize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::NotifyWindowRestore() {
|
void NativeWindow::NotifyWindowRestore() {
|
||||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowRestore());
|
for (NativeWindowObserver& observer : observers_)
|
||||||
|
observer.OnWindowRestore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::NotifyWindowResize() {
|
void NativeWindow::NotifyWindowResize() {
|
||||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowResize());
|
for (NativeWindowObserver& observer : observers_)
|
||||||
|
observer.OnWindowResize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::NotifyWindowMove() {
|
void NativeWindow::NotifyWindowMove() {
|
||||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowMove());
|
for (NativeWindowObserver& observer : observers_)
|
||||||
|
observer.OnWindowMove();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::NotifyWindowMoved() {
|
void NativeWindow::NotifyWindowMoved() {
|
||||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowMoved());
|
for (NativeWindowObserver& observer : observers_)
|
||||||
|
observer.OnWindowMoved();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::NotifyWindowEnterFullScreen() {
|
void NativeWindow::NotifyWindowEnterFullScreen() {
|
||||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_,
|
for (NativeWindowObserver& observer : observers_)
|
||||||
OnWindowEnterFullScreen());
|
observer.OnWindowEnterFullScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::NotifyWindowScrollTouchBegin() {
|
void NativeWindow::NotifyWindowScrollTouchBegin() {
|
||||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_,
|
for (NativeWindowObserver& observer : observers_)
|
||||||
OnWindowScrollTouchBegin());
|
observer.OnWindowScrollTouchBegin();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::NotifyWindowScrollTouchEnd() {
|
void NativeWindow::NotifyWindowScrollTouchEnd() {
|
||||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_,
|
for (NativeWindowObserver& observer : observers_)
|
||||||
OnWindowScrollTouchEnd());
|
observer.OnWindowScrollTouchEdge();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::NotifyWindowScrollTouchEdge() {
|
void NativeWindow::NotifyWindowScrollTouchEdge() {
|
||||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_,
|
for (NativeWindowObserver& observer : observers_)
|
||||||
OnWindowScrollTouchEdge());
|
observer.OnWindowScrollTouchEdge();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::NotifyWindowSwipe(const std::string& direction) {
|
void NativeWindow::NotifyWindowSwipe(const std::string& direction) {
|
||||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_,
|
for (NativeWindowObserver& observer : observers_)
|
||||||
OnWindowSwipe(direction));
|
observer.OnWindowSwipe(direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::NotifyWindowLeaveFullScreen() {
|
void NativeWindow::NotifyWindowLeaveFullScreen() {
|
||||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_,
|
for (NativeWindowObserver& observer : observers_)
|
||||||
OnWindowLeaveFullScreen());
|
observer.OnWindowLeaveFullScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::NotifyWindowEnterHtmlFullScreen() {
|
void NativeWindow::NotifyWindowEnterHtmlFullScreen() {
|
||||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_,
|
for (NativeWindowObserver& observer : observers_)
|
||||||
OnWindowEnterHtmlFullScreen());
|
observer.OnWindowEnterHtmlFullScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::NotifyWindowLeaveHtmlFullScreen() {
|
void NativeWindow::NotifyWindowLeaveHtmlFullScreen() {
|
||||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_,
|
for (NativeWindowObserver& observer : observers_)
|
||||||
OnWindowLeaveHtmlFullScreen());
|
observer.OnWindowLeaveHtmlFullScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::NotifyWindowExecuteWindowsCommand(
|
void NativeWindow::NotifyWindowExecuteWindowsCommand(
|
||||||
const std::string& command) {
|
const std::string& command) {
|
||||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_,
|
for (NativeWindowObserver& observer : observers_)
|
||||||
OnExecuteWindowsCommand(command));
|
observer.OnExecuteWindowsCommand(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
void NativeWindow::NotifyWindowMessage(
|
void NativeWindow::NotifyWindowMessage(
|
||||||
UINT message, WPARAM w_param, LPARAM l_param) {
|
UINT message, WPARAM w_param, LPARAM l_param) {
|
||||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_,
|
for (NativeWindowObserver& observer : observers_)
|
||||||
OnWindowMessage(message, w_param, l_param));
|
observer.OnWindowMessage(message, w_param, l_param);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -645,14 +657,15 @@ void NativeWindow::ScheduleUnresponsiveEvent(int ms) {
|
||||||
void NativeWindow::NotifyWindowUnresponsive() {
|
void NativeWindow::NotifyWindowUnresponsive() {
|
||||||
window_unresposive_closure_.Cancel();
|
window_unresposive_closure_.Cancel();
|
||||||
|
|
||||||
if (!is_closed_ && !IsUnresponsiveEventSuppressed() && IsEnabled())
|
if (!is_closed_ && !IsUnresponsiveEventSuppressed() && IsEnabled()) {
|
||||||
FOR_EACH_OBSERVER(NativeWindowObserver,
|
for (NativeWindowObserver& observer : observers_)
|
||||||
observers_,
|
observer.OnRendererUnresponsive();
|
||||||
OnRendererUnresponsive());
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::NotifyReadyToShow() {
|
void NativeWindow::NotifyReadyToShow() {
|
||||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnReadyToShow());
|
for (NativeWindowObserver& observer : observers_)
|
||||||
|
observer.OnReadyToShow();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
|
@ -26,9 +26,8 @@ void AtomCookieDelegate::NotifyObservers(
|
||||||
const net::CanonicalCookie& cookie,
|
const net::CanonicalCookie& cookie,
|
||||||
bool removed,
|
bool removed,
|
||||||
net::CookieStore::ChangeCause cause) {
|
net::CookieStore::ChangeCause cause) {
|
||||||
FOR_EACH_OBSERVER(Observer,
|
for (Observer& observer : observers_)
|
||||||
observers_,
|
observer.OnCookieChanged(cookie, removed, cause);
|
||||||
OnCookieChanged(cookie, removed, cause));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AtomCookieDelegate::OnCookieChanged(
|
void AtomCookieDelegate::OnCookieChanged(
|
||||||
|
|
|
@ -42,7 +42,8 @@ bool AtomMenuModel::GetAcceleratorAtWithParams(
|
||||||
|
|
||||||
void AtomMenuModel::MenuWillClose() {
|
void AtomMenuModel::MenuWillClose() {
|
||||||
ui::SimpleMenuModel::MenuWillClose();
|
ui::SimpleMenuModel::MenuWillClose();
|
||||||
FOR_EACH_OBSERVER(Observer, observers_, MenuWillClose());
|
for (Observer& observer : observers_)
|
||||||
|
observer.MenuWillClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
AtomMenuModel* AtomMenuModel::GetSubmenuModelAt(int index) {
|
AtomMenuModel* AtomMenuModel::GetSubmenuModelAt(int index) {
|
||||||
|
|
|
@ -35,53 +35,63 @@ gfx::Rect TrayIcon::GetBounds() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrayIcon::NotifyClicked(const gfx::Rect& bounds, int modifiers) {
|
void TrayIcon::NotifyClicked(const gfx::Rect& bounds, int modifiers) {
|
||||||
FOR_EACH_OBSERVER(TrayIconObserver, observers_, OnClicked(bounds, modifiers));
|
for (TrayIconObserver& observer : observers_)
|
||||||
|
observer.OnClicked(bounds, modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrayIcon::NotifyDoubleClicked(const gfx::Rect& bounds, int modifiers) {
|
void TrayIcon::NotifyDoubleClicked(const gfx::Rect& bounds, int modifiers) {
|
||||||
FOR_EACH_OBSERVER(TrayIconObserver, observers_,
|
for (TrayIconObserver& observer : observers_)
|
||||||
OnDoubleClicked(bounds, modifiers));
|
observer.OnDoubleClicked(bounds, modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrayIcon::NotifyBalloonShow() {
|
void TrayIcon::NotifyBalloonShow() {
|
||||||
FOR_EACH_OBSERVER(TrayIconObserver, observers_, OnBalloonShow());
|
for (TrayIconObserver& observer : observers_)
|
||||||
|
observer.OnBalloonShow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrayIcon::NotifyBalloonClicked() {
|
void TrayIcon::NotifyBalloonClicked() {
|
||||||
FOR_EACH_OBSERVER(TrayIconObserver, observers_, OnBalloonClicked());
|
for (TrayIconObserver& observer : observers_)
|
||||||
|
observer.OnBalloonClicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrayIcon::NotifyBalloonClosed() {
|
void TrayIcon::NotifyBalloonClosed() {
|
||||||
FOR_EACH_OBSERVER(TrayIconObserver, observers_, OnBalloonClosed());
|
for (TrayIconObserver& observer : observers_)
|
||||||
|
observer.OnBalloonClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrayIcon::NotifyRightClicked(const gfx::Rect& bounds, int modifiers) {
|
void TrayIcon::NotifyRightClicked(const gfx::Rect& bounds, int modifiers) {
|
||||||
FOR_EACH_OBSERVER(TrayIconObserver, observers_,
|
for (TrayIconObserver& observer : observers_)
|
||||||
OnRightClicked(bounds, modifiers));
|
observer.OnRightClicked(bounds, modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrayIcon::NotifyDrop() {
|
void TrayIcon::NotifyDrop() {
|
||||||
FOR_EACH_OBSERVER(TrayIconObserver, observers_, OnDrop());
|
for (TrayIconObserver& observer : observers_)
|
||||||
|
observer.OnDrop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrayIcon::NotifyDropFiles(const std::vector<std::string>& files) {
|
void TrayIcon::NotifyDropFiles(const std::vector<std::string>& files) {
|
||||||
FOR_EACH_OBSERVER(TrayIconObserver, observers_, OnDropFiles(files));
|
for (TrayIconObserver& observer : observers_)
|
||||||
|
observer.OnDropFiles(files);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrayIcon::NotifyDropText(const std::string& text) {
|
void TrayIcon::NotifyDropText(const std::string& text) {
|
||||||
FOR_EACH_OBSERVER(TrayIconObserver, observers_, OnDropText(text));
|
for (TrayIconObserver& observer : observers_)
|
||||||
|
observer.OnDropText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrayIcon::NotifyDragEntered() {
|
void TrayIcon::NotifyDragEntered() {
|
||||||
FOR_EACH_OBSERVER(TrayIconObserver, observers_, OnDragEntered());
|
for (TrayIconObserver& observer : observers_)
|
||||||
|
observer.OnDragEntered();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrayIcon::NotifyDragExited() {
|
void TrayIcon::NotifyDragExited() {
|
||||||
FOR_EACH_OBSERVER(TrayIconObserver, observers_, OnDragExited());
|
for (TrayIconObserver& observer : observers_)
|
||||||
|
observer.OnDragExited();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrayIcon::NotifyDragEnded() {
|
void TrayIcon::NotifyDragEnded() {
|
||||||
FOR_EACH_OBSERVER(TrayIconObserver, observers_, OnDragEnded());
|
for (TrayIconObserver& observer : observers_)
|
||||||
|
observer.OnDragEnded();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
|
@ -33,8 +33,8 @@ void WindowList::AddWindow(NativeWindow* window) {
|
||||||
WindowVector& windows = GetInstance()->windows_;
|
WindowVector& windows = GetInstance()->windows_;
|
||||||
windows.push_back(window);
|
windows.push_back(window);
|
||||||
|
|
||||||
FOR_EACH_OBSERVER(WindowListObserver, observers_.Get(),
|
for (WindowListObserver& observer : observers_.Get())
|
||||||
OnWindowAdded(window));
|
observer.OnWindowAdded(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
@ -43,18 +43,19 @@ void WindowList::RemoveWindow(NativeWindow* window) {
|
||||||
windows.erase(std::remove(windows.begin(), windows.end(), window),
|
windows.erase(std::remove(windows.begin(), windows.end(), window),
|
||||||
windows.end());
|
windows.end());
|
||||||
|
|
||||||
FOR_EACH_OBSERVER(WindowListObserver, observers_.Get(),
|
for (WindowListObserver& observer : observers_.Get())
|
||||||
OnWindowRemoved(window));
|
observer.OnWindowRemoved(window);
|
||||||
|
|
||||||
if (windows.size() == 0)
|
if (windows.size() == 0) {
|
||||||
FOR_EACH_OBSERVER(WindowListObserver, observers_.Get(),
|
for (WindowListObserver& observer : observers_.Get())
|
||||||
OnWindowAllClosed());
|
observer.OnWindowAllClosed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void WindowList::WindowCloseCancelled(NativeWindow* window) {
|
void WindowList::WindowCloseCancelled(NativeWindow* window) {
|
||||||
FOR_EACH_OBSERVER(WindowListObserver, observers_.Get(),
|
for (WindowListObserver& observer : observers_.Get())
|
||||||
OnWindowCloseCancelled(window));
|
observer.OnWindowCloseCancelled(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
|
Loading…
Reference in a new issue