summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/dock_info.cc8
-rw-r--r--chrome/browser/dock_info.h22
2 files changed, 30 insertions, 0 deletions
diff --git a/chrome/browser/dock_info.cc b/chrome/browser/dock_info.cc
index 92ee871..a9c2561 100644
--- a/chrome/browser/dock_info.cc
+++ b/chrome/browser/dock_info.cc
@@ -331,8 +331,14 @@ class DockToWindowFinder : public BaseWindowFinder {
// DockInfo -------------------------------------------------------------------
// static
+DockInfo::Factory* DockInfo::factory_ = NULL;
+
+// static
DockInfo DockInfo::GetDockInfoAtPoint(const gfx::Point& screen_point,
const std::set<HWND>& ignore) {
+ if (factory_)
+ return factory_->GetDockInfoAtPoint(screen_point, ignore);
+
// Try docking to a window first.
DockInfo info = DockToWindowFinder::GetDockInfoAtPoint(screen_point, ignore);
if (info.type() != DockInfo::NONE)
@@ -368,6 +374,8 @@ int DockInfo::popup_height() {
HWND DockInfo::GetLocalProcessWindowAtPoint(const gfx::Point& screen_point,
const std::set<HWND>& ignore) {
+ if (factory_)
+ return factory_->GetLocalProcessWindowAtPoint(screen_point, ignore);
return
LocalProcessWindowFinder::GetProcessWindowAtPoint(screen_point, ignore);
}
diff --git a/chrome/browser/dock_info.h b/chrome/browser/dock_info.h
index dd94563..0774e6b 100644
--- a/chrome/browser/dock_info.h
+++ b/chrome/browser/dock_info.h
@@ -25,6 +25,15 @@ class Profile;
// DockInfos are cheap and explicitly allow copy and assignment operators.
class DockInfo {
public:
+ class Factory {
+ public:
+ virtual DockInfo GetDockInfoAtPoint(const gfx::Point& screen_point,
+ const std::set<HWND>& ignore) = 0;
+
+ virtual HWND GetLocalProcessWindowAtPoint(const gfx::Point& screen_point,
+ const std::set<HWND>& ignore) = 0;
+ };
+
// Possible dock positions.
enum Type {
// Indicates there is no valid dock position for the current location.
@@ -48,6 +57,9 @@ class DockInfo {
DockInfo() : type_(NONE), hwnd_(NULL), in_enable_area_(false) {}
+ // Sets the factory.
+ static void set_factory(Factory* factory) { factory_ = factory; }
+
// Size of the popup window shown to indicate a valid dock location.
static int popup_width();
static int popup_height();
@@ -58,6 +70,9 @@ class DockInfo {
//
// If there is no docking position for the specified location the returned
// DockInfo has a type of NONE.
+ //
+ // If a Factory has been set, the method of the same name is invoked on the
+ // Factory to determine the DockInfo.
static DockInfo GetDockInfoAtPoint(const gfx::Point& screen_point,
const std::set<HWND>& ignore);
@@ -65,6 +80,9 @@ class DockInfo {
// See GetDockInfoAtPoint for a description of |ignore|. This returns NULL if
// there is no window from the current process at |screen_point|, or another
// window obscures the topmost window from our process at |screen_point|.
+ //
+ // If a Factory has been set, the method of the same name is invoked on the
+ // Factory to determine the DockInfo.
static HWND GetLocalProcessWindowAtPoint(const gfx::Point& screen_point,
const std::set<HWND>& ignore);
@@ -139,6 +157,10 @@ class DockInfo {
gfx::Point hot_spot_;
gfx::Rect monitor_bounds_;
bool in_enable_area_;
+
+ // Factory that creates DockInfos. By default this is NULL, which gives the
+ // default behavior.
+ static Factory* factory_;
};
#endif // CHROME_BROWSER_DOCK_INFO_H_