Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Side by Side Diff: chrome/browser/ui/views/find_bar_host.cc

Issue 1478303003: Converted all Views to use an InkDropDelegate instead of a InkDropAnimationController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added missing include. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 if (!avoid_overlapping_rect.IsEmpty()) { 293 if (!avoid_overlapping_rect.IsEmpty()) {
294 // For comparison (with the Intersects function below) we need to account 294 // For comparison (with the Intersects function below) we need to account
295 // for the fact that we draw the Find widget relative to the Chrome frame, 295 // for the fact that we draw the Find widget relative to the Chrome frame,
296 // whereas the selection rect is relative to the page. 296 // whereas the selection rect is relative to the page.
297 GetWidgetPositionNative(&avoid_overlapping_rect); 297 GetWidgetPositionNative(&avoid_overlapping_rect);
298 } 298 }
299 299
300 gfx::Rect new_pos = FindBarController::GetLocationForFindbarView( 300 gfx::Rect new_pos = FindBarController::GetLocationForFindbarView(
301 view_location, widget_bounds, avoid_overlapping_rect); 301 view_location, widget_bounds, avoid_overlapping_rect);
302 302
303 // While we are animating, the Find window will grow bottoms up so we need to
304 // re-position the widget so that it appears to grow out of the toolbar.
305 if (animation_offset() > 0)
306 new_pos.Offset(0, std::min(0, -animation_offset()));
307
303 return new_pos; 308 return new_pos;
304 } 309 }
305 310
306 void FindBarHost::SetDialogPosition(const gfx::Rect& new_pos) { 311 void FindBarHost::SetDialogPosition(const gfx::Rect& new_pos) {
307 DropdownBarHost::SetDialogPosition(new_pos);
308
309 if (new_pos.IsEmpty()) 312 if (new_pos.IsEmpty())
310 return; 313 return;
311 314
315 if (!host()->IsVisible())
316 host()->Show();
317 host()->SetBounds(new_pos);
318
312 // Tell the immersive mode controller about the find bar's new bounds. The 319 // Tell the immersive mode controller about the find bar's new bounds. The
313 // immersive mode controller uses the bounds to keep the top-of-window views 320 // immersive mode controller uses the bounds to keep the top-of-window views
314 // revealed when the mouse is hovered over the find bar. 321 // revealed when the mouse is hovered over the find bar.
315 browser_view()->immersive_mode_controller()->OnFindBarVisibleBoundsChanged( 322 browser_view()->immersive_mode_controller()->OnFindBarVisibleBoundsChanged(
316 host()->GetWindowBoundsInScreen()); 323 host()->GetWindowBoundsInScreen());
317 } 324 }
318 325
319 void FindBarHost::GetWidgetBounds(gfx::Rect* bounds) { 326 void FindBarHost::GetWidgetBounds(gfx::Rect* bounds) {
320 DCHECK(bounds); 327 DCHECK(bounds);
321 // The BrowserView does Layout for the components that we care about 328 // The BrowserView does Layout for the components that we care about
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 360
354 //////////////////////////////////////////////////////////////////////////////// 361 ////////////////////////////////////////////////////////////////////////////////
355 // private: 362 // private:
356 363
357 void FindBarHost::GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect) { 364 void FindBarHost::GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect) {
358 gfx::Rect frame_rect = host()->GetTopLevelWidget()->GetWindowBoundsInScreen(); 365 gfx::Rect frame_rect = host()->GetTopLevelWidget()->GetWindowBoundsInScreen();
359 gfx::Rect webcontents_rect = 366 gfx::Rect webcontents_rect =
360 find_bar_controller_->web_contents()->GetViewBounds(); 367 find_bar_controller_->web_contents()->GetViewBounds();
361 avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y()); 368 avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y());
362 } 369 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698