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/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 Loading... | |
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 // We hide the FindInPage window when the user reload the page or |
159 // reload (and when clicking on anchors within web pages). | 159 // navigates away. |
160 if (find_bar_->IsFindBarVisible()) { | 160 if (find_bar_->IsFindBarVisible()) { |
161 if (content::PageTransitionStripQualifier(transition_type) != | 161 if (content::PageTransitionStripQualifier(transition_type) == |
Finnur
2014/09/04 12:45:10
We prefer:
if (x && (y || z))
... over ...
if (
Deepak
2014/09/04 13:18:14
Done.
| |
162 content::PAGE_TRANSITION_RELOAD) { | 162 content::PAGE_TRANSITION_RELOAD || |
163 // This is a new navigation (not reload), but we still don't want the | 163 commit_details->is_navigation_to_different_page()) { |
164 // Find box to disappear if the navigation is just to a fragment | 164 EndFindSession(kKeepSelectionOnPage, kClearResultsInFindBox); |
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 } | 165 } |
Finnur
2014/09/04 12:45:10
nit: We don't use braces around one-line if bodies
Deepak
2014/09/04 13:18:14
Done.
| |
173 } | 166 } |
174 } | 167 } |
175 } | 168 } |
176 } | 169 } |
177 | 170 |
178 // static | 171 // static |
179 gfx::Rect FindBarController::GetLocationForFindbarView( | 172 gfx::Rect FindBarController::GetLocationForFindbarView( |
180 gfx::Rect view_location, | 173 gfx::Rect view_location, |
181 const gfx::Rect& dialog_bounds, | 174 const gfx::Rect& dialog_bounds, |
182 const gfx::Rect& avoid_overlapping_rect) { | 175 const gfx::Rect& avoid_overlapping_rect) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
260 } | 253 } |
261 | 254 |
262 // Update the find bar with existing results and search text, regardless of | 255 // 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 | 256 // 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 | 257 // 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 | 258 // _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. | 259 // clear the result count display when there's nothing in the box. |
267 find_bar_->SetFindTextAndSelectedRange(find_string, | 260 find_bar_->SetFindTextAndSelectedRange(find_string, |
268 find_tab_helper->selected_range()); | 261 find_tab_helper->selected_range()); |
269 } | 262 } |
OLD | NEW |