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

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

Issue 1801313003: [M50 Merge] Disable Find-In-Page buttons when no text is entered (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 9 months 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/find_bar_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/ui/find_bar/find_bar_controller.h" 10 #include "chrome/browser/ui/find_bar/find_bar_controller.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 base::string16 FindBarHost::GetFindText() { 134 base::string16 FindBarHost::GetFindText() {
135 return find_bar_view()->GetFindText(); 135 return find_bar_view()->GetFindText();
136 } 136 }
137 137
138 gfx::Range FindBarHost::GetSelectedRange() { 138 gfx::Range FindBarHost::GetSelectedRange() {
139 return find_bar_view()->GetSelectedRange(); 139 return find_bar_view()->GetSelectedRange();
140 } 140 }
141 141
142 void FindBarHost::UpdateUIForFindResult(const FindNotificationDetails& result, 142 void FindBarHost::UpdateUIForFindResult(const FindNotificationDetails& result,
143 const base::string16& find_text) { 143 const base::string16& find_text) {
144 // Make sure match count is clear. It may get set again in UpdateForResult
145 // if enough data is available.
146 find_bar_view()->ClearMatchCount();
147
148 if (!find_text.empty()) 144 if (!find_text.empty())
149 find_bar_view()->UpdateForResult(result, find_text); 145 find_bar_view()->UpdateForResult(result, find_text);
146 else
147 find_bar_view()->ClearMatchCount();
150 148
151 // We now need to check if the window is obscuring the search results. 149 // We now need to check if the window is obscuring the search results.
152 MoveWindowIfNecessary(result.selection_rect()); 150 MoveWindowIfNecessary(result.selection_rect());
153 151
154 // Once we find a match we no longer want to keep track of what had 152 // Once we find a match we no longer want to keep track of what had
155 // focus. EndFindSession will then set the focus to the page content. 153 // focus. EndFindSession will then set the focus to the page content.
156 if (result.number_of_matches() > 0) 154 if (result.number_of_matches() > 0)
157 ResetFocusTracker(); 155 ResetFocusTracker();
158 } 156 }
159 157
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 352
355 //////////////////////////////////////////////////////////////////////////////// 353 ////////////////////////////////////////////////////////////////////////////////
356 // private: 354 // private:
357 355
358 void FindBarHost::GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect) { 356 void FindBarHost::GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect) {
359 gfx::Rect frame_rect = host()->GetTopLevelWidget()->GetWindowBoundsInScreen(); 357 gfx::Rect frame_rect = host()->GetTopLevelWidget()->GetWindowBoundsInScreen();
360 gfx::Rect webcontents_rect = 358 gfx::Rect webcontents_rect =
361 find_bar_controller_->web_contents()->GetViewBounds(); 359 find_bar_controller_->web_contents()->GetViewBounds();
362 avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y()); 360 avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y());
363 } 361 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/find_bar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698