diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-06 14:22:42 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-06 14:22:42 +0000 |
commit | 0502e1fe578631d0c7241ec1c500139ca8a9eda7 (patch) | |
tree | 3fed85b3eab0e730bb162e3e99bd3a119d6492aa | |
parent | c6103d870dd28a1bf6ebd0a693cf635a0ccfcae7 (diff) | |
download | chromium_src-0502e1fe578631d0c7241ec1c500139ca8a9eda7.zip chromium_src-0502e1fe578631d0c7241ec1c500139ca8a9eda7.tar.gz chromium_src-0502e1fe578631d0c7241ec1c500139ca8a9eda7.tar.bz2 |
TabContentsWrapper -> TabContents, part 2.
BUG=131026
TEST=no change
Review URL: https://chromiumcodereview.appspot.com/10542010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140754 0039d316-1c4b-4281-b951-d872f2087c98
28 files changed, 191 insertions, 184 deletions
diff --git a/chrome/browser/autofill/autofill_external_delegate_unittest.cc b/chrome/browser/autofill/autofill_external_delegate_unittest.cc index 44e21e8..353b597 100644 --- a/chrome/browser/autofill/autofill_external_delegate_unittest.cc +++ b/chrome/browser/autofill/autofill_external_delegate_unittest.cc @@ -9,7 +9,7 @@ #include "base/string16.h" #include "chrome/browser/autofill/autofill_manager.h" #include "chrome/browser/autofill/test_autofill_external_delegate.h" -#include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/test_tab_contents.h" #include "chrome/test/base/testing_profile.h" #include "content/public/test/test_browser_thread.h" #include "testing/gmock/include/gmock/gmock.h" @@ -73,17 +73,17 @@ class MockAutofillManager : public AutofillManager { } // namespace -class AutofillExternalDelegateUnitTest : public TabContentsWrapperTestHarness { +class AutofillExternalDelegateUnitTest : public TabContentsTestHarness { public: AutofillExternalDelegateUnitTest() : ui_thread_(BrowserThread::UI, &message_loop_) {} virtual ~AutofillExternalDelegateUnitTest() {} virtual void SetUp() OVERRIDE { - TabContentsWrapperTestHarness::SetUp(); - autofill_manager_ = new MockAutofillManager(contents_wrapper()); + TabContentsTestHarness::SetUp(); + autofill_manager_ = new MockAutofillManager(tab_contents()); external_delegate_.reset(new MockAutofillExternalDelegate( - contents_wrapper(), + tab_contents(), autofill_manager_)); } diff --git a/chrome/browser/autofill/autofill_manager_unittest.cc b/chrome/browser/autofill/autofill_manager_unittest.cc index 2b3bae3..12311a8 100644 --- a/chrome/browser/autofill/autofill_manager_unittest.cc +++ b/chrome/browser/autofill/autofill_manager_unittest.cc @@ -27,7 +27,7 @@ #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" -#include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/test_tab_contents.h" #include "chrome/common/autofill_messages.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" @@ -579,12 +579,12 @@ class TestAutofillManager : public AutofillManager { } // namespace -class AutofillManagerTest : public TabContentsWrapperTestHarness { +class AutofillManagerTest : public TabContentsTestHarness { public: typedef AutofillManager::GUIDPair GUIDPair; AutofillManagerTest() - : TabContentsWrapperTestHarness(), + : TabContentsTestHarness(), ui_thread_(BrowserThread::UI, &message_loop_), file_thread_(BrowserThread::FILE) { } @@ -601,8 +601,8 @@ class AutofillManagerTest : public TabContentsWrapperTestHarness { PersonalDataManagerFactory::GetInstance()->SetTestingFactory( profile, TestPersonalDataManager::Build); - TabContentsWrapperTestHarness::SetUp(); - autofill_manager_ = new TestAutofillManager(contents_wrapper(), + TabContentsTestHarness::SetUp(); + autofill_manager_ = new TestAutofillManager(tab_contents(), &personal_data_); file_thread_.Start(); @@ -610,7 +610,7 @@ class AutofillManagerTest : public TabContentsWrapperTestHarness { virtual void TearDown() OVERRIDE { file_thread_.Stop(); - TabContentsWrapperTestHarness::TearDown(); + TabContentsTestHarness::TearDown(); } void UpdatePasswordGenerationState(bool new_renderer) { @@ -633,7 +633,7 @@ class AutofillManagerTest : public TabContentsWrapperTestHarness { } void AutocompleteSuggestionsReturned(const std::vector<string16>& result) { - contents_wrapper()->autocomplete_history_manager()-> + tab_contents()->autocomplete_history_manager()-> SendSuggestions(&result); } @@ -681,7 +681,7 @@ class AutofillManagerTest : public TabContentsWrapperTestHarness { if (unique_ids) *unique_ids = autofill_param.e; - contents_wrapper()->autocomplete_history_manager()->CancelPendingQuery(); + tab_contents()->autocomplete_history_manager()->CancelPendingQuery(); process()->sink().ClearMessages(); return true; } @@ -3097,7 +3097,7 @@ class MockAutofillExternalDelegate : public TestAutofillExternalDelegate { // Test our external delegate is called at the right time. TEST_F(AutofillManagerTest, TestExternalDelegate) { - MockAutofillExternalDelegate external_delegate(contents_wrapper(), + MockAutofillExternalDelegate external_delegate(tab_contents(), autofill_manager_); EXPECT_CALL(external_delegate, OnQuery(_, _, _, _, _)); autofill_manager_->SetExternalDelegate(&external_delegate); @@ -3127,11 +3127,11 @@ TEST_F(AutofillManagerTest, TestTabContentsWithExternalDelegate) { WebContents* contents = CreateTestWebContents(); SetContents(contents); - AutofillManager* autofill_manager = contents_wrapper()->autofill_manager(); + AutofillManager* autofill_manager = tab_contents()->autofill_manager(); EXPECT_TRUE(autofill_manager->external_delegate()); AutocompleteHistoryManager* autocomplete_history_manager = - contents_wrapper()->autocomplete_history_manager(); + tab_contents()->autocomplete_history_manager(); EXPECT_TRUE(autocomplete_history_manager->external_delegate()); } diff --git a/chrome/browser/autofill/autofill_metrics_unittest.cc b/chrome/browser/autofill/autofill_metrics_unittest.cc index b3f08ae39..37e9e30 100644 --- a/chrome/browser/autofill/autofill_metrics_unittest.cc +++ b/chrome/browser/autofill/autofill_metrics_unittest.cc @@ -15,7 +15,7 @@ #include "chrome/browser/autofill/personal_data_manager.h" #include "chrome/browser/autofill/personal_data_manager_factory.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" -#include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/test_tab_contents.h" #include "chrome/browser/webdata/web_data_service.h" #include "chrome/test/base/testing_profile.h" #include "content/public/test/test_browser_thread.h" @@ -253,7 +253,7 @@ class TestAutofillManager : public AutofillManager { } // namespace -class AutofillMetricsTest : public TabContentsWrapperTestHarness { +class AutofillMetricsTest : public TabContentsTestHarness { public: AutofillMetricsTest(); virtual ~AutofillMetricsTest(); @@ -276,7 +276,7 @@ class AutofillMetricsTest : public TabContentsWrapperTestHarness { }; AutofillMetricsTest::AutofillMetricsTest() - : TabContentsWrapperTestHarness(), + : TabContentsTestHarness(), ui_thread_(BrowserThread::UI, &message_loop_), file_thread_(BrowserThread::FILE) { } @@ -293,8 +293,8 @@ void AutofillMetricsTest::SetUp() { PersonalDataManagerFactory::GetInstance()->SetTestingFactory( profile, NULL); - TabContentsWrapperTestHarness::SetUp(); - autofill_manager_ = new TestAutofillManager(contents_wrapper(), + TabContentsTestHarness::SetUp(); + autofill_manager_ = new TestAutofillManager(tab_contents(), &personal_data_); file_thread_.Start(); @@ -302,7 +302,7 @@ void AutofillMetricsTest::SetUp() { void AutofillMetricsTest::TearDown() { file_thread_.Stop(); - TabContentsWrapperTestHarness::TearDown(); + TabContentsTestHarness::TearDown(); } AutofillCCInfoBarDelegate* AutofillMetricsTest::CreateDelegate( @@ -314,7 +314,7 @@ AutofillCCInfoBarDelegate* AutofillMetricsTest::CreateDelegate( CreditCard* credit_card = new CreditCard(); if (created_card) *created_card = credit_card; - return new AutofillCCInfoBarDelegate(contents_wrapper()->infobar_tab_helper(), + return new AutofillCCInfoBarDelegate(tab_contents()->infobar_tab_helper(), credit_card, &personal_data_, metric_logger); diff --git a/chrome/browser/automation/automation_tab_helper_unittest.cc b/chrome/browser/automation/automation_tab_helper_unittest.cc index c8e3d373..6585edd 100644 --- a/chrome/browser/automation/automation_tab_helper_unittest.cc +++ b/chrome/browser/automation/automation_tab_helper_unittest.cc @@ -8,7 +8,7 @@ #include "chrome/browser/automation/automation_tab_helper.h" #include "chrome/browser/automation/mock_tab_event_observer.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" -#include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/test_tab_contents.h" #include "content/public/test/test_browser_thread.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -16,14 +16,14 @@ using content::BrowserThread; using testing::_; -class AutomationTabHelperTest : public TabContentsWrapperTestHarness { +class AutomationTabHelperTest : public TabContentsTestHarness { public: AutomationTabHelperTest() - : TabContentsWrapperTestHarness(), + : TabContentsTestHarness(), browser_thread_(BrowserThread::UI, &message_loop_) {} virtual void SetUp() { - TabContentsWrapperTestHarness::SetUp(); + TabContentsTestHarness::SetUp(); mock_observer_.StartObserving(tab_helper()); } @@ -39,7 +39,7 @@ class AutomationTabHelperTest : public TabContentsWrapperTestHarness { } void TabContentsDestroyed() { - tab_helper()->WebContentsDestroyed(contents_wrapper()->web_contents()); + tab_helper()->WebContentsDestroyed(tab_contents()->web_contents()); } void WillPerformClientRedirect(int64 frame_id) { @@ -51,7 +51,7 @@ class AutomationTabHelperTest : public TabContentsWrapperTestHarness { } AutomationTabHelper* tab_helper() { - return contents_wrapper()->automation_tab_helper(); + return tab_contents()->automation_tab_helper(); } content::TestBrowserThread browser_thread_; diff --git a/chrome/browser/download/download_request_limiter_unittest.cc b/chrome/browser/download/download_request_limiter_unittest.cc index 84e6244..7079947 100644 --- a/chrome/browser/download/download_request_limiter_unittest.cc +++ b/chrome/browser/download/download_request_limiter_unittest.cc @@ -5,7 +5,7 @@ #include "base/bind.h" #include "chrome/browser/download/download_request_limiter.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" -#include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/test_tab_contents.h" #include "chrome/test/base/testing_profile.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/web_contents.h" @@ -15,7 +15,7 @@ using content::BrowserThread; using content::WebContents; -class DownloadRequestLimiterTest : public TabContentsWrapperTestHarness { +class DownloadRequestLimiterTest : public TabContentsTestHarness { public: DownloadRequestLimiterTest() : ui_thread_(BrowserThread::UI, &message_loop_), @@ -25,7 +25,7 @@ class DownloadRequestLimiterTest : public TabContentsWrapperTestHarness { } virtual void SetUp() { - TabContentsWrapperTestHarness::SetUp(); + TabContentsTestHarness::SetUp(); allow_download_ = true; ask_allow_count_ = cancel_count_ = continue_count_ = 0; @@ -37,7 +37,7 @@ class DownloadRequestLimiterTest : public TabContentsWrapperTestHarness { virtual void TearDown() { UnsetDelegate(); - TabContentsWrapperTestHarness::TearDown(); + TabContentsTestHarness::TearDown(); } virtual void UnsetDelegate() { @@ -234,7 +234,7 @@ TEST_F(DownloadRequestLimiterTest, TEST_F(DownloadRequestLimiterTest, DownloadRequestLimiter_RawWebContents) { - // By-pass TabContentsWrapperTestHarness and use + // By-pass TabContentsTestHarness and use // RenderViewHostTestHarness::CreateTestWebContents() directly so that there // will be no TabContentsWrapper for web_contents. scoped_ptr<WebContents> web_contents(CreateTestWebContents()); diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc b/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc index c04ef99..fa12f70 100644 --- a/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc +++ b/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc @@ -17,7 +17,7 @@ #include "chrome/browser/infobars/infobar_tab_helper.h" #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" -#include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/test_tab_contents.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/test/base/testing_profile.h" #include "content/public/browser/navigation_details.h" @@ -90,7 +90,7 @@ void ClosedDelegateTracker::Clear() { // GeolocationPermissionContextTests ------------------------------------------ // This class sets up GeolocationArbitrator. -class GeolocationPermissionContextTests : public TabContentsWrapperTestHarness { +class GeolocationPermissionContextTests : public TabContentsTestHarness { public: GeolocationPermissionContextTests(); @@ -110,7 +110,7 @@ class GeolocationPermissionContextTests : public TabContentsWrapperTestHarness { } int bridge_id() const { return 42; } // Not relevant at this level. InfoBarTabHelper* infobar_tab_helper() { - return contents_wrapper()->infobar_tab_helper(); + return tab_contents()->infobar_tab_helper(); } void RequestGeolocationPermission(int render_process_id, @@ -136,7 +136,7 @@ class GeolocationPermissionContextTests : public TabContentsWrapperTestHarness { ScopedVector<TabContentsWrapper> extra_tabs_; private: - // TabContentsWrapperTestHarness: + // TabContentsTestHarness: virtual void SetUp() OVERRIDE; virtual void TearDown() OVERRIDE; @@ -149,7 +149,7 @@ class GeolocationPermissionContextTests : public TabContentsWrapperTestHarness { }; GeolocationPermissionContextTests::GeolocationPermissionContextTests() - : TabContentsWrapperTestHarness(), + : TabContentsTestHarness(), ui_thread_(BrowserThread::UI, MessageLoop::current()), db_thread_(BrowserThread::DB) { } @@ -218,7 +218,7 @@ void GeolocationPermissionContextTests::CheckTabContentsState( const GURL& requesting_frame, ContentSetting expected_content_setting) { TabSpecificContentSettings* content_settings = - contents_wrapper()->content_settings(); + tab_contents()->content_settings(); const GeolocationSettingsState::StateMap& state_map = content_settings->geolocation_settings_state().state_map(); EXPECT_EQ(1U, state_map.count(requesting_frame.GetOrigin())); @@ -232,14 +232,14 @@ void GeolocationPermissionContextTests::CheckTabContentsState( void GeolocationPermissionContextTests::SetUp() { db_thread_.Start(); - TabContentsWrapperTestHarness::SetUp(); + TabContentsTestHarness::SetUp(); geolocation_permission_context_ = new ChromeGeolocationPermissionContext(profile()); } void GeolocationPermissionContextTests::TearDown() { extra_tabs_.reset(); - TabContentsWrapperTestHarness::TearDown(); + TabContentsTestHarness::TearDown(); // Schedule another task on the DB thread to notify us that it's safe to // carry on with the test. base::WaitableEvent done(false, false); diff --git a/chrome/browser/intents/register_intent_handler_infobar_delegate_unittest.cc b/chrome/browser/intents/register_intent_handler_infobar_delegate_unittest.cc index 0bd1c8c..9e4f8f2 100644 --- a/chrome/browser/intents/register_intent_handler_infobar_delegate_unittest.cc +++ b/chrome/browser/intents/register_intent_handler_infobar_delegate_unittest.cc @@ -8,7 +8,7 @@ #include "chrome/browser/intents/web_intents_registry.h" #include "chrome/browser/intents/web_intents_registry_factory.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" -#include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/test_tab_contents.h" #include "chrome/test/base/testing_profile.h" #include "content/public/test/test_browser_thread.h" #include "testing/gmock/include/gmock/gmock.h" @@ -36,14 +36,14 @@ MockWebIntentsRegistry* BuildForProfile(Profile* profile) { } class RegisterIntentHandlerInfoBarDelegateTest - : public TabContentsWrapperTestHarness { + : public TabContentsTestHarness { protected: RegisterIntentHandlerInfoBarDelegateTest() : ui_thread_(BrowserThread::UI, MessageLoopForUI::current()), db_thread_(BrowserThread::DB, MessageLoopForUI::current()) {} virtual void SetUp() { - TabContentsWrapperTestHarness::SetUp(); + TabContentsTestHarness::SetUp(); profile()->CreateWebDataService(); web_intents_registry_ = BuildForProfile(profile()); @@ -52,7 +52,7 @@ class RegisterIntentHandlerInfoBarDelegateTest virtual void TearDown() { web_intents_registry_ = NULL; - TabContentsWrapperTestHarness::TearDown(); + TabContentsTestHarness::TearDown(); } MockWebIntentsRegistry* web_intents_registry_; @@ -70,7 +70,7 @@ TEST_F(RegisterIntentHandlerInfoBarDelegateTest, Accept) { service.action = ASCIIToUTF16("http://webintents.org/share"); service.type = ASCIIToUTF16("text/url"); RegisterIntentHandlerInfoBarDelegate delegate( - contents_wrapper()->infobar_tab_helper(), + tab_contents()->infobar_tab_helper(), WebIntentsRegistryFactory::GetForProfile(profile()), service, NULL, GURL()); diff --git a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc index fa8731f..f57e717 100644 --- a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc +++ b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc @@ -11,7 +11,7 @@ #include "chrome/browser/safe_browsing/client_side_detection_service.h" #include "chrome/browser/safe_browsing/safe_browsing_service.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" -#include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/test_tab_contents.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/safe_browsing/csd.pb.h" #include "chrome/common/safe_browsing/safebrowsing_messages.h" @@ -154,7 +154,7 @@ void QuitUIMessageLoopFromIO() { } } // namespace -class ClientSideDetectionHostTest : public TabContentsWrapperTestHarness { +class ClientSideDetectionHostTest : public TabContentsTestHarness { public: virtual void SetUp() { // Set custom profile object so that we can mock calls to IsOffTheRecord. @@ -173,13 +173,13 @@ class ClientSideDetectionHostTest : public TabContentsWrapperTestHarness { io_thread_.reset(new content::TestBrowserThread(BrowserThread::IO)); ASSERT_TRUE(io_thread_->Start()); - TabContentsWrapperTestHarness::SetUp(); + TabContentsTestHarness::SetUp(); // Inject service classes. csd_service_.reset(new StrictMock<MockClientSideDetectionService>()); sb_service_ = new StrictMock<MockSafeBrowsingService>(); csd_host_.reset(safe_browsing::ClientSideDetectionHost::Create( - contents_wrapper()->web_contents())); + tab_contents()->web_contents())); csd_host_->set_client_side_detection_service(csd_service_.get()); csd_host_->set_safe_browsing_service(sb_service_.get()); // We need to create this here since we don't call @@ -199,7 +199,7 @@ class ClientSideDetectionHostTest : public TabContentsWrapperTestHarness { csd_host_.release()); sb_service_ = NULL; message_loop_.RunAllPending(); - TabContentsWrapperTestHarness::TearDown(); + TabContentsTestHarness::TearDown(); // Let the tasks on the IO thread run to avoid memory leaks. base::WaitableEvent done(false, false); diff --git a/chrome/browser/translate/translate_manager_browsertest.cc b/chrome/browser/translate/translate_manager_browsertest.cc index 28ef130..1096d57 100644 --- a/chrome/browser/translate/translate_manager_browsertest.cc +++ b/chrome/browser/translate/translate_manager_browsertest.cc @@ -23,7 +23,7 @@ #include "chrome/browser/translate/translate_manager.h" #include "chrome/browser/translate/translate_prefs.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" -#include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/test_tab_contents.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/common/render_messages.h" @@ -56,7 +56,7 @@ using testing::Pointee; using testing::Property; using WebKit::WebContextMenuData; -class TranslateManagerTest : public TabContentsWrapperTestHarness, +class TranslateManagerTest : public TabContentsTestHarness, public content::NotificationObserver { public: TranslateManagerTest() @@ -101,7 +101,7 @@ class TranslateManagerTest : public TabContentsWrapperTestHarness, } InfoBarTabHelper* infobar_tab_helper() { - return contents_wrapper()->infobar_tab_helper(); + return tab_contents()->infobar_tab_helper(); } // Returns the translate infobar if there is 1 infobar and it is a translate @@ -168,7 +168,7 @@ class TranslateManagerTest : public TabContentsWrapperTestHarness, virtual void SetUp() { WebKit::initialize(webkit_platform_support_.Get()); // Access the TranslateManager singleton so it is created before we call - // TabContentsWrapperTestHarness::SetUp() to match what's done in Chrome, + // TabContentsTestHarness::SetUp() to match what's done in Chrome, // where the TranslateManager is created before the WebContents. This // matters as they both register for similar events and we want the // notifications to happen in the same sequence (TranslateManager first, @@ -179,12 +179,12 @@ class TranslateManagerTest : public TabContentsWrapperTestHarness, TranslateManager::GetInstance()-> set_translate_script_expiration_delay(60 * 60 * 1000); - TabContentsWrapperTestHarness::SetUp(); + TabContentsTestHarness::SetUp(); notification_registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, content::Source<InfoBarTabHelper>( - contents_wrapper()->infobar_tab_helper())); + tab_contents()->infobar_tab_helper())); } virtual void TearDown() { @@ -193,9 +193,9 @@ class TranslateManagerTest : public TabContentsWrapperTestHarness, notification_registrar_.Remove(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, content::Source<InfoBarTabHelper>( - contents_wrapper()->infobar_tab_helper())); + tab_contents()->infobar_tab_helper())); - TabContentsWrapperTestHarness::TearDown(); + TabContentsTestHarness::TearDown(); WebKit::shutdown(); } diff --git a/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac_unittest.mm b/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac_unittest.mm index 396da78..98154db 100644 --- a/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac_unittest.mm +++ b/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac_unittest.mm @@ -7,7 +7,7 @@ #include "base/memory/ref_counted.h" #include "chrome/browser/profiles/profile.h" #import "chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h" -#include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/test_tab_contents.h" #include "chrome/test/base/testing_profile.h" #include "content/public/test/test_browser_thread.h" @@ -16,7 +16,7 @@ using content::BrowserThread; namespace { class CollectedCookiesWindowControllerTest - : public TabContentsWrapperTestHarness { + : public TabContentsTestHarness { public: CollectedCookiesWindowControllerTest() : ui_thread_(BrowserThread::UI, MessageLoopForUI::current()) { @@ -29,7 +29,7 @@ class CollectedCookiesWindowControllerTest TEST_F(CollectedCookiesWindowControllerTest, Construction) { CollectedCookiesWindowController* controller = [[CollectedCookiesWindowController alloc] - initWithTabContentsWrapper:contents_wrapper()]; + initWithTabContentsWrapper:tab_contents()]; [controller release]; } diff --git a/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa_unittest.mm b/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa_unittest.mm index 9cefac5..0cd17a6 100644 --- a/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa_unittest.mm +++ b/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa_unittest.mm @@ -11,7 +11,7 @@ #include "base/memory/scoped_nsobject.h" #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" -#include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/test_tab_contents.h" #include "chrome/common/content_settings_types.h" #include "chrome/test/base/testing_profile.h" #include "content/public/test/test_browser_thread.h" @@ -35,7 +35,7 @@ class DummyContentSettingBubbleModel : public ContentSettingBubbleModel { }; class ContentSettingBubbleControllerTest - : public TabContentsWrapperTestHarness { + : public TabContentsTestHarness { public: ContentSettingBubbleControllerTest(); virtual ~ContentSettingBubbleControllerTest(); @@ -47,7 +47,7 @@ class ContentSettingBubbleControllerTest }; ContentSettingBubbleControllerTest::ContentSettingBubbleControllerTest() - : TabContentsWrapperTestHarness(), + : TabContentsTestHarness(), browser_thread_(BrowserThread::UI, &message_loop_) { } @@ -80,7 +80,7 @@ TEST_F(ContentSettingBubbleControllerTest, Init) { [parent.get() orderBack:nil]; ContentSettingBubbleController* controller = [ContentSettingBubbleController - showForModel:new DummyContentSettingBubbleModel(contents_wrapper(), + showForModel:new DummyContentSettingBubbleModel(tab_contents(), profile(), settingsType) parentWindow:parent diff --git a/chrome/browser/ui/cocoa/tab_contents/favicon_util.h b/chrome/browser/ui/cocoa/tab_contents/favicon_util.h index 63b910a..be1df28 100644 --- a/chrome/browser/ui/cocoa/tab_contents/favicon_util.h +++ b/chrome/browser/ui/cocoa/tab_contents/favicon_util.h @@ -7,14 +7,13 @@ @class NSImage; class TabContents; -typedef TabContents TabContentsWrapper; namespace mac { -// Returns an autoreleased favicon for a given TabContentsWrapper. If |contents| +// Returns an autoreleased favicon for a given TabContents. If |contents| // is NULL or there's no favicon for the NavigationEntry, this will return the // default image. -NSImage* FaviconForTabContents(TabContentsWrapper* contents); +NSImage* FaviconForTabContents(TabContents* contents); } // namespace mac diff --git a/chrome/browser/ui/cocoa/tab_contents/favicon_util.mm b/chrome/browser/ui/cocoa/tab_contents/favicon_util.mm index 1c50361..02915f1 100644 --- a/chrome/browser/ui/cocoa/tab_contents/favicon_util.mm +++ b/chrome/browser/ui/cocoa/tab_contents/favicon_util.mm @@ -8,14 +8,14 @@ #include "base/mac/mac_util.h" #include "chrome/browser/favicon/favicon_tab_helper.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "skia/ext/skia_utils_mac.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/mac/nsimage_cache.h" namespace mac { -NSImage* FaviconForTabContents(TabContentsWrapper* contents) { +NSImage* FaviconForTabContents(TabContents* contents) { // FaviconTabHelper returns IDR_DEFAULT_FAVICON, which is a rasterized version // of the Mac PDF. Use the PDF so the icon in the Omnibox matches the default // favicon. diff --git a/chrome/browser/ui/constrained_window_tab_helper_unittest.cc b/chrome/browser/ui/constrained_window_tab_helper_unittest.cc index 1d5e100..93365cc 100644 --- a/chrome/browser/ui/constrained_window_tab_helper_unittest.cc +++ b/chrome/browser/ui/constrained_window_tab_helper_unittest.cc @@ -5,16 +5,16 @@ #include "chrome/browser/ui/constrained_window.h" #include "chrome/browser/ui/constrained_window_tab_helper.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" -#include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/test_tab_contents.h" #include "content/public/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" using content::BrowserThread; -class ConstrainedWindowTabHelperUnit : public TabContentsWrapperTestHarness { +class ConstrainedWindowTabHelperUnit : public TabContentsTestHarness { public: ConstrainedWindowTabHelperUnit() - : TabContentsWrapperTestHarness(), + : TabContentsTestHarness(), ui_thread_(BrowserThread::UI, &message_loop_) { } @@ -42,16 +42,15 @@ class ConstrainedWindowCloseTest : public ConstrainedWindow { }; TEST_F(ConstrainedWindowTabHelperUnit, ConstrainedWindows) { - ConstrainedWindowCloseTest window(contents_wrapper()); + ConstrainedWindowCloseTest window(tab_contents()); window.close_count = 0; const int kWindowCount = 4; for (int i = 0; i < kWindowCount; i++) { - contents_wrapper()->constrained_window_tab_helper()->AddConstrainedDialog( + tab_contents()->constrained_window_tab_helper()->AddConstrainedDialog( &window); } EXPECT_EQ(window.close_count, 0); - contents_wrapper()->constrained_window_tab_helper()-> - CloseConstrainedWindows(); + tab_contents()->constrained_window_tab_helper()->CloseConstrainedWindows(); EXPECT_EQ(window.close_count, kWindowCount); } diff --git a/chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc b/chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc index c85972f..f8a284c 100644 --- a/chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc +++ b/chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc @@ -9,7 +9,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" -#include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/test_tab_contents.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/base/testing_profile.h" #include "content/public/browser/web_contents.h" @@ -20,7 +20,7 @@ using content::BrowserThread; using content::WebContentsTester; -class ContentSettingBubbleModelTest : public TabContentsWrapperTestHarness { +class ContentSettingBubbleModelTest : public TabContentsTestHarness { protected: ContentSettingBubbleModelTest() : ui_thread_(BrowserThread::UI, MessageLoop::current()) { @@ -31,7 +31,7 @@ class ContentSettingBubbleModelTest : public TabContentsWrapperTestHarness { bool expect_reload_hint) { scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( ContentSettingBubbleModel::CreateContentSettingBubbleModel( - NULL, contents_wrapper(), profile(), + NULL, tab_contents(), profile(), CONTENT_SETTINGS_TYPE_GEOLOCATION)); const ContentSettingBubbleModel::BubbleContent& bubble_content = content_setting_bubble_model->bubble_content(); @@ -50,14 +50,13 @@ class ContentSettingBubbleModelTest : public TabContentsWrapperTestHarness { TEST_F(ContentSettingBubbleModelTest, ImageRadios) { TabSpecificContentSettings* content_settings = - contents_wrapper()->content_settings(); + tab_contents()->content_settings(); content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_IMAGES, std::string()); scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( ContentSettingBubbleModel::CreateContentSettingBubbleModel( - NULL, contents_wrapper(), profile(), - CONTENT_SETTINGS_TYPE_IMAGES)); + NULL, tab_contents(), profile(), CONTENT_SETTINGS_TYPE_IMAGES)); const ContentSettingBubbleModel::BubbleContent& bubble_content = content_setting_bubble_model->bubble_content(); EXPECT_FALSE(bubble_content.title.empty()); @@ -69,14 +68,13 @@ TEST_F(ContentSettingBubbleModelTest, ImageRadios) { TEST_F(ContentSettingBubbleModelTest, Cookies) { TabSpecificContentSettings* content_settings = - contents_wrapper()->content_settings(); + tab_contents()->content_settings(); content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string()); scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( ContentSettingBubbleModel::CreateContentSettingBubbleModel( - NULL, contents_wrapper(), profile(), - CONTENT_SETTINGS_TYPE_COOKIES)); + NULL, tab_contents(), profile(), CONTENT_SETTINGS_TYPE_COOKIES)); const ContentSettingBubbleModel::BubbleContent& bubble_content = content_setting_bubble_model->bubble_content(); EXPECT_FALSE(bubble_content.title.empty()); @@ -88,13 +86,13 @@ TEST_F(ContentSettingBubbleModelTest, Cookies) { TEST_F(ContentSettingBubbleModelTest, Plugins) { TabSpecificContentSettings* content_settings = - contents_wrapper()->content_settings(); + tab_contents()->content_settings(); content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_PLUGINS, std::string()); scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( ContentSettingBubbleModel::CreateContentSettingBubbleModel( - NULL, contents_wrapper(), profile(), + NULL, tab_contents(), profile(), CONTENT_SETTINGS_TYPE_PLUGINS)); const ContentSettingBubbleModel::BubbleContent& bubble_content = content_setting_bubble_model->bubble_content(); @@ -131,7 +129,7 @@ TEST_F(ContentSettingBubbleModelTest, MultiplePlugins) { CONTENT_SETTING_ASK); TabSpecificContentSettings* content_settings = - contents_wrapper()->content_settings(); + tab_contents()->content_settings(); content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_PLUGINS, fooPlugin); content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_PLUGINS, @@ -139,8 +137,7 @@ TEST_F(ContentSettingBubbleModelTest, MultiplePlugins) { scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( ContentSettingBubbleModel::CreateContentSettingBubbleModel( - NULL, contents_wrapper(), profile(), - CONTENT_SETTINGS_TYPE_PLUGINS)); + NULL, tab_contents(), profile(), CONTENT_SETTINGS_TYPE_PLUGINS)); const ContentSettingBubbleModel::BubbleContent& bubble_content = content_setting_bubble_model->bubble_content(); EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size()); @@ -180,7 +177,7 @@ TEST_F(ContentSettingBubbleModelTest, Geolocation) { NavigateAndCommit(page_url); TabSpecificContentSettings* content_settings = - contents_wrapper()->content_settings(); + tab_contents()->content_settings(); // One permitted frame, but not in the content map: requires reload. content_settings->OnGeolocationPermissionSet(frame1_url, true); @@ -217,7 +214,7 @@ TEST_F(ContentSettingBubbleModelTest, FileURL) { NavigateAndCommit(GURL(file_url)); scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( ContentSettingBubbleModel::CreateContentSettingBubbleModel( - NULL, contents_wrapper(), profile(), + NULL, tab_contents(), profile(), CONTENT_SETTINGS_TYPE_IMAGES)); std::string title = content_setting_bubble_model->bubble_content().radio_group.radio_items[0]; diff --git a/chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc b/chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc index 40ebf4c..85dc7e2 100644 --- a/chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc +++ b/chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc @@ -8,7 +8,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/content_settings/content_setting_image_model.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" -#include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/test_tab_contents.h" #include "chrome/test/base/testing_profile.h" #include "content/public/test/test_browser_thread.h" #include "content/public/test/test_renderer_host.h" @@ -17,7 +17,7 @@ using content::BrowserThread; -class ContentSettingImageModelTest : public TabContentsWrapperTestHarness { +class ContentSettingImageModelTest : public TabContentsTestHarness { public: ContentSettingImageModelTest() : ui_thread_(BrowserThread::UI, &message_loop_) {} @@ -30,7 +30,7 @@ class ContentSettingImageModelTest : public TabContentsWrapperTestHarness { TEST_F(ContentSettingImageModelTest, UpdateFromWebContents) { TabSpecificContentSettings* content_settings = - contents_wrapper()->content_settings(); + tab_contents()->content_settings(); scoped_ptr<ContentSettingImageModel> content_setting_image_model( ContentSettingImageModel::CreateContentSettingImageModel( CONTENT_SETTINGS_TYPE_IMAGES)); @@ -49,7 +49,7 @@ TEST_F(ContentSettingImageModelTest, UpdateFromWebContents) { TEST_F(ContentSettingImageModelTest, CookieAccessed) { TabSpecificContentSettings* content_settings = - contents_wrapper()->content_settings(); + tab_contents()->content_settings(); profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( CONTENT_SETTINGS_TYPE_COOKIES, CONTENT_SETTING_BLOCK); scoped_ptr<ContentSettingImageModel> content_setting_image_model( diff --git a/chrome/browser/ui/find_bar/find_backend_unittest.cc b/chrome/browser/ui/find_bar/find_backend_unittest.cc index 15f78d1..9d5488e 100644 --- a/chrome/browser/ui/find_bar/find_backend_unittest.cc +++ b/chrome/browser/ui/find_bar/find_backend_unittest.cc @@ -9,7 +9,7 @@ #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/test_tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/test_tab_contents.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/testing_profile.h" #include "content/public/browser/web_contents.h" @@ -20,10 +20,10 @@ using content::BrowserThread; using content::WebContents; using content::WebContentsTester; -class FindBackendTest : public TabContentsWrapperTestHarness { +class FindBackendTest : public TabContentsTestHarness { public: FindBackendTest() - : TabContentsWrapperTestHarness(), + : TabContentsTestHarness(), browser_thread_(BrowserThread::UI, &message_loop_) {} private: @@ -42,7 +42,7 @@ string16 FindPrepopulateText(WebContents* contents) { // This test takes two WebContents objects, searches in both of them and // tests the internal state for find_text and find_prepopulate_text. TEST_F(FindBackendTest, InternalState) { - FindTabHelper* find_tab_helper = contents_wrapper()->find_tab_helper(); + FindTabHelper* find_tab_helper = tab_contents()->find_tab_helper(); // Initial state for the WebContents is blank strings. EXPECT_EQ(string16(), FindPrepopulateText(contents())); EXPECT_EQ(string16(), find_tab_helper->find_text()); diff --git a/chrome/browser/ui/tab_contents/core_tab_helper_delegate.h b/chrome/browser/ui/tab_contents/core_tab_helper_delegate.h index 36614fd..704f68e 100644 --- a/chrome/browser/ui/tab_contents/core_tab_helper_delegate.h +++ b/chrome/browser/ui/tab_contents/core_tab_helper_delegate.h @@ -9,18 +9,17 @@ #include "base/basictypes.h" class TabContents; -typedef TabContents TabContentsWrapper; // Objects implement this interface to get notified about changes in the -// TabContentsWrapper and to provide necessary functionality. +// TabContents and to provide necessary functionality. // -// This is considered part of the TabContentsWrapper "core" interface. If a -// piece of code interacts with TabContentWrappers, it is guaranteed that it -// will need to handle all of these callbacks. +// This is considered part of the TabContents "core" interface. If a piece of +// code interacts with TabContent, it is guaranteed that it will need to handle +// all of these callbacks. class CoreTabHelperDelegate { public: - virtual void SwapTabContents(TabContentsWrapper* old_tc, - TabContentsWrapper* new_tc) = 0; + virtual void SwapTabContents(TabContents* old_tc, + TabContents* new_tc) = 0; protected: virtual ~CoreTabHelperDelegate(); diff --git a/chrome/browser/ui/tab_contents/tab_contents.cc b/chrome/browser/ui/tab_contents/tab_contents.cc index 305df3d..7c2326a 100644 --- a/chrome/browser/ui/tab_contents/tab_contents.cc +++ b/chrome/browser/ui/tab_contents/tab_contents.cc @@ -61,7 +61,7 @@ using content::WebContents; namespace { static base::LazyInstance<base::PropertyAccessor<TabContents*> > - g_tab_contents_wrapper_property_accessor = LAZY_INSTANCE_INITIALIZER; + g_tab_contents_property_accessor = LAZY_INSTANCE_INITIALIZER; } // namespace @@ -73,7 +73,7 @@ TabContents::TabContents(WebContents* contents) in_destructor_(false), web_contents_(contents) { DCHECK(contents); - DCHECK(!GetCurrentWrapperForContents(contents)); + DCHECK(!GetOwningTabContentsForWebContents(contents)); chrome::SetViewType(contents, chrome::VIEW_TYPE_TAB_CONTENTS); @@ -191,36 +191,48 @@ TabContents::~TabContents() { } base::PropertyAccessor<TabContents*>* TabContents::property_accessor() { - return g_tab_contents_wrapper_property_accessor.Pointer(); + return g_tab_contents_property_accessor.Pointer(); } TabContents* TabContents::Clone() { - WebContents* new_contents = web_contents()->Clone(); - TabContents* new_wrapper = new TabContents(new_contents); + WebContents* new_web_contents = web_contents()->Clone(); + TabContents* new_tab_contents = new TabContents(new_web_contents); // TODO(avi): Can we generalize this so that knowledge of the functionings of // the tab helpers isn't required here? - new_wrapper->extension_tab_helper()->CopyStateFrom( + new_tab_contents->extension_tab_helper()->CopyStateFrom( *extension_tab_helper_.get()); - return new_wrapper; + return new_tab_contents; } -// static +// static deprecated TabContents* TabContents::GetCurrentWrapperForContents( WebContents* contents) { - TabContents** wrapper = + return GetOwningTabContentsForWebContents(contents); +} + +// static deprecated +const TabContents* TabContents::GetCurrentWrapperForContents( + const WebContents* contents) { + return GetOwningTabContentsForWebContents(contents); +} + +// static +TabContents* TabContents::GetOwningTabContentsForWebContents( + WebContents* contents) { + TabContents** tab_contents = property_accessor()->GetProperty(contents->GetPropertyBag()); - return wrapper ? *wrapper : NULL; + return tab_contents ? *tab_contents : NULL; } // static -const TabContents* TabContents::GetCurrentWrapperForContents( +const TabContents* TabContents::GetOwningTabContentsForWebContents( const WebContents* contents) { - TabContents* const* wrapper = + TabContents* const* tab_contents = property_accessor()->GetProperty(contents->GetPropertyBag()); - return wrapper ? *wrapper : NULL; + return tab_contents ? *tab_contents : NULL; } WebContents* TabContents::web_contents() const { diff --git a/chrome/browser/ui/tab_contents/tab_contents.h b/chrome/browser/ui/tab_contents/tab_contents.h index 06abb37..2bbd656 100644 --- a/chrome/browser/ui/tab_contents/tab_contents.h +++ b/chrome/browser/ui/tab_contents/tab_contents.h @@ -108,8 +108,12 @@ class TabContents : public content::WebContentsObserver { // general case, please do NOT use this; plumb TabContents through the chrome/ // code instead of WebContents. static TabContents* GetCurrentWrapperForContents( - content::WebContents* contents); + content::WebContents* contents); // DEPRECATED static const TabContents* GetCurrentWrapperForContents( + const content::WebContents* contents); // DEPRECATED + static TabContents* GetOwningTabContentsForWebContents( + content::WebContents* contents); + static const TabContents* GetOwningTabContentsForWebContents( const content::WebContents* contents); // Returns the WebContents that this owns. diff --git a/chrome/browser/ui/tab_contents/tab_contents_iterator.cc b/chrome/browser/ui/tab_contents/tab_contents_iterator.cc index 6f6ee0f..caa90fc 100644 --- a/chrome/browser/ui/tab_contents/tab_contents_iterator.cc +++ b/chrome/browser/ui/tab_contents/tab_contents_iterator.cc @@ -26,12 +26,12 @@ TabContentsIterator::TabContentsIterator() } void TabContentsIterator::Advance() { - // The current WebContents should be valid unless we are at the beginning. + // The current TabContents should be valid unless we are at the beginning. DCHECK(cur_ || (web_view_index_ == -1 && browser_iterator_ == BrowserList::begin())) << "Trying to advance past the end"; - // Update cur_ to the next WebContents in the list. + // Update cur_ to the next TabContents in the list. while (browser_iterator_ != BrowserList::end()) { if (++web_view_index_ >= (*browser_iterator_)->tab_count()) { // Advance to the next Browser in the list. @@ -40,20 +40,20 @@ void TabContentsIterator::Advance() { continue; } - TabContentsWrapper* next_tab = + TabContents* next_tab = (*browser_iterator_)->GetTabContentsWrapperAt(web_view_index_); if (next_tab) { cur_ = next_tab; return; } } - // If no more WebContents from Browsers, check the BackgroundPrintingManager. + // If no more TabContents from Browsers, check the BackgroundPrintingManager. while (bg_printing_iterator_ != GetBackgroundPrintingManager()->end()) { cur_ = *bg_printing_iterator_; CHECK(cur_); ++bg_printing_iterator_; return; } - // Reached the end - no more WebContents. + // Reached the end - no more TabContents. cur_ = NULL; } diff --git a/chrome/browser/ui/tab_contents/tab_contents_iterator.h b/chrome/browser/ui/tab_contents/tab_contents_iterator.h index 25c0781..57428d7 100644 --- a/chrome/browser/ui/tab_contents/tab_contents_iterator.h +++ b/chrome/browser/ui/tab_contents/tab_contents_iterator.h @@ -12,7 +12,6 @@ #include "chrome/browser/ui/browser_list.h" class TabContents; -typedef TabContents TabContentsWrapper; // Iterates through all web view hosts in all browser windows. Because the // renderers act asynchronously, getting a host through this interface does @@ -21,7 +20,7 @@ typedef TabContents TabContentsWrapper; // // Example: // for (TabContentsIterator iterator; !iterator.done(); ++iterator) { -// TabContentsWrapper* cur = *iterator; +// TabContents* cur = *iterator; // -or- // iterator->operationOnTabContents(); // ... @@ -34,28 +33,28 @@ class TabContentsIterator { bool done() const { return cur_ == NULL; } // Returns the Browser instance associated with the current - // TabContentsWrapper. Valid as long as !done() + // TabContents. Valid as long as !done() Browser* browser() const { if (browser_iterator_ != BrowserList::end()) return *browser_iterator_; return NULL; } - // Returns the current TabContentsWrapper, valid as long as !Done() - TabContentsWrapper* operator->() const { + // Returns the current TabContents, valid as long as !Done() + TabContents* operator->() const { return cur_; } - TabContentsWrapper* operator*() const { + TabContents* operator*() const { return cur_; } // Incrementing operators, valid as long as !Done() - TabContentsWrapper* operator++() { // ++preincrement + TabContents* operator++() { // ++preincrement Advance(); return cur_; } - TabContentsWrapper* operator++(int) { // postincrement++ - TabContentsWrapper* tmp = cur_; + TabContents* operator++(int) { // postincrement++ + TabContents* tmp = cur_; Advance(); return tmp; } @@ -72,13 +71,13 @@ class TabContentsIterator { // tab index into the current Browser of the current web view int web_view_index_; - // iterator over the TabContentsWrappers doing background printing. - std::set<TabContentsWrapper*>::const_iterator bg_printing_iterator_; + // iterator over the TabContentss doing background printing. + std::set<TabContents*>::const_iterator bg_printing_iterator_; - // Current TabContentsWrapper, or NULL if we're at the end of the list. This + // Current TabContents, or NULL if we're at the end of the list. This // can be extracted given the browser iterator and index, but it's nice to // cache this since the caller may access the current host many times. - TabContentsWrapper* cur_; + TabContents* cur_; DISALLOW_COPY_AND_ASSIGN(TabContentsIterator); }; diff --git a/chrome/browser/ui/tab_contents/tab_contents_iterator_unittest.cc b/chrome/browser/ui/tab_contents/tab_contents_iterator_unittest.cc index db800f1..4b78289 100644 --- a/chrome/browser/ui/tab_contents/tab_contents_iterator_unittest.cc +++ b/chrome/browser/ui/tab_contents/tab_contents_iterator_unittest.cc @@ -10,7 +10,7 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/printing/background_printing_manager.h" #include "chrome/browser/profiles/profile_manager.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/browser_with_test_window_test.h" @@ -33,7 +33,7 @@ size_t CountAllTabs() { } // Helper function to navigate to the print preview page. -void NavigateToPrintUrl(TabContentsWrapper* tab, int page_id) { +void NavigateToPrintUrl(TabContents* tab, int page_id) { content::RenderViewHostTester::For( tab->web_contents()->GetRenderViewHost())->SendNavigate( page_id, GURL(chrome::kChromeUIPrintURL)); @@ -191,7 +191,7 @@ TEST_F(BrowserListTest, TabContentsIteratorBackgroundPrinting) { // Grab a tab and give ownership to BackgroundPrintingManager. TabContentsIterator tab_iterator; - TabContentsWrapper* tab = *tab_iterator; + TabContents* tab = *tab_iterator; int page_id = 1; NavigateToPrintUrl(tab, page_id++); @@ -221,12 +221,12 @@ TEST_F(BrowserListTest, TabContentsIteratorBackgroundPrinting) { // Tell BackgroundPrintingManager to take ownership of all tabs. // Save the tabs in |owned_tabs| because manipulating tabs in the middle of // TabContentsIterator is a bad idea. - std::vector<TabContentsWrapper*> owned_tabs; + std::vector<TabContents*> owned_tabs; for (TabContentsIterator iterator; !iterator.done(); ++iterator) { NavigateToPrintUrl(*iterator, page_id++); owned_tabs.push_back(*iterator); } - for (std::vector<TabContentsWrapper*>::iterator it = owned_tabs.begin(); + for (std::vector<TabContents*>::iterator it = owned_tabs.begin(); it != owned_tabs.end(); ++it) { bg_print_manager->OwnPrintPreviewTab(*it); } @@ -234,7 +234,7 @@ TEST_F(BrowserListTest, TabContentsIteratorBackgroundPrinting) { EXPECT_EQ(6U, CountAllTabs()); // Delete all tabs to clean up. - for (std::vector<TabContentsWrapper*>::iterator it = owned_tabs.begin(); + for (std::vector<TabContents*>::iterator it = owned_tabs.begin(); it != owned_tabs.end(); ++it) { delete *it; } diff --git a/chrome/browser/ui/tab_contents/test_tab_contents_wrapper.cc b/chrome/browser/ui/tab_contents/test_tab_contents.cc index c542e4b..a28e117 100644 --- a/chrome/browser/ui/tab_contents/test_tab_contents_wrapper.cc +++ b/chrome/browser/ui/tab_contents/test_tab_contents.cc @@ -2,40 +2,40 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/test_tab_contents.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/test/base/testing_profile.h" #include "content/public/browser/web_contents.h" using content::WebContents; -TabContentsWrapperTestHarness::TabContentsWrapperTestHarness() +TabContentsTestHarness::TabContentsTestHarness() : ChromeRenderViewHostTestHarness() { } -TabContentsWrapperTestHarness::~TabContentsWrapperTestHarness() { +TabContentsTestHarness::~TabContentsTestHarness() { } -WebContents* TabContentsWrapperTestHarness::web_contents() { - return contents_wrapper_.get() ? contents_wrapper_->web_contents() : NULL; +WebContents* TabContentsTestHarness::web_contents() { + return tab_contents_.get() ? tab_contents_->web_contents() : NULL; } -TabContentsWrapper* TabContentsWrapperTestHarness::contents_wrapper() { - return contents_wrapper_.get(); +TabContents* TabContentsTestHarness::tab_contents() { + return tab_contents_.get(); } -void TabContentsWrapperTestHarness::SetContents(WebContents* contents) { - contents_wrapper_.reset(contents ? new TabContentsWrapper(contents) : NULL); +void TabContentsTestHarness::SetContents(WebContents* contents) { + tab_contents_.reset(contents ? new TabContents(contents) : NULL); } -void TabContentsWrapperTestHarness::SetUp() { +void TabContentsTestHarness::SetUp() { ChromeRenderViewHostTestHarness::SetUp(); SetContents(CreateTestWebContents()); } -void TabContentsWrapperTestHarness::TearDown() { - contents_wrapper_.reset(); +void TabContentsTestHarness::TearDown() { + tab_contents_.reset(); // Make sure that we flush any messages related to WebContents destruction // before we destroy the browser context. diff --git a/chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h b/chrome/browser/ui/tab_contents/test_tab_contents.h index cc2a0c2..99d599b 100644 --- a/chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h +++ b/chrome/browser/ui/tab_contents/test_tab_contents.h @@ -2,27 +2,26 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_TAB_CONTENTS_TEST_TAB_CONTENTS_WRAPPER_H_ -#define CHROME_BROWSER_UI_TAB_CONTENTS_TEST_TAB_CONTENTS_WRAPPER_H_ +#ifndef CHROME_BROWSER_UI_TAB_CONTENTS_TEST_TAB_CONTENTS_H_ +#define CHROME_BROWSER_UI_TAB_CONTENTS_TEST_TAB_CONTENTS_H_ #pragma once #include "base/compiler_specific.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" class TabContents; -typedef TabContents TabContentsWrapper; namespace content { class WebContents; } -class TabContentsWrapperTestHarness : public ChromeRenderViewHostTestHarness { +class TabContentsTestHarness : public ChromeRenderViewHostTestHarness { public: - TabContentsWrapperTestHarness(); - virtual ~TabContentsWrapperTestHarness(); + TabContentsTestHarness(); + virtual ~TabContentsTestHarness(); virtual content::WebContents* web_contents() OVERRIDE; - TabContentsWrapper* contents_wrapper(); + TabContents* tab_contents(); virtual void SetContents(content::WebContents* contents) OVERRIDE; @@ -31,9 +30,9 @@ class TabContentsWrapperTestHarness : public ChromeRenderViewHostTestHarness { virtual void SetUp() OVERRIDE; virtual void TearDown() OVERRIDE; - scoped_ptr<TabContentsWrapper> contents_wrapper_; + scoped_ptr<TabContents> tab_contents_; - DISALLOW_COPY_AND_ASSIGN(TabContentsWrapperTestHarness); + DISALLOW_COPY_AND_ASSIGN(TabContentsTestHarness); }; -#endif // CHROME_BROWSER_UI_TAB_CONTENTS_TEST_TAB_CONTENTS_WRAPPER_H_ +#endif // CHROME_BROWSER_UI_TAB_CONTENTS_TEST_TAB_CONTENTS_H_ diff --git a/chrome/browser/ui/webui/web_ui_unittest.cc b/chrome/browser/ui/webui/web_ui_unittest.cc index 918a765..8448339 100644 --- a/chrome/browser/ui/webui/web_ui_unittest.cc +++ b/chrome/browser/ui/webui/web_ui_unittest.cc @@ -6,7 +6,7 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" -#include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/test_tab_contents.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/testing_profile.h" #include "content/public/browser/navigation_controller.h" @@ -26,7 +26,7 @@ using content::SiteInstance; using content::WebContents; using content::WebContentsTester; -class WebUITest : public TabContentsWrapperTestHarness { +class WebUITest : public TabContentsTestHarness { public: WebUITest() : ui_thread_(BrowserThread::UI, MessageLoop::current()) {} @@ -101,7 +101,7 @@ class WebUITest : public TabContentsWrapperTestHarness { // WebContents when we first navigate to a Web UI page, then to a standard // non-DOM-UI page. TEST_F(WebUITest, WebUIToStandard) { - DoNavigationTest(contents_wrapper(), 1); + DoNavigationTest(tab_contents(), 1); // Test the case where we're not doing the initial navigation. This is // slightly different than the very-first-navigation case since the @@ -129,8 +129,7 @@ TEST_F(WebUITest, WebUIToWebUI) { rvh_tester()->SendNavigate(2, new_tab_url); // The flags should be the same as the non-pending state. - EXPECT_FALSE( - contents_wrapper()->favicon_tab_helper()->ShouldDisplayFavicon()); + EXPECT_FALSE(tab_contents()->favicon_tab_helper()->ShouldDisplayFavicon()); EXPECT_TRUE(contents()->FocusLocationBarByDefault()); } @@ -143,12 +142,12 @@ TEST_F(WebUITest, StandardToWebUI) { std::string()); // The state should now reflect the default. - EXPECT_TRUE(contents_wrapper()->favicon_tab_helper()->ShouldDisplayFavicon()); + EXPECT_TRUE(tab_contents()->favicon_tab_helper()->ShouldDisplayFavicon()); EXPECT_FALSE(contents()->FocusLocationBarByDefault()); // Commit the load, the state should be the same. rvh_tester()->SendNavigate(1, std_url); - EXPECT_TRUE(contents_wrapper()->favicon_tab_helper()->ShouldDisplayFavicon()); + EXPECT_TRUE(tab_contents()->favicon_tab_helper()->ShouldDisplayFavicon()); EXPECT_FALSE(contents()->FocusLocationBarByDefault()); // Start a pending load for a WebUI. @@ -156,7 +155,7 @@ TEST_F(WebUITest, StandardToWebUI) { controller().LoadURL(new_tab_url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); - EXPECT_TRUE(contents_wrapper()->favicon_tab_helper()->ShouldDisplayFavicon()); + EXPECT_TRUE(tab_contents()->favicon_tab_helper()->ShouldDisplayFavicon()); EXPECT_TRUE(contents()->FocusLocationBarByDefault()); // Committing Web UI is tested above. diff --git a/chrome/browser/web_applications/web_app_unittest.cc b/chrome/browser/web_applications/web_app_unittest.cc index a3a41b3..f189900 100644 --- a/chrome/browser/web_applications/web_app_unittest.cc +++ b/chrome/browser/web_applications/web_app_unittest.cc @@ -7,7 +7,7 @@ #include "base/file_path.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/test_tab_contents.h" #include "chrome/browser/ui/web_applications/web_app_ui.h" #include "chrome/common/extensions/extension_messages.h" #include "chrome/test/base/testing_profile.h" @@ -18,7 +18,7 @@ using content::BrowserThread; using content::RenderViewHostTester; -class WebApplicationTest : public TabContentsWrapperTestHarness { +class WebApplicationTest : public TabContentsTestHarness { public: WebApplicationTest() : ui_thread_(BrowserThread::UI, &message_loop_) { } @@ -40,7 +40,7 @@ TEST_F(WebApplicationTest, GetShortcutInfoForTab) { rvh(), ExtensionHostMsg_DidGetApplicationInfo(0, 0, web_app_info)); ShellIntegration::ShortcutInfo info; - web_app::GetShortcutInfoForTab(contents_wrapper(), &info); + web_app::GetShortcutInfoForTab(tab_contents(), &info); EXPECT_EQ(title, info.title); EXPECT_EQ(description, info.description); diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 3e6e74d..1f4ba20 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -177,8 +177,8 @@ 'browser/ui/panels/base_panel_browser_test.h', 'browser/ui/panels/test_panel_mouse_watcher.cc', 'browser/ui/panels/test_panel_mouse_watcher.h', - 'browser/ui/tab_contents/test_tab_contents_wrapper.cc', - 'browser/ui/tab_contents/test_tab_contents_wrapper.h', + 'browser/ui/tab_contents/test_tab_contents.cc', + 'browser/ui/tab_contents/test_tab_contents.h', 'common/net/gaia/mock_url_fetcher_factory.h', 'common/pref_store_observer_mock.cc', 'common/pref_store_observer_mock.h', |