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/panels/panel_browser_window_gtk.h" | 5 #include "chrome/browser/ui/panels/panel_browser_window_gtk.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "chrome/browser/ui/browser_list.h" | 8 #include "chrome/browser/ui/browser_list.h" |
9 #include "chrome/browser/ui/gtk/browser_titlebar.h" | 9 #include "chrome/browser/ui/gtk/browser_titlebar.h" |
10 #include "chrome/browser/ui/panels/panel.h" | 10 #include "chrome/browser/ui/panels/panel.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 this, | 102 this, |
103 chrome::NOTIFICATION_WINDOW_CLOSED, | 103 chrome::NOTIFICATION_WINDOW_CLOSED, |
104 content::Source<GtkWindow>(window())); | 104 content::Source<GtkWindow>(window())); |
105 } | 105 } |
106 | 106 |
107 bool PanelBrowserWindowGtk::GetWindowEdge(int x, int y, GdkWindowEdge* edge) { | 107 bool PanelBrowserWindowGtk::GetWindowEdge(int x, int y, GdkWindowEdge* edge) { |
108 // Only detect the window edge when panels can be resized by the user. | 108 // Only detect the window edge when panels can be resized by the user. |
109 // This method is used by the base class to detect when the cursor has | 109 // This method is used by the base class to detect when the cursor has |
110 // hit the window edge in order to change the cursor to a resize cursor | 110 // hit the window edge in order to change the cursor to a resize cursor |
111 // and to detect when to initiate a resize drag. | 111 // and to detect when to initiate a resize drag. |
112 return panel_->CanResizeByMouse() ? | 112 panel::Resizability resizability = panel_->CanResizeByMouse(); |
113 BrowserWindowGtk::GetWindowEdge(x, y, edge) : FALSE; | 113 if (panel::NOT_RESIZABLE == resizability) |
| 114 return false; |
| 115 |
| 116 if (!BrowserWindowGtk::GetWindowEdge(x, y, edge)) |
| 117 return FALSE; |
| 118 |
| 119 // Special handling if bottom edge is not resizable. |
| 120 if (panel::RESIZABLE_ALL_SIDES_EXCEPT_BOTTOM == resizability) { |
| 121 if (*edge == GDK_WINDOW_EDGE_SOUTH) |
| 122 return FALSE; |
| 123 if (*edge == GDK_WINDOW_EDGE_SOUTH_WEST) |
| 124 *edge = GDK_WINDOW_EDGE_WEST; |
| 125 else if (*edge == GDK_WINDOW_EDGE_SOUTH_EAST) |
| 126 *edge = GDK_WINDOW_EDGE_EAST; |
| 127 } |
| 128 |
| 129 return TRUE; |
114 } | 130 } |
115 | 131 |
116 void PanelBrowserWindowGtk::EnsureDragHelperCreated() { | 132 void PanelBrowserWindowGtk::EnsureDragHelperCreated() { |
117 if (drag_helper_.get()) | 133 if (drag_helper_.get()) |
118 return; | 134 return; |
119 | 135 |
120 drag_helper_.reset(new PanelDragGtk(panel_.get())); | 136 drag_helper_.reset(new PanelDragGtk(panel_.get())); |
121 gtk_box_pack_end(GTK_BOX(window_vbox_), drag_helper_->widget(), | 137 gtk_box_pack_end(GTK_BOX(window_vbox_), drag_helper_->widget(), |
122 FALSE, FALSE, 0); | 138 FALSE, FALSE, 0); |
123 } | 139 } |
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 MessageLoopForUI::current()->RunAllPending(); | 946 MessageLoopForUI::current()->RunAllPending(); |
931 } | 947 } |
932 | 948 |
933 bool NativePanelTestingGtk::IsWindowSizeKnown() const { | 949 bool NativePanelTestingGtk::IsWindowSizeKnown() const { |
934 return !panel_browser_window_gtk_->frame_size_.IsEmpty(); | 950 return !panel_browser_window_gtk_->frame_size_.IsEmpty(); |
935 } | 951 } |
936 | 952 |
937 bool NativePanelTestingGtk::IsAnimatingBounds() const { | 953 bool NativePanelTestingGtk::IsAnimatingBounds() const { |
938 return panel_browser_window_gtk_->IsAnimatingBounds(); | 954 return panel_browser_window_gtk_->IsAnimatingBounds(); |
939 } | 955 } |
OLD | NEW |