| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/tabs/dock_info.h" | 5 #include "chrome/browser/ui/gtk/tabs/window_finder.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "chrome/browser/ui/browser_list.h" | 10 #include "chrome/browser/ui/browser_list.h" |
| 11 #include "chrome/browser/ui/browser_window.h" | 11 #include "chrome/browser/ui/browser_window.h" |
| 12 #include "chrome/browser/ui/gtk/browser_window_gtk.h" | 12 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
| 13 #include "chrome/browser/ui/gtk/gtk_util.h" | 13 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 14 #include "chrome/browser/ui/gtk/tabs/tab_gtk.h" | 14 #include "chrome/browser/ui/gtk/tabs/tab_gtk.h" |
| 15 #include "chrome/browser/ui/host_desktop.h" | 15 #include "chrome/browser/ui/host_desktop.h" |
| 16 #include "ui/base/x/x11_util.h" | 16 #include "ui/base/x/x11_util.h" |
| 17 #include "ui/gfx/native_widget_types.h" | 17 #include "ui/gfx/native_widget_types.h" |
| 18 | 18 |
| 19 namespace { |
| 20 |
| 19 //////////////////////////////////////////////////////////////////////////////// | 21 //////////////////////////////////////////////////////////////////////////////// |
| 20 // BaseWindowFinder | 22 // BaseWindowFinder |
| 21 // | 23 // |
| 22 // Base class used to locate a window. A subclass need only override | 24 // Base class used to locate a window. A subclass need only override |
| 23 // ShouldStopIterating to determine when iteration should stop. | 25 // ShouldStopIterating to determine when iteration should stop. |
| 24 class BaseWindowFinder : public ui::EnumerateWindowsDelegate { | 26 class BaseWindowFinder : public ui::EnumerateWindowsDelegate { |
| 25 public: | 27 public: |
| 26 explicit BaseWindowFinder(const std::set<GtkWidget*>& ignore) { | 28 explicit BaseWindowFinder(const std::set<GtkWidget*>& ignore) { |
| 27 std::set<GtkWidget*>::iterator iter; | 29 std::set<GtkWidget*>::iterator iter; |
| 28 for (iter = ignore.begin(); iter != ignore.end(); iter++) { | 30 for (iter = ignore.begin(); iter != ignore.end(); iter++) { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 // Position of the mouse. | 166 // Position of the mouse. |
| 165 gfx::Point screen_loc_; | 167 gfx::Point screen_loc_; |
| 166 | 168 |
| 167 // The resulting window. This is initially null but set to true in | 169 // The resulting window. This is initially null but set to true in |
| 168 // ShouldStopIterating if an appropriate window is found. | 170 // ShouldStopIterating if an appropriate window is found. |
| 169 XID result_; | 171 XID result_; |
| 170 | 172 |
| 171 DISALLOW_COPY_AND_ASSIGN(LocalProcessWindowFinder); | 173 DISALLOW_COPY_AND_ASSIGN(LocalProcessWindowFinder); |
| 172 }; | 174 }; |
| 173 | 175 |
| 174 // static | 176 } // namespace |
| 175 DockInfo DockInfo::GetDockInfoAtPoint(chrome::HostDesktopType host_desktop_type, | |
| 176 const gfx::Point& screen_point, | |
| 177 const std::set<GtkWidget*>& ignore) { | |
| 178 NOTIMPLEMENTED(); | |
| 179 return DockInfo(); | |
| 180 } | |
| 181 | 177 |
| 182 // static | 178 GtkWindow* GetLocalProcessWindowAtPoint( |
| 183 GtkWindow* DockInfo::GetLocalProcessWindowAtPoint( | |
| 184 chrome::HostDesktopType host_desktop_type, | |
| 185 const gfx::Point& screen_point, | 179 const gfx::Point& screen_point, |
| 186 const std::set<GtkWidget*>& ignore) { | 180 const std::set<GtkWidget*>& ignore) { |
| 187 XID xid = | 181 XID xid = |
| 188 LocalProcessWindowFinder::GetProcessWindowAtPoint(screen_point, ignore); | 182 LocalProcessWindowFinder::GetProcessWindowAtPoint(screen_point, ignore); |
| 189 return BrowserWindowGtk::GetBrowserWindowForXID(xid); | 183 return BrowserWindowGtk::GetBrowserWindowForXID(xid); |
| 190 } | 184 } |
| 191 | |
| 192 bool DockInfo::GetWindowBounds(gfx::Rect* bounds) const { | |
| 193 if (!window()) | |
| 194 return false; | |
| 195 | |
| 196 int x, y, w, h; | |
| 197 gtk_window_get_position(window(), &x, &y); | |
| 198 gtk_window_get_size(window(), &w, &h); | |
| 199 bounds->SetRect(x, y, w, h); | |
| 200 return true; | |
| 201 } | |
| 202 | |
| 203 void DockInfo::SizeOtherWindowTo(const gfx::Rect& bounds) const { | |
| 204 gtk_window_move(window(), bounds.x(), bounds.y()); | |
| 205 gtk_window_resize(window(), bounds.width(), bounds.height()); | |
| 206 } | |
| 207 | |
| 208 // static | |
| 209 int DockInfo::GetHotSpotDeltaY() { | |
| 210 return TabGtk::GetMinimumUnselectedSize().height() - 1; | |
| 211 } | |
| OLD | NEW |