summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordeepak.m1 <deepak.m1@samsung.com>2014-09-08 22:49:33 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-09 05:51:05 +0000
commitc13b60492eef039eff71d3cd40513acd47053448 (patch)
treef1a8149c21e56cf227f589a450ab416a366a7bbd
parent79359cecd0ce534e356e3380a4d7e4dc4a29e07b (diff)
downloadchromium_src-c13b60492eef039eff71d3cd40513acd47053448.zip
chromium_src-c13b60492eef039eff71d3cd40513acd47053448.tar.gz
chromium_src-c13b60492eef039eff71d3cd40513acd47053448.tar.bz2
Close the find bar when we reloads the page or we navigate to new page.
As we are reloading the page then it should reset context and find bar should get disappeared. BUG=19311,410160 Review URL: https://codereview.chromium.org/532143002 Cr-Commit-Position: refs/heads/master@{#293860}
-rw-r--r--AUTHORS1
-rw-r--r--chrome/browser/ui/find_bar/find_bar_controller.cc22
-rw-r--r--chrome/browser/ui/find_bar/find_bar_host_browsertest.cc14
3 files changed, 18 insertions, 19 deletions
diff --git a/AUTHORS b/AUTHORS
index 2f62e63..f429a7b 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -100,6 +100,7 @@ Daniel Trebbien <dtrebbien@gmail.com>
David Benjamin <davidben@mit.edu>
David Erceg <erceg.david@gmail.com>
David Futcher <david.mike.futcher@gmail.com>
+Deepak Mittal <deepak.m1@samsung.com>
Deepak Singla <deepak.sa@samsung.com>
Derek Halman <d.halman@gmail.com>
Devlin Cronin <rdevlin.cronin@gmail.com>
diff --git a/chrome/browser/ui/find_bar/find_bar_controller.cc b/chrome/browser/ui/find_bar/find_bar_controller.cc
index 713c3fa..5241fa4 100644
--- a/chrome/browser/ui/find_bar/find_bar_controller.cc
+++ b/chrome/browser/ui/find_bar/find_bar_controller.cc
@@ -155,22 +155,12 @@ void FindBarController::Observe(int type,
content::Details<content::LoadCommittedDetails>(details).ptr();
content::PageTransition transition_type =
commit_details->entry->GetTransitionType();
- // We hide the FindInPage window when the user navigates away, except on
- // reload (and when clicking on anchors within web pages).
- if (find_bar_->IsFindBarVisible()) {
- if (content::PageTransitionStripQualifier(transition_type) !=
- content::PAGE_TRANSITION_RELOAD) {
- // This is a new navigation (not reload), but we still don't want the
- // Find box to disappear if the navigation is just to a fragment
- // within the page.
- if (commit_details->is_navigation_to_different_page())
- EndFindSession(kKeepSelectionOnPage, kClearResultsInFindBox);
- } else {
- // On Reload we want to make sure FindNext is converted to a full Find
- // to make sure highlights for inactive matches are repainted.
- find_tab_helper->set_find_op_aborted(true);
- }
- }
+ // Hide the find bar on reload or navigation.
+ if (find_bar_->IsFindBarVisible() &&
+ (content::PageTransitionStripQualifier(transition_type) ==
+ content::PAGE_TRANSITION_RELOAD ||
+ commit_details->is_navigation_to_different_page()))
+ EndFindSession(kKeepSelectionOnPage, kClearResultsInFindBox);
}
}
}
diff --git a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc
index 865e976..13fc6e0 100644
--- a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc
+++ b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc
@@ -839,7 +839,9 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest,
EXPECT_EQ(1, ordinal);
}
-IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindDisappearOnNavigate) {
+// Verify that the find bar is hidden on reload and navigation.
+IN_PROC_BROWSER_TEST_F(FindInPageControllerTest,
+ HideFindBarOnNavigateAndReload) {
// First we navigate to our special focus tracking page.
GURL url = GetURL(kSimple);
GURL url2 = GetURL(kFramePage);
@@ -854,7 +856,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindDisappearOnNavigate) {
EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible));
EXPECT_TRUE(fully_visible);
- // Reload the tab and make sure Find window doesn't go away.
+ // Reload and make sure the find window goes away.
content::WindowedNotificationObserver observer(
content::NOTIFICATION_LOAD_STOP,
content::Source<NavigationController>(
@@ -862,11 +864,17 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindDisappearOnNavigate) {
GetController()));
chrome::Reload(browser(), CURRENT_TAB);
observer.Wait();
+ EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible));
+ EXPECT_FALSE(fully_visible);
+ // Open the find bar again.
+ chrome::ShowFindBar(browser());
+
+ // Make sure it is open.
EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible));
EXPECT_TRUE(fully_visible);
- // Navigate and make sure the Find window goes away.
+ // Navigate and make sure the find window goes away.
ui_test_utils::NavigateToURL(browser(), url2);
EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible));