| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_TABS_TAB_STRIP_MODEL_H_ | 5 #ifndef CHROME_BROWSER_TABS_TAB_STRIP_MODEL_H_ |
| 6 #define CHROME_BROWSER_TABS_TAB_STRIP_MODEL_H_ | 6 #define CHROME_BROWSER_TABS_TAB_STRIP_MODEL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
| 12 #include "chrome/browser/tabs/tab_strip_model_observer.h" | 12 #include "chrome/browser/tabs/tab_strip_model_observer.h" |
| 13 #include "chrome/common/notification_observer.h" | 13 #include "chrome/common/notification_observer.h" |
| 14 #include "chrome/common/notification_registrar.h" | 14 #include "chrome/common/notification_registrar.h" |
| 15 #include "chrome/common/page_transition_types.h" | 15 #include "chrome/common/page_transition_types.h" |
| 16 | 16 |
| 17 class NavigationController; | 17 class NavigationController; |
| 18 class Profile; | 18 class Profile; |
| 19 class TabContents; | 19 class TabContents; |
| 20 class TabContentsWrapper; |
| 20 class TabStripModelDelegate; | 21 class TabStripModelDelegate; |
| 21 class TabStripModelOrderController; | 22 class TabStripModelOrderController; |
| 22 | 23 |
| 23 //////////////////////////////////////////////////////////////////////////////// | 24 //////////////////////////////////////////////////////////////////////////////// |
| 24 // | 25 // |
| 25 // TabStripModel | 26 // TabStripModel |
| 26 // | 27 // |
| 27 // A model & low level controller of a Browser Window tabstrip. Holds a vector | 28 // A model & low level controller of a Browser Window tabstrip. Holds a vector |
| 28 // of TabContents, and provides an API for adding, removing and shuffling | 29 // of TabContents, and provides an API for adding, removing and shuffling |
| 29 // them, as well as a higher level API for doing specific Browser-related | 30 // them, as well as a higher level API for doing specific Browser-related |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 // for debugging. | 153 // for debugging. |
| 153 bool HasObserver(TabStripModelObserver* observer); | 154 bool HasObserver(TabStripModelObserver* observer); |
| 154 | 155 |
| 155 // Basic API ///////////////////////////////////////////////////////////////// | 156 // Basic API ///////////////////////////////////////////////////////////////// |
| 156 | 157 |
| 157 // Determines if the specified index is contained within the TabStripModel. | 158 // Determines if the specified index is contained within the TabStripModel. |
| 158 bool ContainsIndex(int index) const; | 159 bool ContainsIndex(int index) const; |
| 159 | 160 |
| 160 // Adds the specified TabContents in the default location. Tabs opened in the | 161 // Adds the specified TabContents in the default location. Tabs opened in the |
| 161 // foreground inherit the group of the previously selected tab. | 162 // foreground inherit the group of the previously selected tab. |
| 162 void AppendTabContents(TabContents* contents, bool foreground); | 163 void AppendTabContents(TabContentsWrapper* contents, bool foreground); |
| 163 | 164 |
| 164 // Adds the specified TabContents at the specified location. |add_types| is a | 165 // Adds the specified TabContents at the specified location. |add_types| is a |
| 165 // bitmask of AddTypes; see it for details. | 166 // bitmask of AddTypes; see it for details. |
| 166 // | 167 // |
| 167 // All append/insert methods end up in this method. | 168 // All append/insert methods end up in this method. |
| 168 // | 169 // |
| 169 // NOTE: adding a tab using this method does NOT query the order controller, | 170 // NOTE: adding a tab using this method does NOT query the order controller, |
| 170 // as such the ADD_FORCE_INDEX AddType is meaningless here. The only time the | 171 // as such the ADD_FORCE_INDEX AddType is meaningless here. The only time the |
| 171 // |index| is changed is if using the index would result in breaking the | 172 // |index| is changed is if using the index would result in breaking the |
| 172 // constraint that all mini-tabs occur before non-mini-tabs. | 173 // constraint that all mini-tabs occur before non-mini-tabs. |
| 173 // See also AddTabContents. | 174 // See also AddTabContents. |
| 174 void InsertTabContentsAt(int index, | 175 void InsertTabContentsAt(int index, |
| 175 TabContents* contents, | 176 TabContentsWrapper* contents, |
| 176 int add_types); | 177 int add_types); |
| 177 | 178 |
| 178 // Closes the TabContents at the specified index. This causes the TabContents | 179 // Closes the TabContents at the specified index. This causes the TabContents |
| 179 // to be destroyed, but it may not happen immediately (e.g. if it's a | 180 // to be destroyed, but it may not happen immediately (e.g. if it's a |
| 180 // TabContents). |close_types| is a bitmask of CloseTypes. | 181 // TabContents). |close_types| is a bitmask of CloseTypes. |
| 181 // Returns true if the TabContents was closed immediately, false if it was not | 182 // Returns true if the TabContents was closed immediately, false if it was not |
| 182 // closed (we may be waiting for a response from an onunload handler, or | 183 // closed (we may be waiting for a response from an onunload handler, or |
| 183 // waiting for the user to confirm closure). | 184 // waiting for the user to confirm closure). |
| 184 bool CloseTabContentsAt(int index, uint32 close_types); | 185 bool CloseTabContentsAt(int index, uint32 close_types); |
| 185 | 186 |
| 186 // Replaces the entire state of a the tab at index by switching in a | 187 // Replaces the entire state of a the tab at index by switching in a |
| 187 // different NavigationController. This is used through the recently | 188 // different NavigationController. This is used through the recently |
| 188 // closed tabs list, which needs to replace a tab's current state | 189 // closed tabs list, which needs to replace a tab's current state |
| 189 // and history with another set of contents and history. | 190 // and history with another set of contents and history. |
| 190 // | 191 // |
| 191 // The old NavigationController is deallocated and this object takes | 192 // The old NavigationController is deallocated and this object takes |
| 192 // ownership of the passed in controller. | 193 // ownership of the passed in controller. |
| 194 // XXXPINK This API is weird and wrong. Remove it or change it or rename it? |
| 193 void ReplaceNavigationControllerAt(int index, | 195 void ReplaceNavigationControllerAt(int index, |
| 194 NavigationController* controller); | 196 TabContentsWrapper* contents); |
| 195 | 197 |
| 196 // Replaces the tab contents at |index| with |new_contents|. This deletes the | 198 // Replaces the tab contents at |index| with |new_contents|. This deletes the |
| 197 // TabContents currently at |index|. | 199 // TabContents currently at |index|. |
| 198 void ReplaceTabContentsAt(int index, TabContents* new_contents); | 200 void ReplaceTabContentsAt(int index, TabContentsWrapper* new_contents); |
| 199 | 201 |
| 200 // Detaches the TabContents at the specified index from this strip. The | 202 // Detaches the TabContents at the specified index from this strip. The |
| 201 // TabContents is not destroyed, just removed from display. The caller is | 203 // TabContents is not destroyed, just removed from display. The caller is |
| 202 // responsible for doing something with it (e.g. stuffing it into another | 204 // responsible for doing something with it (e.g. stuffing it into another |
| 203 // strip). | 205 // strip). |
| 204 TabContents* DetachTabContentsAt(int index); | 206 TabContentsWrapper* DetachTabContentsAt(int index); |
| 205 | 207 |
| 206 // Select the TabContents at the specified index. |user_gesture| is true if | 208 // Select the TabContents at the specified index. |user_gesture| is true if |
| 207 // the user actually clicked on the tab or navigated to it using a keyboard | 209 // the user actually clicked on the tab or navigated to it using a keyboard |
| 208 // command, false if the tab was selected as a by-product of some other | 210 // command, false if the tab was selected as a by-product of some other |
| 209 // action. | 211 // action. |
| 210 void SelectTabContentsAt(int index, bool user_gesture); | 212 void SelectTabContentsAt(int index, bool user_gesture); |
| 211 | 213 |
| 212 // Move the TabContents at the specified index to another index. This method | 214 // Move the TabContents at the specified index to another index. This method |
| 213 // does NOT send Detached/Attached notifications, rather it moves the | 215 // does NOT send Detached/Attached notifications, rather it moves the |
| 214 // TabContents inline and sends a Moved notification instead. | 216 // TabContents inline and sends a Moved notification instead. |
| 215 // If |select_after_move| is false, whatever tab was selected before the move | 217 // If |select_after_move| is false, whatever tab was selected before the move |
| 216 // will still be selected, but it's index may have incremented or decremented | 218 // will still be selected, but it's index may have incremented or decremented |
| 217 // one slot. | 219 // one slot. |
| 218 // NOTE: this does nothing if the move would result in app tabs and non-app | 220 // NOTE: this does nothing if the move would result in app tabs and non-app |
| 219 // tabs mixing. | 221 // tabs mixing. |
| 220 void MoveTabContentsAt(int index, int to_position, bool select_after_move); | 222 void MoveTabContentsAt(int index, int to_position, bool select_after_move); |
| 221 | 223 |
| 222 // Returns the currently selected TabContents, or NULL if there is none. | 224 // Returns the currently selected TabContents, or NULL if there is none. |
| 223 TabContents* GetSelectedTabContents() const; | 225 TabContentsWrapper* GetSelectedTabContents() const; |
| 224 | 226 |
| 225 // Returns the TabContents at the specified index, or NULL if there is none. | 227 // Returns the TabContentsWrapper at the specified index, or NULL if there is |
| 226 TabContents* GetTabContentsAt(int index) const; | 228 // none. |
| 229 TabContentsWrapper* GetTabContentsAt(int index) const; |
| 227 | 230 |
| 228 // Returns the index of the specified TabContents, or TabContents::kNoTab if | 231 // Returns the index of the specified TabContents wrapper, or |
| 229 // the TabContents is not in this TabStripModel. | 232 // TabStripModel::kNoTab if the TabContents is not in this TabStripModel. |
| 230 int GetIndexOfTabContents(const TabContents* contents) const; | 233 int GetIndexOfTabContents(const TabContentsWrapper* contents) const; |
| 231 | 234 |
| 232 // Returns the index of the specified NavigationController, or -1 if it is | 235 // Returns the index of the specified TabContents wrapper given its raw |
| 236 // TabContents, or TabStripModel::kNoTab if the TabContents is not in this |
| 237 // TabStripModel. Note: This is only needed in rare cases where the wrapper |
| 238 // is not already present (such as implementing TabContentsDelegate methods, |
| 239 // which don't know about the wrapper. Returns NULL if |contents| is not |
| 240 // associated with any wrapper in the model. |
| 241 int GetWrapperIndex(const TabContents* contents) const; |
| 242 |
| 243 // Returns the index of the specified NavigationController, or kNoTab if it is |
| 233 // not in this TabStripModel. | 244 // not in this TabStripModel. |
| 234 int GetIndexOfController(const NavigationController* controller) const; | 245 int GetIndexOfController(const NavigationController* controller) const; |
| 235 | 246 |
| 236 // Notify any observers that the TabContents at the specified index has | 247 // Notify any observers that the TabContents at the specified index has |
| 237 // changed in some way. See TabChangeType for details of |change_type|. | 248 // changed in some way. See TabChangeType for details of |change_type|. |
| 238 void UpdateTabContentsStateAt( | 249 void UpdateTabContentsStateAt( |
| 239 int index, | 250 int index, |
| 240 TabStripModelObserver::TabChangeType change_type); | 251 TabStripModelObserver::TabChangeType change_type); |
| 241 | 252 |
| 242 // Make sure there is an auto-generated New Tab tab in the TabStripModel. | 253 // Make sure there is an auto-generated New Tab tab in the TabStripModel. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 271 | 282 |
| 272 // Returns the index of the last TabContents in the model opened by the | 283 // Returns the index of the last TabContents in the model opened by the |
| 273 // specified opener, starting at |start_index|. | 284 // specified opener, starting at |start_index|. |
| 274 int GetIndexOfLastTabContentsOpenedBy(const NavigationController* opener, | 285 int GetIndexOfLastTabContentsOpenedBy(const NavigationController* opener, |
| 275 int start_index) const; | 286 int start_index) const; |
| 276 | 287 |
| 277 // Called by the Browser when a navigation is about to occur in the specified | 288 // Called by the Browser when a navigation is about to occur in the specified |
| 278 // TabContents. Depending on the tab, and the transition type of the | 289 // TabContents. Depending on the tab, and the transition type of the |
| 279 // navigation, the TabStripModel may adjust its selection and grouping | 290 // navigation, the TabStripModel may adjust its selection and grouping |
| 280 // behavior. | 291 // behavior. |
| 281 void TabNavigating(TabContents* contents, PageTransition::Type transition); | 292 void TabNavigating(TabContentsWrapper* contents, |
| 293 PageTransition::Type transition); |
| 282 | 294 |
| 283 // Forget all Opener relationships that are stored (but _not_ group | 295 // Forget all Opener relationships that are stored (but _not_ group |
| 284 // relationships!) This is to reduce unpredictable tab switching behavior | 296 // relationships!) This is to reduce unpredictable tab switching behavior |
| 285 // in complex session states. The exact circumstances under which this method | 297 // in complex session states. The exact circumstances under which this method |
| 286 // is called are left up to the implementation of the selected | 298 // is called are left up to the implementation of the selected |
| 287 // TabStripModelOrderController. | 299 // TabStripModelOrderController. |
| 288 void ForgetAllOpeners(); | 300 void ForgetAllOpeners(); |
| 289 | 301 |
| 290 // Forgets the group affiliation of the specified TabContents. This should be | 302 // Forgets the group affiliation of the specified TabContents. This should be |
| 291 // called when a TabContents that is part of a logical group of tabs is | 303 // called when a TabContents that is part of a logical group of tabs is |
| 292 // moved to a new logical context by the user (e.g. by typing a new URL or | 304 // moved to a new logical context by the user (e.g. by typing a new URL or |
| 293 // selecting a bookmark). This also forgets the opener, which is considered | 305 // selecting a bookmark). This also forgets the opener, which is considered |
| 294 // a weaker relationship than group. | 306 // a weaker relationship than group. |
| 295 void ForgetGroup(TabContents* contents); | 307 void ForgetGroup(TabContentsWrapper* contents); |
| 296 | 308 |
| 297 // Returns true if the group/opener relationships present for |contents| | 309 // Returns true if the group/opener relationships present for |contents| |
| 298 // should be reset when _any_ selection change occurs in the model. | 310 // should be reset when _any_ selection change occurs in the model. |
| 299 bool ShouldResetGroupOnSelect(TabContents* contents) const; | 311 bool ShouldResetGroupOnSelect(TabContentsWrapper* contents) const; |
| 300 | 312 |
| 301 // Changes the blocked state of the tab at |index|. | 313 // Changes the blocked state of the tab at |index|. |
| 302 void SetTabBlocked(int index, bool blocked); | 314 void SetTabBlocked(int index, bool blocked); |
| 303 | 315 |
| 304 // Changes the pinned state of the tab at |index|. See description above | 316 // Changes the pinned state of the tab at |index|. See description above |
| 305 // class for details on this. | 317 // class for details on this. |
| 306 void SetTabPinned(int index, bool pinned); | 318 void SetTabPinned(int index, bool pinned); |
| 307 | 319 |
| 308 // Returns true if the tab at |index| is pinned. | 320 // Returns true if the tab at |index| is pinned. |
| 309 // See description above class for details on pinned tabs. | 321 // See description above class for details on pinned tabs. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 331 // 0 and IndexOfFirstNonMiniTab. If |mini_tab| is false, the returned index | 343 // 0 and IndexOfFirstNonMiniTab. If |mini_tab| is false, the returned index |
| 332 // is between IndexOfFirstNonMiniTab and count(). | 344 // is between IndexOfFirstNonMiniTab and count(). |
| 333 int ConstrainInsertionIndex(int index, bool mini_tab); | 345 int ConstrainInsertionIndex(int index, bool mini_tab); |
| 334 | 346 |
| 335 // Command level API ///////////////////////////////////////////////////////// | 347 // Command level API ///////////////////////////////////////////////////////// |
| 336 | 348 |
| 337 // Adds a TabContents at the best position in the TabStripModel given the | 349 // Adds a TabContents at the best position in the TabStripModel given the |
| 338 // specified insertion index, transition, etc. |add_types| is a bitmask of | 350 // specified insertion index, transition, etc. |add_types| is a bitmask of |
| 339 // AddTypes; see it for details. This method ends up calling into | 351 // AddTypes; see it for details. This method ends up calling into |
| 340 // InsertTabContentsAt to do the actual inertion. | 352 // InsertTabContentsAt to do the actual inertion. |
| 341 void AddTabContents(TabContents* contents, | 353 void AddTabContents(TabContentsWrapper* contents, |
| 342 int index, | 354 int index, |
| 343 PageTransition::Type transition, | 355 PageTransition::Type transition, |
| 344 int add_types); | 356 int add_types); |
| 345 | 357 |
| 346 // Closes the selected TabContents. | 358 // Closes the selected TabContents. |
| 347 void CloseSelectedTab(); | 359 void CloseSelectedTab(); |
| 348 | 360 |
| 349 // Select adjacent tabs | 361 // Select adjacent tabs |
| 350 void SelectNextTab(); | 362 void SelectNextTab(); |
| 351 void SelectPreviousTab(); | 363 void SelectPreviousTab(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 | 413 |
| 402 private: | 414 private: |
| 403 // We cannot be constructed without a delegate. | 415 // We cannot be constructed without a delegate. |
| 404 TabStripModel(); | 416 TabStripModel(); |
| 405 | 417 |
| 406 // Returns true if the specified TabContents is a New Tab at the end of the | 418 // Returns true if the specified TabContents is a New Tab at the end of the |
| 407 // TabStrip. We check for this because opener relationships are _not_ | 419 // TabStrip. We check for this because opener relationships are _not_ |
| 408 // forgotten for the New Tab page opened as a result of a New Tab gesture | 420 // forgotten for the New Tab page opened as a result of a New Tab gesture |
| 409 // (e.g. Ctrl+T, etc) since the user may open a tab transiently to look up | 421 // (e.g. Ctrl+T, etc) since the user may open a tab transiently to look up |
| 410 // something related to their current activity. | 422 // something related to their current activity. |
| 411 bool IsNewTabAtEndOfTabStrip(TabContents* contents) const; | 423 bool IsNewTabAtEndOfTabStrip(TabContentsWrapper* contents) const; |
| 412 | 424 |
| 413 // Closes the TabContents at the specified indices. This causes the | 425 // Closes the TabContents at the specified indices. This causes the |
| 414 // TabContents to be destroyed, but it may not happen immediately. If the | 426 // TabContents to be destroyed, but it may not happen immediately. If the |
| 415 // page in question has an unload event the TabContents will not be destroyed | 427 // page in question has an unload event the TabContents will not be destroyed |
| 416 // until after the event has completed, which will then call back into this | 428 // until after the event has completed, which will then call back into this |
| 417 // method. | 429 // method. |
| 418 // | 430 // |
| 419 // Returns true if the TabContents were closed immediately, false if we are | 431 // Returns true if the TabContents were closed immediately, false if we are |
| 420 // waiting for the result of an onunload handler. | 432 // waiting for the result of an onunload handler. |
| 421 bool InternalCloseTabs(const std::vector<int>& indices, uint32 close_types); | 433 bool InternalCloseTabs(const std::vector<int>& indices, uint32 close_types); |
| 422 | 434 |
| 423 // Invoked from InternalCloseTabs and when an extension is removed for an app | 435 // Invoked from InternalCloseTabs and when an extension is removed for an app |
| 424 // tab. Notifies observers of TabClosingAt and deletes |contents|. If | 436 // tab. Notifies observers of TabClosingAt and deletes |contents|. If |
| 425 // |create_historical_tabs| is true, CreateHistoricalTab is invoked on the | 437 // |create_historical_tabs| is true, CreateHistoricalTab is invoked on the |
| 426 // delegate. | 438 // delegate. |
| 427 // | 439 // |
| 428 // The boolean parameter create_historical_tab controls whether to | 440 // The boolean parameter create_historical_tab controls whether to |
| 429 // record these tabs and their history for reopening recently closed | 441 // record these tabs and their history for reopening recently closed |
| 430 // tabs. | 442 // tabs. |
| 431 void InternalCloseTab(TabContents* contents, | 443 void InternalCloseTab(TabContentsWrapper* contents, |
| 432 int index, | 444 int index, |
| 433 bool create_historical_tabs); | 445 bool create_historical_tabs); |
| 434 | 446 |
| 435 TabContents* GetContentsAt(int index) const; | 447 TabContentsWrapper* GetContentsAt(int index) const; |
| 436 | 448 |
| 437 // The actual implementation of SelectTabContentsAt. Takes the previously | 449 // The actual implementation of SelectTabContentsAt. Takes the previously |
| 438 // selected contents in |old_contents|, which may actually not be in | 450 // selected contents in |old_contents|, which may actually not be in |
| 439 // |contents_| anymore because it may have been removed by a call to say | 451 // |contents_| anymore because it may have been removed by a call to say |
| 440 // DetachTabContentsAt... | 452 // DetachTabContentsAt... |
| 441 void ChangeSelectedContentsFrom( | 453 void ChangeSelectedContentsFrom( |
| 442 TabContents* old_contents, int to_index, bool user_gesture); | 454 TabContentsWrapper* old_contents, int to_index, bool user_gesture); |
| 443 | 455 |
| 444 // Returns the number of New Tab tabs in the TabStripModel. | 456 // Returns the number of New Tab tabs in the TabStripModel. |
| 445 int GetNewTabCount() const; | 457 int GetNewTabCount() const; |
| 446 | 458 |
| 447 // Selects either the next tab (|foward| is true), or the previous tab | 459 // Selects either the next tab (|foward| is true), or the previous tab |
| 448 // (|forward| is false). | 460 // (|forward| is false). |
| 449 void SelectRelativeTab(bool forward); | 461 void SelectRelativeTab(bool forward); |
| 450 | 462 |
| 451 // Does the work of MoveTabContentsAt. This has no checks to make sure the | 463 // Does the work of MoveTabContentsAt. This has no checks to make sure the |
| 452 // position is valid, those are done in MoveTabContentsAt. | 464 // position is valid, those are done in MoveTabContentsAt. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 463 bool use_group); | 475 bool use_group); |
| 464 | 476 |
| 465 // Our delegate. | 477 // Our delegate. |
| 466 TabStripModelDelegate* delegate_; | 478 TabStripModelDelegate* delegate_; |
| 467 | 479 |
| 468 // A hunk of data representing a TabContents and (optionally) the | 480 // A hunk of data representing a TabContents and (optionally) the |
| 469 // NavigationController that spawned it. This memory only sticks around while | 481 // NavigationController that spawned it. This memory only sticks around while |
| 470 // the TabContents is in the current TabStripModel, unless otherwise | 482 // the TabContents is in the current TabStripModel, unless otherwise |
| 471 // specified in code. | 483 // specified in code. |
| 472 struct TabContentsData { | 484 struct TabContentsData { |
| 473 explicit TabContentsData(TabContents* a_contents) | 485 explicit TabContentsData(TabContentsWrapper* a_contents) |
| 474 : contents(a_contents), | 486 : contents(a_contents), |
| 475 reset_group_on_select(false), | 487 reset_group_on_select(false), |
| 476 pinned(false), | 488 pinned(false), |
| 477 blocked(false) { | 489 blocked(false) { |
| 478 SetGroup(NULL); | 490 SetGroup(NULL); |
| 479 } | 491 } |
| 480 | 492 |
| 481 // Create a relationship between this TabContents and other TabContentses. | 493 // Create a relationship between this TabContents and other TabContentses. |
| 482 // Used to identify which TabContents to select next after one is closed. | 494 // Used to identify which TabContents to select next after one is closed. |
| 483 void SetGroup(NavigationController* a_group) { | 495 void SetGroup(NavigationController* a_group) { |
| 484 group = a_group; | 496 group = a_group; |
| 485 opener = a_group; | 497 opener = a_group; |
| 486 } | 498 } |
| 487 | 499 |
| 488 // Forget the opener relationship so that when this TabContents is closed | 500 // Forget the opener relationship so that when this TabContents is closed |
| 489 // unpredictable re-selection does not occur. | 501 // unpredictable re-selection does not occur. |
| 490 void ForgetOpener() { | 502 void ForgetOpener() { |
| 491 opener = NULL; | 503 opener = NULL; |
| 492 } | 504 } |
| 493 | 505 |
| 494 TabContents* contents; | 506 TabContentsWrapper* contents; |
| 495 // We use NavigationControllers here since they more closely model the | 507 // We use NavigationControllers here since they more closely model the |
| 496 // "identity" of a Tab, TabContents can change depending on the URL loaded | 508 // "identity" of a Tab, TabContents can change depending on the URL loaded |
| 497 // in the Tab. | 509 // in the Tab. |
| 498 // The group is used to model a set of tabs spawned from a single parent | 510 // The group is used to model a set of tabs spawned from a single parent |
| 499 // tab. This value is preserved for a given tab as long as the tab remains | 511 // tab. This value is preserved for a given tab as long as the tab remains |
| 500 // navigated to the link it was initially opened at or some navigation from | 512 // navigated to the link it was initially opened at or some navigation from |
| 501 // that page (i.e. if the user types or visits a bookmark or some other | 513 // that page (i.e. if the user types or visits a bookmark or some other |
| 502 // navigation within that tab, the group relationship is lost). This | 514 // navigation within that tab, the group relationship is lost). This |
| 503 // property can safely be used to implement features that depend on a | 515 // property can safely be used to implement features that depend on a |
| 504 // logical group of related tabs. | 516 // logical group of related tabs. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 typedef ObserverList<TabStripModelObserver> TabStripModelObservers; | 556 typedef ObserverList<TabStripModelObserver> TabStripModelObservers; |
| 545 TabStripModelObservers observers_; | 557 TabStripModelObservers observers_; |
| 546 | 558 |
| 547 // A scoped container for notification registries. | 559 // A scoped container for notification registries. |
| 548 NotificationRegistrar registrar_; | 560 NotificationRegistrar registrar_; |
| 549 | 561 |
| 550 DISALLOW_COPY_AND_ASSIGN(TabStripModel); | 562 DISALLOW_COPY_AND_ASSIGN(TabStripModel); |
| 551 }; | 563 }; |
| 552 | 564 |
| 553 #endif // CHROME_BROWSER_TABS_TAB_STRIP_MODEL_H_ | 565 #endif // CHROME_BROWSER_TABS_TAB_STRIP_MODEL_H_ |
| OLD | NEW |