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

Side by Side Diff: chrome/browser/ui/find_bar/find_bar_controller.cc

Issue 532143002: Close the find bar on reload. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit chnages done. Created 6 years, 3 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 | « AUTHORS ('k') | chrome/browser/ui/find_bar/find_bar_host_browsertest.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/find_bar/find_bar_controller.h" 5 #include "chrome/browser/ui/find_bar/find_bar_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 } 148 }
149 } 149 }
150 } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { 150 } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) {
151 NavigationController* source_controller = 151 NavigationController* source_controller =
152 content::Source<NavigationController>(source).ptr(); 152 content::Source<NavigationController>(source).ptr();
153 if (source_controller == &web_contents_->GetController()) { 153 if (source_controller == &web_contents_->GetController()) {
154 content::LoadCommittedDetails* commit_details = 154 content::LoadCommittedDetails* commit_details =
155 content::Details<content::LoadCommittedDetails>(details).ptr(); 155 content::Details<content::LoadCommittedDetails>(details).ptr();
156 content::PageTransition transition_type = 156 content::PageTransition transition_type =
157 commit_details->entry->GetTransitionType(); 157 commit_details->entry->GetTransitionType();
158 // We hide the FindInPage window when the user navigates away, except on 158 // Hide the find bar on reload or navigation.
159 // reload (and when clicking on anchors within web pages). 159 if (find_bar_->IsFindBarVisible() &&
160 if (find_bar_->IsFindBarVisible()) { 160 (content::PageTransitionStripQualifier(transition_type) ==
161 if (content::PageTransitionStripQualifier(transition_type) != 161 content::PAGE_TRANSITION_RELOAD ||
162 content::PAGE_TRANSITION_RELOAD) { 162 commit_details->is_navigation_to_different_page()))
163 // This is a new navigation (not reload), but we still don't want the 163 EndFindSession(kKeepSelectionOnPage, kClearResultsInFindBox);
164 // Find box to disappear if the navigation is just to a fragment
165 // within the page.
166 if (commit_details->is_navigation_to_different_page())
167 EndFindSession(kKeepSelectionOnPage, kClearResultsInFindBox);
168 } else {
169 // On Reload we want to make sure FindNext is converted to a full Find
170 // to make sure highlights for inactive matches are repainted.
171 find_tab_helper->set_find_op_aborted(true);
172 }
173 }
174 } 164 }
175 } 165 }
176 } 166 }
177 167
178 // static 168 // static
179 gfx::Rect FindBarController::GetLocationForFindbarView( 169 gfx::Rect FindBarController::GetLocationForFindbarView(
180 gfx::Rect view_location, 170 gfx::Rect view_location,
181 const gfx::Rect& dialog_bounds, 171 const gfx::Rect& dialog_bounds,
182 const gfx::Rect& avoid_overlapping_rect) { 172 const gfx::Rect& avoid_overlapping_rect) {
183 if (base::i18n::IsRTL()) { 173 if (base::i18n::IsRTL()) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 } 250 }
261 251
262 // Update the find bar with existing results and search text, regardless of 252 // Update the find bar with existing results and search text, regardless of
263 // whether or not the find bar is visible, so that if it's subsequently 253 // whether or not the find bar is visible, so that if it's subsequently
264 // shown it is showing the right state for this tab. We update the find text 254 // shown it is showing the right state for this tab. We update the find text
265 // _first_ since the FindBarView checks its emptiness to see if it should 255 // _first_ since the FindBarView checks its emptiness to see if it should
266 // clear the result count display when there's nothing in the box. 256 // clear the result count display when there's nothing in the box.
267 find_bar_->SetFindTextAndSelectedRange(find_string, 257 find_bar_->SetFindTextAndSelectedRange(find_string,
268 find_tab_helper->selected_range()); 258 find_tab_helper->selected_range());
269 } 259 }
OLDNEW
« no previous file with comments | « AUTHORS ('k') | chrome/browser/ui/find_bar/find_bar_host_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698