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/views/find_bar_host.h" | 5 #include "chrome/browser/ui/views/find_bar_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 9 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
10 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 10 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 if (animation_offset() > 0) | 304 if (animation_offset() > 0) |
305 new_pos.Offset(0, std::min(0, -animation_offset())); | 305 new_pos.Offset(0, std::min(0, -animation_offset())); |
306 | 306 |
307 return new_pos; | 307 return new_pos; |
308 } | 308 } |
309 | 309 |
310 void FindBarHost::SetDialogPosition(const gfx::Rect& new_pos, bool no_redraw) { | 310 void FindBarHost::SetDialogPosition(const gfx::Rect& new_pos, bool no_redraw) { |
311 if (new_pos.IsEmpty()) | 311 if (new_pos.IsEmpty()) |
312 return; | 312 return; |
313 | 313 |
314 // Make sure the window edges are clipped to just the visible region. We need | |
315 // to do this before changing position, so that when we animate the closure | |
316 // of it it doesn't look like the window crumbles into the toolbar. | |
317 UpdateWindowEdges(new_pos); | |
318 | |
319 SetWidgetPositionNative(new_pos, no_redraw); | 314 SetWidgetPositionNative(new_pos, no_redraw); |
320 | 315 |
321 // Tell the immersive mode controller about the find bar's new bounds. The | 316 // Tell the immersive mode controller about the find bar's new bounds. The |
322 // immersive mode controller uses the bounds to keep the top-of-window views | 317 // immersive mode controller uses the bounds to keep the top-of-window views |
323 // revealed when the mouse is hovered over the find bar. | 318 // revealed when the mouse is hovered over the find bar. |
324 browser_view()->immersive_mode_controller()->OnFindBarVisibleBoundsChanged( | 319 browser_view()->immersive_mode_controller()->OnFindBarVisibleBoundsChanged( |
325 host()->GetWindowBoundsInScreen()); | 320 host()->GetWindowBoundsInScreen()); |
326 } | 321 } |
327 | 322 |
328 void FindBarHost::GetWidgetBounds(gfx::Rect* bounds) { | 323 void FindBarHost::GetWidgetBounds(gfx::Rect* bounds) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 | 357 |
363 //////////////////////////////////////////////////////////////////////////////// | 358 //////////////////////////////////////////////////////////////////////////////// |
364 // private: | 359 // private: |
365 | 360 |
366 void FindBarHost::GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect) { | 361 void FindBarHost::GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect) { |
367 gfx::Rect frame_rect = host()->GetTopLevelWidget()->GetWindowBoundsInScreen(); | 362 gfx::Rect frame_rect = host()->GetTopLevelWidget()->GetWindowBoundsInScreen(); |
368 gfx::Rect webcontents_rect = | 363 gfx::Rect webcontents_rect = |
369 find_bar_controller_->web_contents()->GetViewBounds(); | 364 find_bar_controller_->web_contents()->GetViewBounds(); |
370 avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y()); | 365 avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y()); |
371 } | 366 } |
OLD | NEW |