Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3420)

Unified Diff: chrome/browser/tabs/tab_strip_model.h

Issue 10105030: TabContents -> WebContentsImpl, part 21. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/tabs/tab_strip_model_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tabs/tab_strip_model.h
diff --git a/chrome/browser/tabs/tab_strip_model.h b/chrome/browser/tabs/tab_strip_model.h
index 29181a456f5763d2f7b41b0174afba6210e7298d..1f856b5017d26249e70b4649392735998e78db00 100644
--- a/chrome/browser/tabs/tab_strip_model.h
+++ b/chrome/browser/tabs/tab_strip_model.h
@@ -30,9 +30,9 @@ class WebContents;
// TabStripModel
//
// A model & low level controller of a Browser Window tabstrip. Holds a vector
-// of TabContents, and provides an API for adding, removing and shuffling
-// them, as well as a higher level API for doing specific Browser-related
-// tasks like adding new Tabs from just a URL, etc.
+// of TabContentsWrappers, and provides an API for adding, removing and
+// shuffling them, as well as a higher level API for doing specific Browser-
+// related tasks like adding new Tabs from just a URL, etc.
//
// Each tab may be any one of the following states:
// . Mini-tab. Mini tabs are locked to the left side of the tab strip and
@@ -77,7 +77,7 @@ class TabStripModel : public content::NotificationObserver {
CLOSE_NONE = 0,
// Indicates the tab was closed by the user. If true,
- // TabContents::SetClosedByUserGesture(true) is invoked.
+ // WebContents::SetClosedByUserGesture(true) is invoked.
CLOSE_USER_GESTURE = 1 << 0,
// If true the history is recorded so that the tab can be reopened later.
@@ -97,9 +97,9 @@ class TabStripModel : public content::NotificationObserver {
// The tab should be pinned.
ADD_PINNED = 1 << 1,
- // If not set the insertion index of the TabContents is left up to the Order
- // Controller associated, so the final insertion index may differ from the
- // specified index. Otherwise the index supplied is used.
+ // If not set the insertion index of the TabContentsWrapper is left up to
+ // the Order Controller associated, so the final insertion index may differ
+ // from the specified index. Otherwise the index supplied is used.
ADD_FORCE_INDEX = 1 << 2,
// If set the newly inserted tab inherits the group of the currently
@@ -134,7 +134,7 @@ class TabStripModel : public content::NotificationObserver {
// Retrieve the Profile associated with this TabStripModel.
Profile* profile() const { return profile_; }
- // Retrieve the index of the currently active TabContents.
+ // Retrieve the index of the currently active TabContentsWrapper.
int active_index() const { return selection_model_.active(); }
// Returns true if the tabstrip is currently closing all open tabs (via a
@@ -161,12 +161,12 @@ class TabStripModel : public content::NotificationObserver {
// Determines if the specified index is contained within the TabStripModel.
bool ContainsIndex(int index) const;
- // Adds the specified TabContents in the default location. Tabs opened in the
- // foreground inherit the group of the previously active tab.
+ // Adds the specified TabContentsWrapper in the default location. Tabs opened
+ // in the foreground inherit the group of the previously active tab.
void AppendTabContents(TabContentsWrapper* contents, bool foreground);
- // Adds the specified TabContents at the specified location. |add_types| is a
- // bitmask of AddTypes; see it for details.
+ // Adds the specified TabContentsWrapper at the specified location.
+ // |add_types| is a bitmask of AddTypes; see it for details.
//
// All append/insert methods end up in this method.
//
@@ -179,12 +179,12 @@ class TabStripModel : public content::NotificationObserver {
TabContentsWrapper* contents,
int add_types);
- // Closes the TabContents at the specified index. This causes the TabContents
- // to be destroyed, but it may not happen immediately (e.g. if it's a
- // TabContents). |close_types| is a bitmask of CloseTypes.
- // Returns true if the TabContents was closed immediately, false if it was not
- // closed (we may be waiting for a response from an onunload handler, or
- // waiting for the user to confirm closure).
+ // Closes the TabContentsWrapper at the specified index. This causes the
+ // TabContentsWrapper to be destroyed, but it may not happen immediately.
+ // |close_types| is a bitmask of CloseTypes. Returns true if the
+ // TabContentsWrapper was closed immediately, false if it was not closed (we
+ // may be waiting for a response from an onunload handler, or waiting for the
+ // user to confirm closure).
bool CloseTabContentsAt(int index, uint32 close_types);
// Replaces the entire state of a the tab at index by switching in a
@@ -204,15 +204,15 @@ class TabStripModel : public content::NotificationObserver {
TabContentsWrapper* ReplaceTabContentsAt(int index,
TabContentsWrapper* new_contents);
- // Destroys the TabContents at the specified index, but keeps the tab visible
- // in the tab strip. Used to free memory in low-memory conditions, especially
- // on Chrome OS. The tab reloads if the user clicks on it.
+ // Destroys the TabContentsWrapper at the specified index, but keeps the tab
+ // visible in the tab strip. Used to free memory in low-memory conditions,
+ // especially on Chrome OS. The tab reloads if the user clicks on it.
// Returns an empty TabContentsWrapper, used only for testing.
TabContentsWrapper* DiscardTabContentsAt(int index);
- // Detaches the TabContents at the specified index from this strip. The
- // TabContents is not destroyed, just removed from display. The caller is
- // responsible for doing something with it (e.g. stuffing it into another
+ // Detaches the TabContentsWrapper at the specified index from this strip. The
+ // TabContentsWrapper is not destroyed, just removed from display. The caller
+ // is responsible for doing something with it (e.g. stuffing it into another
// strip).
TabContentsWrapper* DetachTabContentsAt(int index);
@@ -226,9 +226,9 @@ class TabStripModel : public content::NotificationObserver {
// active tab index.
void AddTabAtToSelection(int index);
- // Move the TabContents at the specified index to another index. This method
- // does NOT send Detached/Attached notifications, rather it moves the
- // TabContents inline and sends a Moved notification instead.
+ // Move the TabContentsWrapper at the specified index to another index. This
+ // method does NOT send Detached/Attached notifications, rather it moves the
+ // TabContentsWrapper inline and sends a Moved notification instead.
// If |select_after_move| is false, whatever tab was selected before the move
// will still be selected, but it's index may have incremented or decremented
// one slot.
@@ -254,23 +254,24 @@ class TabStripModel : public content::NotificationObserver {
// 1)
void MoveSelectedTabsTo(int index);
- // Returns the currently active TabContents, or NULL if there is none.
+ // Returns the currently active TabContentsWrapper, or NULL if there is none.
TabContentsWrapper* GetActiveTabContents() const;
// Returns the TabContentsWrapper at the specified index, or NULL if there is
// none.
TabContentsWrapper* GetTabContentsAt(int index) const;
- // Returns the index of the specified TabContents wrapper, or
- // TabStripModel::kNoTab if the TabContents is not in this TabStripModel.
+ // Returns the index of the specified TabContentsWrapper, or
+ // TabStripModel::kNoTab if the TabContentsWrapper is not in this
+ // TabStripModel.
int GetIndexOfTabContents(const TabContentsWrapper* contents) const;
- // Returns the index of the specified WebContents wrapper given its raw
- // WebContents, or TabStripModel::kNoTab if the TabContents is not in this
+ // Returns the index of the specified TabContentsWrapper given its raw
+ // WebContents, or TabStripModel::kNoTab if the WebContents is not in this
// TabStripModel. Note: This is only needed in rare cases where the wrapper
// is not already present (such as implementing WebContentsDelegate methods,
// which don't know about the wrapper. Returns NULL if |contents| is not
- // associated with any wrapper in the model.
+ // associated with any TabContentsWrapper in the model.
int GetWrapperIndex(const content::WebContents* contents) const;
// Returns the index of the specified NavigationController, or kNoTab if it is
@@ -278,7 +279,7 @@ class TabStripModel : public content::NotificationObserver {
int GetIndexOfController(
const content::NavigationController* controller) const;
- // Notify any observers that the TabContents at the specified index has
+ // Notify any observers that the TabContentsWrapper at the specified index has
// changed in some way. See TabChangeType for details of |change_type|.
void UpdateTabContentsStateAt(
int index,
@@ -294,42 +295,44 @@ class TabStripModel : public content::NotificationObserver {
// notifications this method causes.
void CloseAllTabs();
- // Returns true if there are any TabContents that are currently loading.
+ // Returns true if there are any TabContentsWrappers that are currently
+ // loading.
bool TabsAreLoading() const;
- // Returns the controller controller that opened the TabContents at |index|.
+ // Returns the controller controller that opened the TabContentsWrapper at
+ // |index|.
content::NavigationController* GetOpenerOfTabContentsAt(int index);
- // Changes the |opener| of the TabContents at |index|.
+ // Changes the |opener| of the TabContentsWrapper at |index|.
// Note: |opener| must be in this tab strip.
void SetOpenerOfTabContentsAt(
int index,
content::NavigationController* opener);
- // Returns the index of the next TabContents in the sequence of TabContentses
- // spawned by the specified NavigationController after |start_index|.
- // If |use_group| is true, the group property of the tab is used instead of
- // the opener to find the next tab. Under some circumstances the group
- // relationship may exist but the opener may not.
+ // Returns the index of the next TabContentsWrapper in the sequence of
+ // TabContentsWrappers spawned by the specified NavigationController after
+ // |start_index|. If |use_group| is true, the group property of the tab is
+ // used instead of the opener to find the next tab. Under some circumstances
+ // the group relationship may exist but the opener may not.
int GetIndexOfNextTabContentsOpenedBy(
const content::NavigationController* opener,
int start_index,
bool use_group) const;
- // Returns the index of the first TabContents in the model opened by the
- // specified opener.
+ // Returns the index of the first TabContentsWrapper in the model opened by
+ // the specified opener.
int GetIndexOfFirstTabContentsOpenedBy(
const content::NavigationController* opener,
int start_index) const;
- // Returns the index of the last TabContents in the model opened by the
+ // Returns the index of the last TabContentsWrapper in the model opened by the
// specified opener, starting at |start_index|.
int GetIndexOfLastTabContentsOpenedBy(
const content::NavigationController* opener,
int start_index) const;
// Called by the Browser when a navigation is about to occur in the specified
- // TabContents. Depending on the tab, and the transition type of the
+ // TabContentsWrapper. Depending on the tab, and the transition type of the
// navigation, the TabStripModel may adjust its selection and grouping
// behavior.
void TabNavigating(TabContentsWrapper* contents,
@@ -342,11 +345,11 @@ class TabStripModel : public content::NotificationObserver {
// TabStripModelOrderController.
void ForgetAllOpeners();
- // Forgets the group affiliation of the specified TabContents. This should be
- // called when a TabContents that is part of a logical group of tabs is
- // moved to a new logical context by the user (e.g. by typing a new URL or
- // selecting a bookmark). This also forgets the opener, which is considered
- // a weaker relationship than group.
+ // Forgets the group affiliation of the specified TabContentsWrapper. This
+ // should be called when a TabContentsWrapper that is part of a logical group
+ // of tabs is moved to a new logical context by the user (e.g. by typing a new
+ // URL or selecting a bookmark). This also forgets the opener, which is
+ // considered a weaker relationship than group.
void ForgetGroup(TabContentsWrapper* contents);
// Returns true if the group/opener relationships present for |contents|
@@ -375,8 +378,8 @@ class TabStripModel : public content::NotificationObserver {
// Returns true if the tab at |index| is blocked by a tab modal dialog.
bool IsTabBlocked(int index) const;
- // Returns true if the TabContents at |index| has been discarded to save
- // memory. See DiscardTabContentsAt() for details.
+ // Returns true if the TabContentsWrapper at |index| has been discarded to
+ // save memory. See DiscardTabContentsAt() for details.
bool IsTabDiscarded(int index) const;
// Returns the index of the first tab that is not a mini-tab. This returns
@@ -414,10 +417,10 @@ class TabStripModel : public content::NotificationObserver {
// Command level API /////////////////////////////////////////////////////////
- // Adds a TabContents at the best position in the TabStripModel given the
- // specified insertion index, transition, etc. |add_types| is a bitmask of
+ // Adds a TabContentsWrapper at the best position in the TabStripModel given
+ // the specified insertion index, transition, etc. |add_types| is a bitmask of
// AddTypes; see it for details. This method ends up calling into
- // InsertTabContentsAt to do the actual inertion.
+ // InsertTabContentsAt to do the actual insertion.
void AddTabContents(TabContentsWrapper* contents,
int index,
content::PageTransition transition,
@@ -512,21 +515,21 @@ class TabStripModel : public content::NotificationObserver {
// determine which indices the command applies to.
std::vector<int> GetIndicesForCommand(int index) const;
- // Returns true if the specified TabContents is a New Tab at the end of the
- // TabStrip. We check for this because opener relationships are _not_
+ // Returns true if the specified TabContentsWrapper is a New Tab at the end of
+ // the TabStrip. We check for this because opener relationships are _not_
// forgotten for the New Tab page opened as a result of a New Tab gesture
// (e.g. Ctrl+T, etc) since the user may open a tab transiently to look up
// something related to their current activity.
bool IsNewTabAtEndOfTabStrip(TabContentsWrapper* contents) const;
- // Closes the TabContents at the specified indices. This causes the
- // TabContents to be destroyed, but it may not happen immediately. If the
- // page in question has an unload event the TabContents will not be destroyed
- // until after the event has completed, which will then call back into this
- // method.
+ // Closes the TabContentsWrappers at the specified indices. This causes the
+ // TabContentsWrappers to be destroyed, but it may not happen immediately. If
+ // the page in question has an unload event the WebContents will not be
+ // destroyed until after the event has completed, which will then call back
+ // into this method.
//
- // Returns true if the TabContents were closed immediately, false if we are
- // waiting for the result of an onunload handler.
+ // Returns true if the TabContentsWrapper were closed immediately, false if we
+ // are waiting for the result of an onunload handler.
bool InternalCloseTabs(const std::vector<int>& in_indices,
uint32 close_types);
@@ -598,9 +601,9 @@ class TabStripModel : public content::NotificationObserver {
// Our delegate.
TabStripModelDelegate* delegate_;
- // A hunk of data representing a TabContents and (optionally) the
+ // A hunk of data representing a TabContentsWrapper and (optionally) the
// NavigationController that spawned it. This memory only sticks around while
- // the TabContents is in the current TabStripModel, unless otherwise
+ // the TabContentsWrapper is in the current TabStripModel, unless otherwise
// specified in code.
struct TabContentsData {
explicit TabContentsData(TabContentsWrapper* a_contents)
@@ -612,23 +615,24 @@ class TabStripModel : public content::NotificationObserver {
SetGroup(NULL);
}
- // Create a relationship between this TabContents and other TabContentses.
- // Used to identify which TabContents to select next after one is closed.
+ // Create a relationship between this TabContentsWrapper and other
+ // TabContentsWrappers. Used to identify which TabContentsWrapper to select
+ // next after one is closed.
void SetGroup(content::NavigationController* a_group) {
group = a_group;
opener = a_group;
}
- // Forget the opener relationship so that when this TabContents is closed
- // unpredictable re-selection does not occur.
+ // Forget the opener relationship so that when this TabContentsWrapper is
+ // closed unpredictable re-selection does not occur.
void ForgetOpener() {
opener = NULL;
}
TabContentsWrapper* contents;
// We use NavigationControllers here since they more closely model the
- // "identity" of a Tab, TabContents can change depending on the URL loaded
- // in the Tab.
+ // "identity" of a Tab, TabContentsWrappers can change depending on the URL
+ // loaded in the Tab.
// The group is used to model a set of tabs spawned from a single parent
// tab. This value is preserved for a given tab as long as the tab remains
// navigated to the link it was initially opened at or some navigation from
@@ -660,7 +664,7 @@ class TabStripModel : public content::NotificationObserver {
bool discarded;
};
- // The TabContents data currently hosted within this TabStripModel.
+ // The TabContentsWrapper data currently hosted within this TabStripModel.
typedef std::vector<TabContentsData*> TabContentsDataVector;
TabContentsDataVector contents_data_;
« no previous file with comments | « no previous file | chrome/browser/tabs/tab_strip_model_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698