OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 // | 507 // |
508 // The boolean parameter create_historical_tab controls whether to | 508 // The boolean parameter create_historical_tab controls whether to |
509 // record these tabs and their history for reopening recently closed | 509 // record these tabs and their history for reopening recently closed |
510 // tabs. | 510 // tabs. |
511 void InternalCloseTab(TabContentsWrapper* contents, | 511 void InternalCloseTab(TabContentsWrapper* contents, |
512 int index, | 512 int index, |
513 bool create_historical_tabs); | 513 bool create_historical_tabs); |
514 | 514 |
515 TabContentsWrapper* GetContentsAt(int index) const; | 515 TabContentsWrapper* GetContentsAt(int index) const; |
516 | 516 |
517 // If the TabContentsWrapper at |to_index| differs from |old_contents| | 517 // Notifies the observers if the active tab has changed. If |old_contents| is |
518 // notifies observers. | 518 // non-null a TabDeactivated notification is sent right before sending |
519 void NotifyTabSelectedIfChanged(TabContentsWrapper* old_contents, | 519 // ActiveTabChanged notification. |
520 int to_index, | 520 void NotifyIfActiveTabChanged(TabContentsWrapper* old_contents, |
521 bool user_gesture); | 521 bool user_gesture); |
522 | 522 |
523 // Notifies the observers the active tab changed. |old_active_index| gives | 523 // Notifies the observers if the active tab or the tab selection has changed. |
524 // the old active index. | 524 // If |old_contents| is non-null a TabDeactivated notification is sent right |
525 void NotifyActiveTabChanged(int old_active_index); | 525 // before sending ActiveTabChanged notification. |old_model| is a snapshot of |
| 526 // |selection_model_| before the change. |
| 527 // Note: This function might end up sending 0 to 3 notifications in the |
| 528 // following order: TabDeactivated, ActiveTabChanged, TabSelectionChanged. |
| 529 void NotifyIfActiveOrSelectionChanged( |
| 530 TabContentsWrapper* old_contents, |
| 531 bool user_gesture, |
| 532 const TabStripSelectionModel& old_model); |
526 | 533 |
527 // Returns the number of New Tab tabs in the TabStripModel. | 534 // Returns the number of New Tab tabs in the TabStripModel. |
528 int GetNewTabCount() const; | 535 int GetNewTabCount() const; |
529 | 536 |
530 // Selects either the next tab (|foward| is true), or the previous tab | 537 // Selects either the next tab (|foward| is true), or the previous tab |
531 // (|forward| is false). | 538 // (|forward| is false). |
532 void SelectRelativeTab(bool forward); | 539 void SelectRelativeTab(bool forward); |
533 | 540 |
534 // Does the work of MoveTabContentsAt. This has no checks to make sure the | 541 // Does the work of MoveTabContentsAt. This has no checks to make sure the |
535 // position is valid, those are done in MoveTabContentsAt. | 542 // position is valid, those are done in MoveTabContentsAt. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 | 640 |
634 // A scoped container for notification registries. | 641 // A scoped container for notification registries. |
635 NotificationRegistrar registrar_; | 642 NotificationRegistrar registrar_; |
636 | 643 |
637 TabStripSelectionModel selection_model_; | 644 TabStripSelectionModel selection_model_; |
638 | 645 |
639 DISALLOW_IMPLICIT_CONSTRUCTORS(TabStripModel); | 646 DISALLOW_IMPLICIT_CONSTRUCTORS(TabStripModel); |
640 }; | 647 }; |
641 | 648 |
642 #endif // CHROME_BROWSER_TABS_TAB_STRIP_MODEL_H_ | 649 #endif // CHROME_BROWSER_TABS_TAB_STRIP_MODEL_H_ |
OLD | NEW |