diff options
Diffstat (limited to 'content/browser')
13 files changed, 71 insertions, 72 deletions
diff --git a/content/browser/child_process_security_policy_browsertest.cc b/content/browser/child_process_security_policy_browsertest.cc index 1a85e0b..785d584 100644 --- a/content/browser/child_process_security_policy_browsertest.cc +++ b/content/browser/child_process_security_policy_browsertest.cc @@ -46,7 +46,7 @@ IN_PROC_BROWSER_TEST_F(ChildProcessSecurityPolicyInProcessBrowserTest, NoLeak) { base::KillProcess(tab->GetRenderProcessHost()->GetHandle(), content::RESULT_CODE_KILLED, true); - tab->controller().Reload(true); + tab->GetController().Reload(true); EXPECT_EQ( ChildProcessSecurityPolicy::GetInstance()->security_state_.size(), 1U); } diff --git a/content/browser/debugger/devtools_http_handler_impl.cc b/content/browser/debugger/devtools_http_handler_impl.cc index 63755e8..859ca0d 100644 --- a/content/browser/debugger/devtools_http_handler_impl.cc +++ b/content/browser/debugger/devtools_http_handler_impl.cc @@ -281,7 +281,7 @@ static PageList GeneratePageList( it != inspectable_tabs.end(); ++it) { TabContents* tab_contents = *it; - NavigationController& controller = tab_contents->controller(); + NavigationController& controller = tab_contents->GetController(); NavigationEntry* entry = controller.GetActiveEntry(); if (entry == NULL || !entry->url().is_valid()) diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc index 8e13652..2bf8975 100644 --- a/content/browser/download/save_package.cc +++ b/content/browser/download/save_package.cc @@ -224,7 +224,7 @@ GURL SavePackage::GetUrlToBeSaved() { // rather than the displayed one (returned by GetURL) which may be // different (like having "view-source:" on the front). NavigationEntry* active_entry = - tab_contents()->controller().GetActiveEntry(); + tab_contents()->GetController().GetActiveEntry(); return active_entry->url(); } diff --git a/content/browser/renderer_host/test_render_view_host.cc b/content/browser/renderer_host/test_render_view_host.cc index 55d7983..f0cc0e6 100644 --- a/content/browser/renderer_host/test_render_view_host.cc +++ b/content/browser/renderer_host/test_render_view_host.cc @@ -309,7 +309,7 @@ RenderViewHostTestHarness::~RenderViewHostTestHarness() { } NavigationController& RenderViewHostTestHarness::controller() { - return contents()->controller(); + return contents()->GetController(); } TestTabContents* RenderViewHostTestHarness::contents() { diff --git a/content/browser/speech/speech_input_browsertest.cc b/content/browser/speech/speech_input_browsertest.cc index 1c097ef..204d988 100644 --- a/content/browser/speech/speech_input_browsertest.cc +++ b/content/browser/speech/speech_input_browsertest.cc @@ -163,7 +163,7 @@ class SpeechInputBrowserTest : public InProcessBrowserTest { TabContents* tab_contents = browser()->GetSelectedTabContents(); ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, - content::Source<NavigationController>(&tab_contents->controller())); + content::Source<NavigationController>(&tab_contents->GetController())); tab_contents->GetRenderViewHost()->ForwardMouseEvent(mouse_event); mouse_event.type = WebKit::WebInputEvent::MouseUp; tab_contents->GetRenderViewHost()->ForwardMouseEvent(mouse_event); diff --git a/content/browser/ssl/ssl_error_handler.cc b/content/browser/ssl/ssl_error_handler.cc index 11dbb3d..a0b3e46 100644 --- a/content/browser/ssl/ssl_error_handler.cc +++ b/content/browser/ssl/ssl_error_handler.cc @@ -77,7 +77,7 @@ void SSLErrorHandler::Dispatch() { } // Hand ourselves off to the SSLManager. - manager_ = tab_contents->controller().ssl_manager(); + manager_ = tab_contents->GetController().ssl_manager(); OnDispatched(); } diff --git a/content/browser/tab_contents/interstitial_page.cc b/content/browser/tab_contents/interstitial_page.cc index 0b66184..df6037b 100644 --- a/content/browser/tab_contents/interstitial_page.cc +++ b/content/browser/tab_contents/interstitial_page.cc @@ -135,7 +135,7 @@ InterstitialPage::InterstitialPage(TabContents* tab, // (which is the case when the interstitial was triggered by a sub-resource on // a page) when we have a pending entry (in the process of loading a new top // frame). - DCHECK(new_navigation || !tab->controller().pending_entry()); + DCHECK(new_navigation || !tab->GetController().pending_entry()); } InterstitialPage::~InterstitialPage() { @@ -193,7 +193,7 @@ void InterstitialPage::Show() { // Give sub-classes a chance to set some states on the navigation entry. UpdateEntry(entry); - tab_->controller().AddTransientEntry(entry); + tab_->GetController().AddTransientEntry(entry); } DCHECK(!render_view_host_); @@ -208,9 +208,9 @@ void InterstitialPage::Show() { content::NOTIFICATION_TAB_CONTENTS_DESTROYED, content::Source<TabContents>(tab_)); notification_registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, - content::Source<NavigationController>(&tab_->controller())); + content::Source<NavigationController>(&tab_->GetController())); notification_registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_PENDING, - content::Source<NavigationController>(&tab_->controller())); + content::Source<NavigationController>(&tab_->GetController())); } void InterstitialPage::Hide() { @@ -236,7 +236,7 @@ void InterstitialPage::Hide() { if (tab_->interstitial_page()) tab_->remove_interstitial_page(); // Let's revert to the original title if necessary. - NavigationEntry* entry = tab_->controller().GetActiveEntry(); + NavigationEntry* entry = tab_->GetController().GetActiveEntry(); if (!new_navigation_ && should_revert_tab_title_) { entry->set_title(original_tab_title_); tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TITLE); @@ -368,7 +368,7 @@ void InterstitialPage::UpdateTitle(RenderViewHost* render_view_host, const string16& title, base::i18n::TextDirection title_direction) { DCHECK(render_view_host == render_view_host_); - NavigationEntry* entry = tab_->controller().GetActiveEntry(); + NavigationEntry* entry = tab_->GetController().GetActiveEntry(); if (!entry) { // Crash reports from the field indicate this can be NULL. // This is unexpected as InterstitialPages constructed with the @@ -492,11 +492,11 @@ void InterstitialPage::DontProceed() { // explicitely. Note that by calling DiscardNonCommittedEntries() we also // discard the pending entry, which is what we want, since the navigation is // cancelled. - tab_->controller().DiscardNonCommittedEntries(); + tab_->GetController().DiscardNonCommittedEntries(); } if (reload_on_dont_proceed_) - tab_->controller().Reload(true); + tab_->GetController().Reload(true); Hide(); // WARNING: we are now deleted! diff --git a/content/browser/tab_contents/navigation_controller_unittest.cc b/content/browser/tab_contents/navigation_controller_unittest.cc index 26b523b..305a630 100644 --- a/content/browser/tab_contents/navigation_controller_unittest.cc +++ b/content/browser/tab_contents/navigation_controller_unittest.cc @@ -1485,7 +1485,7 @@ TEST_F(NavigationControllerTest, RestoreNavigate) { entries.push_back(entry); TabContents our_contents( browser_context(), NULL, MSG_ROUTING_NONE, NULL, NULL); - NavigationController& our_controller = our_contents.controller(); + NavigationController& our_controller = our_contents.GetController(); our_controller.Restore(0, true, &entries); ASSERT_EQ(0u, entries.size()); @@ -1545,7 +1545,7 @@ TEST_F(NavigationControllerTest, RestoreNavigateAfterFailure) { entries.push_back(entry); TabContents our_contents( browser_context(), NULL, MSG_ROUTING_NONE, NULL, NULL); - NavigationController& our_controller = our_contents.controller(); + NavigationController& our_controller = our_contents.GetController(); our_controller.Restore(0, true, &entries); ASSERT_EQ(0u, entries.size()); @@ -1916,11 +1916,11 @@ TEST_F(NavigationControllerTest, CloneAndGoBack) { scoped_ptr<TabContents> clone(controller().tab_contents()->Clone()); - ASSERT_EQ(2, clone->controller().entry_count()); - EXPECT_TRUE(clone->controller().needs_reload()); - clone->controller().GoBack(); + ASSERT_EQ(2, clone->GetController().entry_count()); + EXPECT_TRUE(clone->GetController().needs_reload()); + clone->GetController().GoBack(); // Navigating back should have triggered needs_reload_ to go false. - EXPECT_FALSE(clone->controller().needs_reload()); + EXPECT_FALSE(clone->GetController().needs_reload()); } // Make sure that cloning a tabcontents doesn't copy interstitials. @@ -1938,7 +1938,7 @@ TEST_F(NavigationControllerTest, CloneOmitsInterstitials) { scoped_ptr<TabContents> clone(controller().tab_contents()->Clone()); - ASSERT_EQ(2, clone->controller().entry_count()); + ASSERT_EQ(2, clone->GetController().entry_count()); } // Tests a subframe navigation while a toplevel navigation is pending. @@ -1987,7 +1987,7 @@ TEST_F(NavigationControllerTest, CopyStateFromAndPrune) { NavigateAndCommit(url2); scoped_ptr<TestTabContents> other_contents(CreateTestTabContents()); - NavigationController& other_controller = other_contents->controller(); + NavigationController& other_controller = other_contents->GetController(); other_contents->NavigateAndCommit(url3); other_contents->ExpectSetHistoryLengthAndPrune( other_controller.GetEntryAtIndex(0)->site_instance(), 2, @@ -2017,7 +2017,7 @@ TEST_F(NavigationControllerTest, CopyStateFromAndPrune2) { controller().GoBack(); scoped_ptr<TestTabContents> other_contents(CreateTestTabContents()); - NavigationController& other_controller = other_contents->controller(); + NavigationController& other_controller = other_contents->GetController(); other_contents->ExpectSetHistoryLengthAndPrune(NULL, 1, -1); other_controller.CopyStateFromAndPrune(&controller()); @@ -2042,7 +2042,7 @@ TEST_F(NavigationControllerTest, CopyStateFromAndPrune3) { controller().GoBack(); scoped_ptr<TestTabContents> other_contents(CreateTestTabContents()); - NavigationController& other_controller = other_contents->controller(); + NavigationController& other_controller = other_contents->GetController(); other_controller.LoadURL( url3, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); other_contents->ExpectSetHistoryLengthAndPrune(NULL, 1, -1); diff --git a/content/browser/tab_contents/render_view_host_manager_unittest.cc b/content/browser/tab_contents/render_view_host_manager_unittest.cc index 6030864..5261516 100644 --- a/content/browser/tab_contents/render_view_host_manager_unittest.cc +++ b/content/browser/tab_contents/render_view_host_manager_unittest.cc @@ -168,7 +168,7 @@ TEST_F(RenderViewHostManagerTest, NewTabPageProcesses) { // Load the two URLs in the second tab. Note that the first navigation creates // a RVH that's not pending (since there is no cross-site transition), so // we use the committed one. - contents2.controller().LoadURL( + contents2.GetController().LoadURL( kNtpUrl, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); TestRenderViewHost* ntp_rvh2 = static_cast<TestRenderViewHost*>( @@ -178,7 +178,7 @@ TEST_F(RenderViewHostManagerTest, NewTabPageProcesses) { // The second one is the opposite, creating a cross-site transition and // requiring a beforeunload ack. - contents2.controller().LoadURL( + contents2.GetController().LoadURL( kDestUrl, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); EXPECT_TRUE(contents2.cross_navigation_pending()); @@ -199,7 +199,7 @@ TEST_F(RenderViewHostManagerTest, NewTabPageProcesses) { // SiteInstance. NavigateActiveAndCommit(kNtpUrl); - contents2.controller().LoadURL( + contents2.GetController().LoadURL( kNtpUrl, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); dest_rvh2->SendShouldCloseACK(true); @@ -292,7 +292,7 @@ TEST_F(RenderViewHostManagerTest, Navigate) { TestTabContents tab_contents(browser_context(), instance); notifications.ListenFor( content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, - content::Source<NavigationController>(&tab_contents.controller())); + content::Source<NavigationController>(&tab_contents.GetController())); // Create. RenderViewHostManager manager(&tab_contents, &tab_contents); @@ -380,7 +380,7 @@ TEST_F(RenderViewHostManagerTest, NavigateWithEarlyReNavigation) { TestTabContents tab_contents(browser_context(), instance); notifications.ListenFor( content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, - content::Source<NavigationController>(&tab_contents.controller())); + content::Source<NavigationController>(&tab_contents.GetController())); // Create. RenderViewHostManager manager(&tab_contents, &tab_contents); @@ -610,7 +610,7 @@ TEST_F(RenderViewHostManagerTest, PageDoesBackAndReload) { EXPECT_EQ(evil_rvh, contents()->render_manager_for_testing()->current_host()); // Also we should not have a pending navigation entry. - NavigationEntry* entry = contents()->controller().GetActiveEntry(); + NavigationEntry* entry = contents()->GetController().GetActiveEntry(); ASSERT_TRUE(entry != NULL); EXPECT_EQ(kUrl2, entry->url()); } diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index 705f505..a5219cf 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -330,6 +330,18 @@ void TabContents::RunFileChooser( delegate_->RunFileChooser(this, params); } +NavigationController& TabContents::GetController() { + return controller_; +} + +const NavigationController& TabContents::GetController() const { + return controller_; +} + +void TabContents::SetViewType(content::ViewType type) { + view_type_ = type; +} + content::RenderProcessHost* TabContents::GetRenderProcessHost() const { if (render_manager_.current_host()) return render_manager_.current_host()->process(); @@ -691,7 +703,7 @@ TabContents* TabContents::Clone() { browser_context(), SiteInstance::CreateSiteInstance(browser_context()), MSG_ROUTING_NONE, this, NULL); - tc->controller().CopyStateFrom(controller_); + tc->GetController().CopyStateFrom(controller_); return tc; } @@ -858,7 +870,7 @@ double TabContents::GetZoomLevel() const { GetRenderProcessHost()->GetID(), GetRenderViewHost()->routing_id()); } else { GURL url; - NavigationEntry* active_entry = controller().GetActiveEntry(); + NavigationEntry* active_entry = GetController().GetActiveEntry(); // Since zoom map is updated using rewritten URL, use rewritten URL // to get the zoom level. url = active_entry ? active_entry->url() : GURL::EmptyGURL(); @@ -883,7 +895,7 @@ void TabContents::ViewSource() { if (!delegate_) return; - NavigationEntry* active_entry = controller().GetActiveEntry(); + NavigationEntry* active_entry = GetController().GetActiveEntry(); if (!active_entry) return; @@ -1069,7 +1081,7 @@ void TabContents::OnDidLoadResourceFromMemoryCache( void TabContents::OnDidDisplayInsecureContent() { content::RecordAction(UserMetricsAction("SSL.DisplayedInsecureContent")); displayed_insecure_content_ = true; - SSLManager::NotifySSLInternalStateChanged(&controller()); + SSLManager::NotifySSLInternalStateChanged(&GetController()); } void TabContents::OnDidRunInsecureContent( @@ -1083,7 +1095,7 @@ void TabContents::OnDidRunInsecureContent( } controller_.ssl_manager()->DidRunInsecureContent(security_origin); displayed_insecure_content_ = true; - SSLManager::NotifySSLInternalStateChanged(&controller()); + SSLManager::NotifySSLInternalStateChanged(&GetController()); } void TabContents::OnDocumentLoadedInFrame(int64 frame_id) { @@ -2013,7 +2025,7 @@ void TabContents::NotifySwappedFromRenderManager() { } NavigationController& TabContents::GetControllerForRenderManager() { - return controller(); + return GetController(); } WebUI* TabContents::CreateWebUIForRenderManager(const GURL& url) { diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h index 02aa238..82963a5 100644 --- a/content/browser/tab_contents/tab_contents.h +++ b/content/browser/tab_contents/tab_contents.h @@ -87,31 +87,15 @@ class CONTENT_EXPORT TabContents : public content::WebContents, // Intrinsic tab state ------------------------------------------------------- - // Gets the controller for this tab contents. - NavigationController& controller() { return controller_; } - const NavigationController& controller() const { return controller_; } - // Returns the user browser context associated with this TabContents (via the // NavigationController). content::BrowserContext* browser_context() const { return controller_.browser_context(); } - // Allows overriding the type of this tab. - void set_view_type(content::ViewType type) { view_type_ = type; } - // Returns the SavePackage which manages the page saving job. May be NULL. SavePackage* save_package() const { return save_package_.get(); } - // Return the currently active RenderProcessHost and RenderViewHost. Each of - // these may change over time. - content::RenderProcessHost* GetRenderProcessHost() const; - - - - - - WebUI* committed_web_ui() const { return render_manager_.web_ui(); } @@ -469,8 +453,11 @@ class CONTENT_EXPORT TabContents : public content::WebContents, virtual base::PropertyBag* GetPropertyBag() OVERRIDE; virtual content::WebContentsDelegate* GetDelegate() OVERRIDE; virtual void SetDelegate(content::WebContentsDelegate* delegate) OVERRIDE; - - + virtual NavigationController& GetController() OVERRIDE; + virtual const NavigationController& GetController() const OVERRIDE; + // TODO(jam): browser_context getters go here + virtual void SetViewType(content::ViewType type) OVERRIDE; + virtual content::RenderProcessHost* GetRenderProcessHost() const OVERRIDE; virtual RenderViewHost* GetRenderViewHost() const OVERRIDE; // TODO(jam): webui stuff goes here virtual RenderWidgetHostView* GetRenderWidgetHostView() const OVERRIDE; diff --git a/content/browser/tab_contents/tab_contents_unittest.cc b/content/browser/tab_contents/tab_contents_unittest.cc index 8d6470e..d014cd5 100644 --- a/content/browser/tab_contents/tab_contents_unittest.cc +++ b/content/browser/tab_contents/tab_contents_unittest.cc @@ -464,9 +464,9 @@ TEST_F(TabContentsTest, NavigateTwoTabsCrossSite) { // Open a new tab with the same SiteInstance, navigated to the same site. TestTabContents contents2(browser_context_.get(), instance1); contents2.transition_cross_site = true; - contents2.controller().LoadURL(url, content::Referrer(), - content::PAGE_TRANSITION_TYPED, - std::string()); + contents2.GetController().LoadURL(url, content::Referrer(), + content::PAGE_TRANSITION_TYPED, + std::string()); // Need this page id to be 2 since the site instance is the same (which is the // scope of page IDs) and we want to consider this a new page. contents2.TestDidNavigate( @@ -486,9 +486,9 @@ TEST_F(TabContentsTest, NavigateTwoTabsCrossSite) { // Navigate second tab to the same site as the first tab const GURL url2b("http://mail.yahoo.com"); - contents2.controller().LoadURL(url2b, content::Referrer(), - content::PAGE_TRANSITION_TYPED, - std::string()); + contents2.GetController().LoadURL(url2b, content::Referrer(), + content::PAGE_TRANSITION_TYPED, + std::string()); TestRenderViewHost* rvh2 = static_cast<TestRenderViewHost*>(contents2.GetRenderViewHost()); rvh2->SendShouldCloseACK(true); @@ -526,9 +526,9 @@ TEST_F(TabContentsTest, CrossSiteComparesAgainstCurrentPage) { TestTabContents contents2(browser_context_.get(), instance1); contents2.transition_cross_site = true; const GURL url2("http://www.yahoo.com"); - contents2.controller().LoadURL(url2, content::Referrer(), - content::PAGE_TRANSITION_TYPED, - std::string()); + contents2.GetController().LoadURL(url2, content::Referrer(), + content::PAGE_TRANSITION_TYPED, + std::string()); // The first RVH in contents2 isn't live yet, so we shortcut the cross site // pending. TestRenderViewHost* rvh2 = static_cast<TestRenderViewHost*>( @@ -1640,7 +1640,7 @@ TEST_F(TabContentsTest, NewInterstitialDoesNotCancelPendingEntry) { const GURL kGURL(kUrl); // Start a navigation to a page - contents()->controller().LoadURL( + contents()->GetController().LoadURL( kGURL, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); @@ -1656,7 +1656,7 @@ TEST_F(TabContentsTest, NewInterstitialDoesNotCancelPendingEntry) { // Initiate a new navigation from the browser that also triggers an // interstitial. - contents()->controller().LoadURL( + contents()->GetController().LoadURL( kGURL, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); TestInterstitialPage::InterstitialState state2 = @@ -1669,7 +1669,7 @@ TEST_F(TabContentsTest, NewInterstitialDoesNotCancelPendingEntry) { interstitial2->TestDidNavigate(1, kGURL); // Make sure we still have an entry. - NavigationEntry* entry = contents()->controller().pending_entry(); + NavigationEntry* entry = contents()->GetController().pending_entry(); ASSERT_TRUE(entry); EXPECT_EQ(kUrl, entry->url().spec()); @@ -1687,7 +1687,7 @@ TEST_F(TabContentsTest, NoJSMessageOnInterstitials) { const GURL kGURL(kUrl); // Start a navigation to a page - contents()->controller().LoadURL( + contents()->GetController().LoadURL( kGURL, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); // DidNavigate from the page @@ -1742,7 +1742,7 @@ TEST_F(TabContentsTest, CopyStateFromAndPruneSourceInterstitial) { // Create another NavigationController. GURL url3("http://foo2"); scoped_ptr<TestTabContents> other_contents(CreateTestTabContents()); - NavigationController& other_controller = other_contents->controller(); + NavigationController& other_controller = other_contents->GetController(); other_contents->NavigateAndCommit(url3); other_contents->ExpectSetHistoryLengthAndPrune( other_controller.GetEntryAtIndex(0)->site_instance(), 1, @@ -1768,7 +1768,7 @@ TEST_F(TabContentsTest, CopyStateFromAndPruneTargetInterstitial) { // Create another NavigationController. scoped_ptr<TestTabContents> other_contents(CreateTestTabContents()); - NavigationController& other_controller = other_contents->controller(); + NavigationController& other_controller = other_contents->GetController(); // Navigate it to url2. GURL url2("http://foo2"); diff --git a/content/browser/tab_contents/test_tab_contents.cc b/content/browser/tab_contents/test_tab_contents.cc index f0b6cc4..60b5a0b 100644 --- a/content/browser/tab_contents/test_tab_contents.cc +++ b/content/browser/tab_contents/test_tab_contents.cc @@ -82,12 +82,12 @@ bool TestTabContents::CreateRenderViewForRenderManager( TabContents* TestTabContents::Clone() { TabContents* tc = new TestTabContents( browser_context(), SiteInstance::CreateSiteInstance(browser_context())); - tc->controller().CopyStateFrom(controller_); + tc->GetController().CopyStateFrom(controller_); return tc; } void TestTabContents::NavigateAndCommit(const GURL& url) { - controller().LoadURL( + GetController().LoadURL( url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); GURL loaded_url(url); bool reverse_on_redirect = false; @@ -109,7 +109,7 @@ void TestTabContents::CommitPendingNavigation() { if (!rvh) rvh = static_cast<TestRenderViewHost*>(old_rvh); - const NavigationEntry* entry = controller().pending_entry(); + const NavigationEntry* entry = GetController().pending_entry(); DCHECK(entry); int page_id = entry->page_id(); if (page_id == -1) { |