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/tabs/dock_info.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 | 10 |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 gfx::Rect DockInfo::GetPopupRect() const { | 217 gfx::Rect DockInfo::GetPopupRect() const { |
218 int x = hot_spot_.x() - popup_width() / 2; | 218 int x = hot_spot_.x() - popup_width() / 2; |
219 int y = hot_spot_.y() - popup_height() / 2; | 219 int y = hot_spot_.y() - popup_height() / 2; |
220 switch (type_) { | 220 switch (type_) { |
221 case LEFT_OF_WINDOW: | 221 case LEFT_OF_WINDOW: |
222 case RIGHT_OF_WINDOW: | 222 case RIGHT_OF_WINDOW: |
223 case TOP_OF_WINDOW: | 223 case TOP_OF_WINDOW: |
224 case BOTTOM_OF_WINDOW: { | 224 case BOTTOM_OF_WINDOW: { |
225 // Constrain the popup to the monitor's bounds. | 225 // Constrain the popup to the monitor's bounds. |
226 gfx::Rect ideal_bounds(x, y, popup_width(), popup_height()); | 226 gfx::Rect ideal_bounds(x, y, popup_width(), popup_height()); |
227 ideal_bounds = ideal_bounds.AdjustToFit(monitor_bounds_); | 227 ideal_bounds.AdjustToFit(monitor_bounds_); |
228 return ideal_bounds; | 228 return ideal_bounds; |
229 } | 229 } |
230 case DockInfo::MAXIMIZE: | 230 case DockInfo::MAXIMIZE: |
231 y += popup_height() / 2; | 231 y += popup_height() / 2; |
232 break; | 232 break; |
233 case DockInfo::LEFT_HALF: | 233 case DockInfo::LEFT_HALF: |
234 x += popup_width() / 2; | 234 x += popup_width() / 2; |
235 break; | 235 break; |
236 case DockInfo::RIGHT_HALF: | 236 case DockInfo::RIGHT_HALF: |
237 x -= popup_width() / 2; | 237 x -= popup_width() / 2; |
(...skipping 12 matching lines...) Expand all Loading... |
250 int x, | 250 int x, |
251 int y, | 251 int y, |
252 Type type) { | 252 Type type) { |
253 if (IsCloseToMonitorPoint(screen_loc, x, y, type, &in_enable_area_)) { | 253 if (IsCloseToMonitorPoint(screen_loc, x, y, type, &in_enable_area_)) { |
254 hot_spot_.SetPoint(x, y); | 254 hot_spot_.SetPoint(x, y); |
255 type_ = type; | 255 type_ = type; |
256 return true; | 256 return true; |
257 } | 257 } |
258 return false; | 258 return false; |
259 } | 259 } |
OLD | NEW |