summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-11 19:08:53 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-11 19:08:53 +0000
commit01b2d864e04841863865c90c419dd221e28e6af4 (patch)
treedebe00834da089cd5646fea8682f1907877bffbc
parente325d0c2b842404eef887faa5bb894270b8e7b0c (diff)
downloadchromium_src-01b2d864e04841863865c90c419dd221e28e6af4.zip
chromium_src-01b2d864e04841863865c90c419dd221e28e6af4.tar.gz
chromium_src-01b2d864e04841863865c90c419dd221e28e6af4.tar.bz2
TabContentsWrapper -> TabContents, part 40.
browser/ui/find_bar BUG=131026 TEST=no change Review URL: https://chromiumcodereview.appspot.com/10533081 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141452 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/find_bar/find_backend_unittest.cc6
-rw-r--r--chrome/browser/ui/find_bar/find_bar_controller.cc4
-rw-r--r--chrome/browser/ui/find_bar/find_bar_controller.h13
-rw-r--r--chrome/browser/ui/find_bar/find_bar_host_browsertest.cc66
4 files changed, 44 insertions, 45 deletions
diff --git a/chrome/browser/ui/find_bar/find_backend_unittest.cc b/chrome/browser/ui/find_bar/find_backend_unittest.cc
index 9d5488e..941b729 100644
--- a/chrome/browser/ui/find_bar/find_backend_unittest.cc
+++ b/chrome/browser/ui/find_bar/find_backend_unittest.cc
@@ -8,7 +8,7 @@
#include "chrome/browser/ui/find_bar/find_bar_state.h"
#include "chrome/browser/ui/find_bar/find_bar_state_factory.h"
#include "chrome/browser/ui/find_bar/find_tab_helper.h"
-#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
+#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/browser/ui/tab_contents/test_tab_contents.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/testing_profile.h"
@@ -50,8 +50,8 @@ TEST_F(FindBackendTest, InternalState) {
// Get another WebContents object ready.
WebContents* contents2 =
WebContentsTester::CreateTestWebContents(profile(), NULL);
- TabContentsWrapper wrapper2(contents2);
- FindTabHelper* find_tab_helper2 = wrapper2.find_tab_helper();
+ TabContents tab_contents(contents2);
+ FindTabHelper* find_tab_helper2 = tab_contents.find_tab_helper();
// No search has still been issued, strings should be blank.
EXPECT_EQ(string16(), FindPrepopulateText(contents()));
diff --git a/chrome/browser/ui/find_bar/find_bar_controller.cc b/chrome/browser/ui/find_bar/find_bar_controller.cc
index 5be152c..ea414f9 100644
--- a/chrome/browser/ui/find_bar/find_bar_controller.cc
+++ b/chrome/browser/ui/find_bar/find_bar_controller.cc
@@ -12,7 +12,7 @@
#include "chrome/browser/ui/find_bar/find_bar_state.h"
#include "chrome/browser/ui/find_bar/find_bar_state_factory.h"
#include "chrome/browser/ui/find_bar/find_tab_helper.h"
-#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
+#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/common/chrome_notification_types.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/navigation_entry.h"
@@ -73,7 +73,7 @@ void FindBarController::EndFindSession(SelectionAction selection_action,
}
}
-void FindBarController::ChangeTabContents(TabContentsWrapper* contents) {
+void FindBarController::ChangeTabContents(TabContents* contents) {
if (tab_contents_) {
registrar_.RemoveAll();
find_bar_->StopAnimation();
diff --git a/chrome/browser/ui/find_bar/find_bar_controller.h b/chrome/browser/ui/find_bar/find_bar_controller.h
index c635112..1e95c3d 100644
--- a/chrome/browser/ui/find_bar/find_bar_controller.h
+++ b/chrome/browser/ui/find_bar/find_bar_controller.h
@@ -17,7 +17,6 @@ class Rect;
class FindBar;
class TabContents;
-typedef TabContents TabContentsWrapper;
class FindBarController : public content::NotificationObserver {
public:
@@ -51,13 +50,13 @@ class FindBarController : public content::NotificationObserver {
void EndFindSession(SelectionAction selection_action,
ResultAction results_action);
- // Accessor for the attached TabContentsWrapper.
- TabContentsWrapper* tab_contents() const { return tab_contents_; }
+ // Accessor for the attached TabContents.
+ TabContents* tab_contents() const { return tab_contents_; }
- // Changes the TabContentsWrapper that this FindBar is attached to. This
+ // Changes the TabContents that this FindBar is attached to. This
// occurs when the user switches tabs in the Browser window. |contents| can be
// NULL.
- void ChangeTabContents(TabContentsWrapper* contents);
+ void ChangeTabContents(TabContents* contents);
// Overridden from content::NotificationObserver:
virtual void Observe(int type,
@@ -90,8 +89,8 @@ class FindBarController : public content::NotificationObserver {
scoped_ptr<FindBar> find_bar_;
- // The TabContentsWrapper we are currently associated with. Can be NULL.
- TabContentsWrapper* tab_contents_;
+ // The TabContents we are currently associated with. Can be NULL.
+ TabContents* tab_contents_;
// The last match count we reported to the user. This is used by
// UpdateFindBarForCurrentResult to avoid flickering.
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 00a2826..eb378be 100644
--- a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc
+++ b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc
@@ -14,7 +14,7 @@
#include "chrome/browser/ui/find_bar/find_bar_controller.h"
#include "chrome/browser/ui/find_bar/find_notification_details.h"
#include "chrome/browser/ui/find_bar/find_tab_helper.h"
-#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
+#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
@@ -131,7 +131,7 @@ class FindInPageControllerTest : public InProcessBrowserTest {
// Platform independent FindInPage that takes |const wchar_t*|
// as an input.
- int FindInPageWchar(TabContentsWrapper* tab,
+ int FindInPageWchar(TabContents* tab,
const wchar_t* search_str,
bool forward,
bool case_sensitive,
@@ -144,7 +144,7 @@ class FindInPageControllerTest : public InProcessBrowserTest {
// Calls FindInPageWchar till the find box's x position != |start_x_position|.
// Return |start_x_position| if the find box has not moved after iterating
// through all matches of |search_str|.
- int FindInPageTillBoxMoves(TabContentsWrapper* tab,
+ int FindInPageTillBoxMoves(TabContents* tab,
int start_x_position,
const wchar_t* search_str,
int expected_matches) {
@@ -182,7 +182,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageFrames) {
// Try incremental search (mimicking user typing in).
int ordinal = 0;
- TabContentsWrapper* tab = browser()->GetSelectedTabContentsWrapper();
+ TabContents* tab = browser()->GetActiveTabContents();
EXPECT_EQ(18, FindInPageWchar(tab, L"g",
kFwd, kIgnoreCase, &ordinal));
EXPECT_EQ(1, ordinal);
@@ -272,7 +272,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageEndState) {
GURL url = GetURL(kEndState);
ui_test_utils::NavigateToURL(browser(), url);
- TabContentsWrapper* tab_contents = browser()->GetSelectedTabContentsWrapper();
+ TabContents* tab_contents = browser()->GetActiveTabContents();
ASSERT_TRUE(NULL != tab_contents);
// Verify that nothing has focus.
@@ -324,7 +324,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageOrdinal) {
// Search for 'o', which should make the first item active and return
// '1 in 3' (1st ordinal of a total of 3 matches).
- TabContentsWrapper* tab = browser()->GetSelectedTabContentsWrapper();
+ TabContents* tab = browser()->GetActiveTabContents();
int ordinal = 0;
EXPECT_EQ(3, FindInPageWchar(tab, L"o",
kFwd, kIgnoreCase, &ordinal));
@@ -360,7 +360,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest,
ui_test_utils::NavigateToURL(browser(), url);
// Search for a text that exists within a link on the page.
- TabContentsWrapper* tab = browser()->GetSelectedTabContentsWrapper();
+ TabContents* tab = browser()->GetActiveTabContents();
ASSERT_TRUE(NULL != tab);
int ordinal = 0;
EXPECT_EQ(4, FindInPageWchar(tab,
@@ -396,7 +396,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageMultiFramesOrdinal) {
// Search for 'a', which should make the first item active and return
// '1 in 7' (1st ordinal of a total of 7 matches).
- TabContentsWrapper* tab = browser()->GetSelectedTabContentsWrapper();
+ TabContents* tab = browser()->GetActiveTabContents();
int ordinal = 0;
EXPECT_EQ(7,
FindInPageWchar(tab, L"a", kFwd, kIgnoreCase, &ordinal));
@@ -445,7 +445,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPage_Issue5132) {
// Search for 'goa' three times (6 matches on page).
int ordinal = 0;
- TabContentsWrapper* tab = browser()->GetSelectedTabContentsWrapper();
+ TabContents* tab = browser()->GetActiveTabContents();
EXPECT_EQ(6, FindInPageWchar(tab, L"goa",
kFwd, kIgnoreCase, &ordinal));
EXPECT_EQ(1, ordinal);
@@ -487,7 +487,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_NavigateClearsOrdinal) {
EnsureFindBoxOpen();
// Search for a text that exists within a link on the page.
- TabContentsWrapper* tab = browser()->GetSelectedTabContentsWrapper();
+ TabContents* tab = browser()->GetActiveTabContents();
ASSERT_TRUE(NULL != tab);
int ordinal = 0;
EXPECT_EQ(8, FindInPageWchar(tab,
@@ -513,7 +513,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindUnselectableText) {
ui_test_utils::NavigateToURL(browser(), url);
int ordinal = 0;
- TabContentsWrapper* tab = browser()->GetSelectedTabContentsWrapper();
+ TabContents* tab = browser()->GetActiveTabContents();
EXPECT_EQ(1, FindInPageWchar(tab, L"text", kFwd, kIgnoreCase, &ordinal));
EXPECT_EQ(1, ordinal);
}
@@ -534,7 +534,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindCrash_Issue1341577) {
// TODO(jungshik): According to a native Malayalam speaker, it's ok not
// to find U+0D4C. Still need to investigate further this issue.
int ordinal = 0;
- TabContentsWrapper* tab = browser()->GetSelectedTabContentsWrapper();
+ TabContents* tab = browser()->GetActiveTabContents();
FindInPageWchar(tab, L"\u0D4C", kFwd, kIgnoreCase, &ordinal);
FindInPageWchar(tab, L"\u0D4C", kFwd, kIgnoreCase, &ordinal);
@@ -556,7 +556,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindCrash_Issue14491) {
// This used to crash the tab.
int ordinal = 0;
- EXPECT_EQ(0, FindInPageWchar(browser()->GetSelectedTabContentsWrapper(),
+ EXPECT_EQ(0, FindInPageWchar(browser()->GetActiveTabContents(),
L"s", kFwd, kIgnoreCase, &ordinal));
EXPECT_EQ(0, ordinal);
}
@@ -577,7 +577,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindRestarts_Issue1155639) {
// This string appears 5 times at the bottom of a long page. If Find restarts
// properly after a timeout, it will find 5 matches, not just 1.
int ordinal = 0;
- EXPECT_EQ(5, FindInPageWchar(browser()->GetSelectedTabContentsWrapper(),
+ EXPECT_EQ(5, FindInPageWchar(browser()->GetActiveTabContents(),
L"008.xml",
kFwd, kIgnoreCase, &ordinal));
EXPECT_EQ(1, ordinal);
@@ -593,7 +593,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindRestarts_Issue70505) {
// If this test hangs on the FindInPage call, then it might be a regression
// such as the one found in issue http://crbug.com/70505.
int ordinal = 0;
- FindInPageWchar(browser()->GetSelectedTabContentsWrapper(),
+ FindInPageWchar(browser()->GetActiveTabContents(),
L"a", kFwd, kIgnoreCase, &ordinal);
EXPECT_EQ(1, ordinal);
// TODO(finnur): We cannot reliably get the matchcount for this Find call
@@ -608,7 +608,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest,
GURL url = GetURL(kPrematureEnd);
ui_test_utils::NavigateToURL(browser(), url);
- TabContentsWrapper* tab_contents = browser()->GetSelectedTabContentsWrapper();
+ TabContents* tab_contents = browser()->GetActiveTabContents();
ASSERT_TRUE(NULL != tab_contents);
// Search for a text that exists within a link on the page.
@@ -637,7 +637,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindDisappearOnNavigate) {
ui_test_utils::WindowedNotificationObserver observer(
content::NOTIFICATION_LOAD_STOP,
content::Source<NavigationController>(
- &browser()->GetSelectedTabContentsWrapper()->web_contents()->
+ &browser()->GetActiveTabContents()->web_contents()->
GetController()));
browser()->Reload(CURRENT_TAB);
observer.Wait();
@@ -740,7 +740,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindMovesWhenObscuring) {
EXPECT_TRUE(GetFindBarWindowInfo(&start_position, &fully_visible));
EXPECT_TRUE(fully_visible);
- TabContentsWrapper* tab = browser()->GetSelectedTabContentsWrapper();
+ TabContents* tab = browser()->GetActiveTabContents();
int moved_x_coord = FindInPageTillBoxMoves(tab, start_position.x(),
L"Chromium", kMoveIterations);
@@ -797,7 +797,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest,
// Search for 'no_match'. No matches should be found.
int ordinal = 0;
- TabContentsWrapper* tab = browser()->GetSelectedTabContentsWrapper();
+ TabContents* tab = browser()->GetActiveTabContents();
EXPECT_EQ(0, FindInPageWchar(tab, L"no_match",
kFwd, kIgnoreCase, &ordinal));
EXPECT_EQ(0, ordinal);
@@ -881,7 +881,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, StayActive) {
// backspace, but that's been proven flaky in the past, so we go straight to
// tab_contents.
FindTabHelper* find_tab_helper =
- browser()->GetSelectedTabContentsWrapper()->find_tab_helper();
+ browser()->GetActiveTabContents()->find_tab_helper();
// Stop the (non-existing) find operation, and clear the selection (which
// signals the UI is still active).
find_tab_helper->StopFinding(FindBarController::kClearSelectionOnPage);
@@ -899,7 +899,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, RestartSearchFromF3) {
// Search for 'page'. Should have 1 match.
int ordinal = 0;
- TabContentsWrapper* tab = browser()->GetSelectedTabContentsWrapper();
+ TabContents* tab = browser()->GetActiveTabContents();
EXPECT_EQ(1, FindInPageWchar(tab, L"page", kFwd, kIgnoreCase, &ordinal));
EXPECT_EQ(1, ordinal);
@@ -929,7 +929,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PreferPreviousSearch) {
// Find "Default".
int ordinal = 0;
- TabContentsWrapper* tab1 = browser()->GetSelectedTabContentsWrapper();
+ TabContents* tab1 = browser()->GetActiveTabContents();
EXPECT_EQ(1, FindInPageWchar(tab1, L"text", kFwd, kIgnoreCase, &ordinal));
// Create a second tab.
@@ -938,7 +938,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PreferPreviousSearch) {
// something relating to user gesture.
browser()->AddBlankTab(true);
ui_test_utils::NavigateToURL(browser(), url);
- TabContentsWrapper* tab2 = browser()->GetSelectedTabContentsWrapper();
+ TabContents* tab2 = browser()->GetActiveTabContents();
EXPECT_NE(tab1, tab2);
// Find "given".
@@ -968,7 +968,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PrepopulateSameTab) {
// Search for the word "page".
int ordinal = 0;
- TabContentsWrapper* tab1 = browser()->GetSelectedTabContentsWrapper();
+ TabContents* tab1 = browser()->GetActiveTabContents();
EXPECT_EQ(1, FindInPageWchar(tab1, L"page", kFwd, kIgnoreCase, &ordinal));
// Open the Find box.
@@ -1006,13 +1006,13 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PrepopulateInNewTab) {
// Search for the word "page".
int ordinal = 0;
- TabContentsWrapper* tab1 = browser()->GetSelectedTabContentsWrapper();
+ TabContents* tab1 = browser()->GetActiveTabContents();
EXPECT_EQ(1, FindInPageWchar(tab1, L"page", kFwd, kIgnoreCase, &ordinal));
EXPECT_EQ(ASCIIToUTF16("1 of 1"), GetMatchCountText());
// Now create a second tab and load the same page.
browser()->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_TYPED);
- TabContentsWrapper* tab2 = browser()->GetSelectedTabContentsWrapper();
+ TabContents* tab2 = browser()->GetActiveTabContents();
EXPECT_NE(tab1, tab2);
// Open the Find box.
@@ -1040,7 +1040,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PrepopulatePreserveLast) {
// Search for the word "page".
int ordinal = 0;
- TabContentsWrapper* tab1 = browser()->GetSelectedTabContentsWrapper();
+ TabContents* tab1 = browser()->GetActiveTabContents();
EXPECT_EQ(1, FindInPageWchar(tab1, L"page", kFwd, kIgnoreCase, &ordinal));
// Open the Find box.
@@ -1056,7 +1056,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PrepopulatePreserveLast) {
// Now create a second tab and load the same page.
browser()->AddBlankTab(true);
ui_test_utils::NavigateToURL(browser(), url);
- TabContentsWrapper* tab2 = browser()->GetSelectedTabContentsWrapper();
+ TabContents* tab2 = browser()->GetActiveTabContents();
EXPECT_NE(tab1, tab2);
// Search for the word "text".
@@ -1111,7 +1111,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_NoIncognitoPrepopulate) {
// Search for the word "page" in the normal browser tab.
int ordinal = 0;
- TabContentsWrapper* tab1 = browser()->GetSelectedTabContentsWrapper();
+ TabContents* tab1 = browser()->GetActiveTabContents();
EXPECT_EQ(1, FindInPageWchar(tab1, L"page", kFwd, kIgnoreCase, &ordinal));
// Open the Find box.
@@ -1139,8 +1139,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_NoIncognitoPrepopulate) {
EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarTextForBrowser(incognito_browser));
// Search for the word "text" in the incognito tab.
- TabContentsWrapper* incognito_tab =
- incognito_browser->GetSelectedTabContentsWrapper();
+ TabContents* incognito_tab =
+ incognito_browser->GetActiveTabContents();
EXPECT_EQ(1, FindInPageWchar(incognito_tab, L"text",
kFwd, kIgnoreCase, &ordinal));
EXPECT_EQ(ASCIIToUTF16("text"), GetFindBarTextForBrowser(incognito_browser));
@@ -1152,7 +1152,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_NoIncognitoPrepopulate) {
// Now open a new tab in the original (non-incognito) browser.
browser()->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_TYPED);
- TabContentsWrapper* tab2 = browser()->GetSelectedTabContentsWrapper();
+ TabContents* tab2 = browser()->GetActiveTabContents();
EXPECT_NE(tab1, tab2);
// Open the Find box and make sure it is prepopulated with the search term
@@ -1167,7 +1167,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, ActivateLinkNavigatesPage) {
GURL url = GetURL(kLinkPage);
ui_test_utils::NavigateToURL(browser(), url);
- TabContentsWrapper* tab = browser()->GetSelectedTabContentsWrapper();
+ TabContents* tab = browser()->GetActiveTabContents();
int ordinal = 0;
FindInPageWchar(tab, L"link", kFwd, kIgnoreCase, &ordinal);
EXPECT_EQ(ordinal, 1);