parent
b6aae790cf
commit
6b4b7c9831
8 changed files with 26 additions and 14 deletions
|
@ -15,6 +15,7 @@
|
||||||
#include "atom/browser/common_web_contents_delegate.h"
|
#include "atom/browser/common_web_contents_delegate.h"
|
||||||
#include "atom/browser/ui/autofill_popup.h"
|
#include "atom/browser/ui/autofill_popup.h"
|
||||||
#include "base/observer_list.h"
|
#include "base/observer_list.h"
|
||||||
|
#include "base/observer_list_types.h"
|
||||||
#include "content/common/cursors/webcursor.h"
|
#include "content/common/cursors/webcursor.h"
|
||||||
#include "content/public/browser/keyboard_event_processing_result.h"
|
#include "content/public/browser/keyboard_event_processing_result.h"
|
||||||
#include "content/public/browser/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
|
@ -60,10 +61,13 @@ namespace api {
|
||||||
|
|
||||||
// Certain events are only in WebContentsDelegate, provide our own Observer to
|
// Certain events are only in WebContentsDelegate, provide our own Observer to
|
||||||
// dispatch those events.
|
// dispatch those events.
|
||||||
class ExtendedWebContentsObserver {
|
class ExtendedWebContentsObserver : public base::CheckedObserver {
|
||||||
public:
|
public:
|
||||||
virtual void OnCloseContents() {}
|
virtual void OnCloseContents() {}
|
||||||
virtual void OnRendererResponsive() {}
|
virtual void OnRendererResponsive() {}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
~ExtendedWebContentsObserver() override {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Wrapper around the content::WebContents.
|
// Wrapper around the content::WebContents.
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "atom/browser/login_handler.h"
|
#include "atom/browser/login_handler.h"
|
||||||
#include "base/memory/scoped_refptr.h"
|
#include "base/memory/scoped_refptr.h"
|
||||||
|
#include "base/observer_list_types.h"
|
||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
|
|
||||||
namespace base {
|
namespace base {
|
||||||
|
@ -17,7 +18,7 @@ class DictionaryValue;
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
class BrowserObserver {
|
class BrowserObserver : public base::CheckedObserver {
|
||||||
public:
|
public:
|
||||||
// The browser is about to close all windows.
|
// The browser is about to close all windows.
|
||||||
virtual void OnBeforeQuit(bool* prevent_default) {}
|
virtual void OnBeforeQuit(bool* prevent_default) {}
|
||||||
|
@ -83,7 +84,7 @@ class BrowserObserver {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~BrowserObserver() {}
|
~BrowserObserver() override {}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "base/observer_list_types.h"
|
||||||
#include "base/strings/string16.h"
|
#include "base/strings/string16.h"
|
||||||
#include "base/values.h"
|
#include "base/values.h"
|
||||||
#include "ui/base/window_open_disposition.h"
|
#include "ui/base/window_open_disposition.h"
|
||||||
|
@ -22,9 +23,9 @@ class Rect;
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
class NativeWindowObserver {
|
class NativeWindowObserver : public base::CheckedObserver {
|
||||||
public:
|
public:
|
||||||
virtual ~NativeWindowObserver() {}
|
~NativeWindowObserver() override {}
|
||||||
|
|
||||||
// Called when the web page in window wants to create a popup window.
|
// Called when the web page in window wants to create a popup window.
|
||||||
virtual void WillCreatePopupWindow(const base::string16& frame_name,
|
virtual void WillCreatePopupWindow(const base::string16& frame_name,
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "base/observer_list.h"
|
#include "base/observer_list.h"
|
||||||
|
#include "base/observer_list_types.h"
|
||||||
#include "ui/base/models/simple_menu_model.h"
|
#include "ui/base/models/simple_menu_model.h"
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
@ -33,9 +34,9 @@ class AtomMenuModel : public ui::SimpleMenuModel {
|
||||||
ui::Accelerator* accelerator) const override;
|
ui::Accelerator* accelerator) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Observer {
|
class Observer : public base::CheckedObserver {
|
||||||
public:
|
public:
|
||||||
virtual ~Observer() {}
|
~Observer() override {}
|
||||||
|
|
||||||
// Notifies the menu will open.
|
// Notifies the menu will open.
|
||||||
virtual void OnMenuWillShow() {}
|
virtual void OnMenuWillShow() {}
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "base/observer_list_types.h"
|
||||||
|
|
||||||
namespace gfx {
|
namespace gfx {
|
||||||
class Rect;
|
class Rect;
|
||||||
class Point;
|
class Point;
|
||||||
|
@ -15,7 +17,7 @@ class Point;
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
class TrayIconObserver {
|
class TrayIconObserver : public base::CheckedObserver {
|
||||||
public:
|
public:
|
||||||
virtual void OnClicked(const gfx::Rect& bounds,
|
virtual void OnClicked(const gfx::Rect& bounds,
|
||||||
const gfx::Point& location,
|
const gfx::Point& location,
|
||||||
|
@ -36,7 +38,7 @@ class TrayIconObserver {
|
||||||
virtual void OnMouseMoved(const gfx::Point& location, int modifiers) {}
|
virtual void OnMouseMoved(const gfx::Point& location, int modifiers) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~TrayIconObserver() {}
|
~TrayIconObserver() override {}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
|
@ -70,7 +70,7 @@ class MenuDelegate : public views::MenuDelegate {
|
||||||
views::MenuButton* button_to_open_ = nullptr;
|
views::MenuButton* button_to_open_ = nullptr;
|
||||||
bool hold_first_switch_;
|
bool hold_first_switch_;
|
||||||
|
|
||||||
base::ObserverList<Observer> observers_;
|
base::ObserverList<Observer>::Unchecked observers_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(MenuDelegate);
|
DISALLOW_COPY_AND_ASSIGN(MenuDelegate);
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "base/observer_list_types.h"
|
||||||
#include "content/public/browser/host_zoom_map.h"
|
#include "content/public/browser/host_zoom_map.h"
|
||||||
#include "content/public/browser/web_contents_observer.h"
|
#include "content/public/browser/web_contents_observer.h"
|
||||||
#include "content/public/browser/web_contents_user_data.h"
|
#include "content/public/browser/web_contents_user_data.h"
|
||||||
|
@ -19,7 +20,7 @@ class WebContentsZoomController
|
||||||
: public content::WebContentsObserver,
|
: public content::WebContentsObserver,
|
||||||
public content::WebContentsUserData<WebContentsZoomController> {
|
public content::WebContentsUserData<WebContentsZoomController> {
|
||||||
public:
|
public:
|
||||||
class Observer {
|
class Observer : public base::CheckedObserver {
|
||||||
public:
|
public:
|
||||||
virtual void OnZoomLevelChanged(content::WebContents* web_contents,
|
virtual void OnZoomLevelChanged(content::WebContents* web_contents,
|
||||||
double level,
|
double level,
|
||||||
|
@ -27,7 +28,7 @@ class WebContentsZoomController
|
||||||
virtual void OnZoomControllerWebContentsDestroyed() {}
|
virtual void OnZoomControllerWebContentsDestroyed() {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~Observer() {}
|
~Observer() override {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Defines how zoom changes are handled.
|
// Defines how zoom changes are handled.
|
||||||
|
|
|
@ -5,11 +5,13 @@
|
||||||
#ifndef ATOM_BROWSER_WINDOW_LIST_OBSERVER_H_
|
#ifndef ATOM_BROWSER_WINDOW_LIST_OBSERVER_H_
|
||||||
#define ATOM_BROWSER_WINDOW_LIST_OBSERVER_H_
|
#define ATOM_BROWSER_WINDOW_LIST_OBSERVER_H_
|
||||||
|
|
||||||
|
#include "base/observer_list_types.h"
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
class NativeWindow;
|
class NativeWindow;
|
||||||
|
|
||||||
class WindowListObserver {
|
class WindowListObserver : public base::CheckedObserver {
|
||||||
public:
|
public:
|
||||||
// Called immediately after a window is added to the list.
|
// Called immediately after a window is added to the list.
|
||||||
virtual void OnWindowAdded(NativeWindow* window) {}
|
virtual void OnWindowAdded(NativeWindow* window) {}
|
||||||
|
@ -24,7 +26,7 @@ class WindowListObserver {
|
||||||
virtual void OnWindowAllClosed() {}
|
virtual void OnWindowAllClosed() {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~WindowListObserver() {}
|
~WindowListObserver() override {}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue