diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-15 23:19:42 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-15 23:19:42 +0000 |
commit | b680ad2269af98da01b992e15130e18bfcb7783c (patch) | |
tree | d20c4bf1b3eec9ba7cc761b5a93985eccbe22ed8 /chrome/browser/tab_contents | |
parent | 7fd4cc37ca4361f04bb45da1ec06210e84c7c303 (diff) | |
download | chromium_src-b680ad2269af98da01b992e15130e18bfcb7783c.zip chromium_src-b680ad2269af98da01b992e15130e18bfcb7783c.tar.gz chromium_src-b680ad2269af98da01b992e15130e18bfcb7783c.tar.bz2 |
Remove TabContnetsType from everywhere.
I also removed the notion of the "active" tab contents since there is only one
per tab now, and all the messages to replace them.
Review URL: http://codereview.chromium.org/67173
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13808 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents')
-rw-r--r-- | chrome/browser/tab_contents/navigation_controller.cc | 20 | ||||
-rw-r--r-- | chrome/browser/tab_contents/navigation_entry.cc | 16 | ||||
-rw-r--r-- | chrome/browser/tab_contents/navigation_entry.h | 12 | ||||
-rw-r--r-- | chrome/browser/tab_contents/render_view_host_manager.cc | 3 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.cc | 10 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.h | 20 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents_delegate.h | 5 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents_type.h | 20 | ||||
-rw-r--r-- | chrome/browser/tab_contents/web_contents.cc | 7 |
9 files changed, 13 insertions, 100 deletions
diff --git a/chrome/browser/tab_contents/navigation_controller.cc b/chrome/browser/tab_contents/navigation_controller.cc index ff39c7d..77cf714 100644 --- a/chrome/browser/tab_contents/navigation_controller.cc +++ b/chrome/browser/tab_contents/navigation_controller.cc @@ -373,8 +373,7 @@ NavigationEntry* NavigationController::CreateNavigationEntry( GURL loaded_url(url); BrowserURLHandler::RewriteURLIfNecessary(&loaded_url); - NavigationEntry* entry = new NavigationEntry(TAB_CONTENTS_WEB, NULL, -1, - loaded_url, referrer, + NavigationEntry* entry = new NavigationEntry(NULL, -1, loaded_url, referrer, string16(), transition); entry->set_display_url(url); entry->set_user_typed_url(url); @@ -621,7 +620,7 @@ void NavigationController::RendererDidNavigateToNewPage( // type must always be normal. new_entry->set_page_type(NavigationEntry::NORMAL_PAGE); } else { - new_entry = new NavigationEntry(tab_contents_->type()); + new_entry = new NavigationEntry; } new_entry->set_url(params.url); @@ -862,27 +861,16 @@ void NavigationController::SetWindowID(const SessionID& id) { } void NavigationController::NavigateToPendingEntry(bool reload) { - TabContents* from_contents = tab_contents_; - // For session history navigations only the pending_entry_index_ is set. if (!pending_entry_) { DCHECK(pending_entry_index_ != -1); pending_entry_ = entries_[pending_entry_index_].get(); } - if (from_contents && from_contents->type() != pending_entry_->tab_type()) - from_contents->set_is_active(false); - - TabContents* contents = GetTabContentsCreateIfNecessary(*pending_entry_); - - contents->set_is_active(true); - tab_contents_ = contents; - - if (from_contents && from_contents != contents && from_contents->delegate()) - from_contents->delegate()->ReplaceContents(from_contents, contents); + tab_contents_ = GetTabContentsCreateIfNecessary(*pending_entry_); NavigationEntry temp_entry(*pending_entry_); - if (!contents->NavigateToPendingEntry(reload)) + if (!tab_contents_->NavigateToPendingEntry(reload)) DiscardNonCommittedEntries(); } diff --git a/chrome/browser/tab_contents/navigation_entry.cc b/chrome/browser/tab_contents/navigation_entry.cc index c07c08e..7633ac6 100644 --- a/chrome/browser/tab_contents/navigation_entry.cc +++ b/chrome/browser/tab_contents/navigation_entry.cc @@ -34,7 +34,6 @@ NavigationEntry::FaviconStatus::FaviconStatus() : valid_(false) { NavigationEntry::NavigationEntry() : unique_id_(GetUniqueID()), - tab_type_(TAB_CONTENTS_WEB), site_instance_(NULL), page_type_(NORMAL_PAGE), page_id_(-1), @@ -43,26 +42,13 @@ NavigationEntry::NavigationEntry() restored_(false) { } -NavigationEntry::NavigationEntry(TabContentsType type) - : unique_id_(GetUniqueID()), - tab_type_(type), - site_instance_(NULL), - page_type_(NORMAL_PAGE), - page_id_(-1), - transition_type_(PageTransition::LINK), - has_post_data_(false), - restored_(false) { -} - -NavigationEntry::NavigationEntry(TabContentsType type, - SiteInstance* instance, +NavigationEntry::NavigationEntry(SiteInstance* instance, int page_id, const GURL& url, const GURL& referrer, const string16& title, PageTransition::Type transition_type) : unique_id_(GetUniqueID()), - tab_type_(type), site_instance_(instance), page_type_(NORMAL_PAGE), url_(url), diff --git a/chrome/browser/tab_contents/navigation_entry.h b/chrome/browser/tab_contents/navigation_entry.h index 9a39d14..677e633 100644 --- a/chrome/browser/tab_contents/navigation_entry.h +++ b/chrome/browser/tab_contents/navigation_entry.h @@ -10,7 +10,6 @@ #include "base/string_util.h" #include "chrome/browser/tab_contents/security_style.h" #include "chrome/browser/tab_contents/site_instance.h" -#include "chrome/browser/tab_contents/tab_contents_type.h" #include "chrome/common/page_transition_types.h" #include "googleurl/src/gurl.h" #include "grit/theme_resources.h" @@ -175,9 +174,7 @@ class NavigationEntry { // --------------------------------------------------------------------------- NavigationEntry(); - explicit NavigationEntry(TabContentsType type); - NavigationEntry(TabContentsType type, - SiteInstance* instance, + NavigationEntry(SiteInstance* instance, int page_id, const GURL& url, const GURL& referrer, @@ -199,12 +196,6 @@ class NavigationEntry { return unique_id_; } - // Return the TabContents type required to display this entry. Immutable - // because a tab can never change its type. - TabContentsType tab_type() const { - return tab_type_; - } - // The SiteInstance tells us how to share sub-processes when the tab type is // TAB_CONTENTS_WEB. This will be NULL otherwise. This is a reference counted // pointer to a shared site instance. @@ -399,7 +390,6 @@ class NavigationEntry { // See the accessors above for descriptions. int unique_id_; - TabContentsType tab_type_; scoped_refptr<SiteInstance> site_instance_; PageType page_type_; GURL url_; diff --git a/chrome/browser/tab_contents/render_view_host_manager.cc b/chrome/browser/tab_contents/render_view_host_manager.cc index b9fa344..be813aa 100644 --- a/chrome/browser/tab_contents/render_view_host_manager.cc +++ b/chrome/browser/tab_contents/render_view_host_manager.cc @@ -391,9 +391,8 @@ SiteInstance* RenderViewHostManager::GetSiteInstanceForEntry( bool RenderViewHostManager::CreatePendingRenderView(SiteInstance* instance) { NavigationEntry* curr_entry = delegate_->GetControllerForRenderManager()->GetLastCommittedEntry(); - if (curr_entry && curr_entry->tab_type() == TAB_CONTENTS_WEB) { + if (curr_entry) { DCHECK(!curr_entry->content_state().empty()); - // TODO(creis): Should send a message to the RenderView to let it know // we're about to switch away, so that it sends an UpdateState message. } diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index b866589..1c7e08f 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -37,12 +37,10 @@ BOOL CALLBACK InvalidateWindow(HWND hwnd, LPARAM lparam) { } // namespace #endif -TabContents::TabContents(TabContentsType type) - : type_(type), - delegate_(NULL), +TabContents::TabContents() + : delegate_(NULL), controller_(NULL), is_loading_(false), - is_active_(true), is_crashed_(false), waiting_for_response_(false), shelf_visible_(false), @@ -498,10 +496,6 @@ void TabContents::SetIsLoading(bool is_loading, is_loading_ = is_loading; waiting_for_response_ = is_loading; - // Suppress notifications for this TabContents if we are not active. - if (!is_active_) - return; - if (delegate_) delegate_->LoadingStateChanged(this); diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h index 7ccc275..c93ff4c 100644 --- a/chrome/browser/tab_contents/tab_contents.h +++ b/chrome/browser/tab_contents/tab_contents.h @@ -18,7 +18,6 @@ #include "chrome/browser/tab_contents/infobar_delegate.h" #include "chrome/browser/tab_contents/navigation_controller.h" #include "chrome/browser/tab_contents/page_navigator.h" -#include "chrome/browser/tab_contents/tab_contents_type.h" #include "chrome/common/navigation_types.h" #include "chrome/common/notification_registrar.h" #include "chrome/common/property_bag.h" @@ -97,9 +96,6 @@ class TabContents : public PageNavigator, // Intrinsic tab state ------------------------------------------------------- - // Returns the type of tab this is. See also the As* functions following. - TabContentsType type() const { return type_; } - // Returns the property bag for this tab contents, where callers can add // extra data they may wish to associate with the tab. Returns a pointer // rather than a reference since the PropertyAccessors expect this. @@ -224,12 +220,6 @@ class TabContents : public PageNavigator, bool is_crashed() const { return is_crashed_; } void SetIsCrashed(bool state); - // Set whether this tab contents is active. A tab content is active for a - // given tab if it is currently being used to display some contents. Note that - // this is different from whether a tab is selected. - bool is_active() const { return is_active_; } - void set_is_active(bool active) { is_active_ = active; } - // Whether the tab is in the process of being destroyed. // Added as a tentative work-around for focus related bug #4633. This allows // us not to store focus when a tab is being closed. @@ -426,10 +416,7 @@ class TabContents : public PageNavigator, // automation purposes. friend class AutomationProvider; - explicit TabContents(TabContentsType type); - - // Some tab contents types need to override the type. - void set_type(TabContentsType type) { type_ = type; } + TabContents(); // NOTE: the TabContents destructor can run after the NavigationController // has gone away, so any complicated unregistering that expects the profile @@ -476,8 +463,6 @@ class TabContents : public PageNavigator, // Data ---------------------------------------------------------------------- - TabContentsType type_; - TabContentsDelegate* delegate_; NavigationController* controller_; @@ -488,9 +473,6 @@ class TabContents : public PageNavigator, // Indicates whether we're currently loading a resource. bool is_loading_; - // See is_active() getter above. - bool is_active_; - bool is_crashed_; // true if the tab is considered crashed. // See waiting_for_response() above. diff --git a/chrome/browser/tab_contents/tab_contents_delegate.h b/chrome/browser/tab_contents/tab_contents_delegate.h index 152f83d..ac8739c 100644 --- a/chrome/browser/tab_contents/tab_contents_delegate.h +++ b/chrome/browser/tab_contents/tab_contents_delegate.h @@ -45,11 +45,6 @@ class TabContentsDelegate : public PageNavigator { virtual void NavigationStateChanged(const TabContents* source, unsigned changed_flags) = 0; - // Called to cause the delegate to replace the source contents with the new - // contents. - virtual void ReplaceContents(TabContents* source, - TabContents* new_contents) = 0; - // Creates a new tab with the already-created TabContents 'new_contents'. // The window for the added contents should be reparented correctly when this // method returns. If |disposition| is NEW_POPUP, |pos| should hold the diff --git a/chrome/browser/tab_contents/tab_contents_type.h b/chrome/browser/tab_contents/tab_contents_type.h deleted file mode 100644 index f918a76..0000000 --- a/chrome/browser/tab_contents/tab_contents_type.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_TYPE_H__ -#define CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_TYPE_H__ - -// The different kinds of tab contents we support. This is declared outside of -// TabContents to eliminate the circular dependency between NavigationEntry -// (which requires a tab type) and TabContents (which requires a -// NavigationEntry). -enum TabContentsType { - TAB_CONTENTS_UNKNOWN_TYPE = 0, - TAB_CONTENTS_WEB, - - // DO NOT EVEN THINK ABOUT ADDING MORE TAB CONTENTS TYPES HERE. SEE brettw. - TAB_CONTENTS_NUM_TYPES -}; - -#endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_TYPE_H__ diff --git a/chrome/browser/tab_contents/web_contents.cc b/chrome/browser/tab_contents/web_contents.cc index e35f941..5077064 100644 --- a/chrome/browser/tab_contents/web_contents.cc +++ b/chrome/browser/tab_contents/web_contents.cc @@ -193,8 +193,7 @@ WebContents::WebContents(Profile* profile, SiteInstance* site_instance, int routing_id, base::WaitableEvent* modal_dialog_event) - : TabContents(TAB_CONTENTS_WEB), - view_(WebContentsView::Create(this)), + : view_(WebContentsView::Create(this)), ALLOW_THIS_IN_INITIALIZER_LIST(render_manager_(this, this)), printing_(*this), notify_disconnection_(false), @@ -797,7 +796,7 @@ void WebContents::DidNavigate(RenderViewHost* rvh, render_manager_.DidNavigateMainFrame(rvh); // We can't do anything about navigations when we're inactive. - if (!controller() || !is_active()) + if (!controller()) return; // Update the site of the SiteInstance if it doesn't have one yet. @@ -983,7 +982,7 @@ void WebContents::DidRedirectProvisionalLoad(int32 page_id, entry = controller()->pending_entry(); else entry = controller()->GetEntryWithPageID(GetSiteInstance(), page_id); - if (!entry || entry->tab_type() != type() || entry->url() != source_url) + if (!entry || entry->url() != source_url) return; entry->set_url(target_url); } |