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

Side by Side Diff: chrome/browser/tabs/tab_strip_model.h

Issue 3105004: Adds support for showing the match preview on views. It's behind the (Closed)
Patch Set: Addressed review comments Created 10 years, 4 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 unified diff | Download patch
OLDNEW
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
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // Only the loading state changed. 47 // Only the loading state changed.
48 LOADING_ONLY, 48 LOADING_ONLY,
49 49
50 // Only the title changed and page isn't loading. 50 // Only the title changed and page isn't loading.
51 TITLE_NOT_LOADING, 51 TITLE_NOT_LOADING,
52 52
53 // Change not characterized by LOADING_ONLY or TITLE_NOT_LOADING. 53 // Change not characterized by LOADING_ONLY or TITLE_NOT_LOADING.
54 ALL 54 ALL
55 }; 55 };
56 56
57 // Enum used by ReplaceTabContentsAt.
58 // TODO(sky): TabReplaceType should be declared outside the scope of
59 // the observer. I need to put all the enums in a namespace and cleanup this
60 // file.
61 enum TabReplaceType {
62 // The replace is the result of the tab being made phantom.
63 REPLACE_MADE_PHANTOM,
64
65 // The replace is the result of the match preview being committed.
66 REPLACE_MATCH_PREVIEW
67 };
68
57 // A new TabContents was inserted into the TabStripModel at the specified 69 // A new TabContents was inserted into the TabStripModel at the specified
58 // index. |foreground| is whether or not it was opened in the foreground 70 // index. |foreground| is whether or not it was opened in the foreground
59 // (selected). 71 // (selected).
60 virtual void TabInsertedAt(TabContents* contents, 72 virtual void TabInsertedAt(TabContents* contents,
61 int index, 73 int index,
62 bool foreground); 74 bool foreground);
63 75
64 // The specified TabContents at |index| is being closed (and eventually 76 // The specified TabContents at |index| is being closed (and eventually
65 // destroyed). 77 // destroyed).
66 virtual void TabClosingAt(TabContents* contents, int index); 78 virtual void TabClosingAt(TabContents* contents, int index);
(...skipping 26 matching lines...) Expand all
93 // be an entirely different object and the old value is no longer available 105 // be an entirely different object and the old value is no longer available
94 // by the time this message is delivered. 106 // by the time this message is delivered.
95 // 107 //
96 // See TabChangeType for a description of |change_type|. 108 // See TabChangeType for a description of |change_type|.
97 virtual void TabChangedAt(TabContents* contents, int index, 109 virtual void TabChangedAt(TabContents* contents, int index,
98 TabChangeType change_type); 110 TabChangeType change_type);
99 111
100 // The tab contents was replaced at the specified index. This is invoked when 112 // The tab contents was replaced at the specified index. This is invoked when
101 // a tab becomes phantom. See description of phantom tabs in class description 113 // a tab becomes phantom. See description of phantom tabs in class description
102 // of TabStripModel for details. 114 // of TabStripModel for details.
115 // TODO(sky): nuke this in favor of the 4 arg variant.
103 virtual void TabReplacedAt(TabContents* old_contents, 116 virtual void TabReplacedAt(TabContents* old_contents,
104 TabContents* new_contents, int index); 117 TabContents* new_contents,
118 int index);
119
120 // The tab contents was replaced at the specified index. |type| describes
121 // the type of replace.
122 // This invokes TabReplacedAt with three args.
123 virtual void TabReplacedAt(TabContents* old_contents,
124 TabContents* new_contents,
125 int index,
126 TabReplaceType type);
105 127
106 // Invoked when the pinned state of a tab changes. This is not invoked if the 128 // Invoked when the pinned state of a tab changes. This is not invoked if the
107 // tab ends up moving as a result of the mini state changing. 129 // tab ends up moving as a result of the mini state changing.
108 // See note in TabMiniStateChanged as to how this relates to 130 // See note in TabMiniStateChanged as to how this relates to
109 // TabMiniStateChanged. 131 // TabMiniStateChanged.
110 virtual void TabPinnedStateChanged(TabContents* contents, int index); 132 virtual void TabPinnedStateChanged(TabContents* contents, int index);
111 133
112 // Invoked if the mini state of a tab changes. This is not invoked if the 134 // Invoked if the mini state of a tab changes. This is not invoked if the
113 // tab ends up moving as a result of the mini state changing. 135 // tab ends up moving as a result of the mini state changing.
114 // NOTE: this is sent when the pinned state of a non-app tab changes and is 136 // NOTE: this is sent when the pinned state of a non-app tab changes and is
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 // Replaces the entire state of a the tab at index by switching in a 448 // Replaces the entire state of a the tab at index by switching in a
427 // different NavigationController. This is used through the recently 449 // different NavigationController. This is used through the recently
428 // closed tabs list, which needs to replace a tab's current state 450 // closed tabs list, which needs to replace a tab's current state
429 // and history with another set of contents and history. 451 // and history with another set of contents and history.
430 // 452 //
431 // The old NavigationController is deallocated and this object takes 453 // The old NavigationController is deallocated and this object takes
432 // ownership of the passed in controller. 454 // ownership of the passed in controller.
433 void ReplaceNavigationControllerAt(int index, 455 void ReplaceNavigationControllerAt(int index,
434 NavigationController* controller); 456 NavigationController* controller);
435 457
458 // Replaces the tab contents at |index| with |new_contents|. |type| is passed
459 // to the observer. This deletes the TabContents currently at |index|.
460 void ReplaceTabContentsAt(int index,
461 TabContents* new_contents,
462 TabStripModelObserver::TabReplaceType type);
463
436 // Detaches the TabContents at the specified index from this strip. The 464 // Detaches the TabContents at the specified index from this strip. The
437 // TabContents is not destroyed, just removed from display. The caller is 465 // TabContents is not destroyed, just removed from display. The caller is
438 // responsible for doing something with it (e.g. stuffing it into another 466 // responsible for doing something with it (e.g. stuffing it into another
439 // strip). 467 // strip).
440 TabContents* DetachTabContentsAt(int index); 468 TabContents* DetachTabContentsAt(int index);
441 469
442 // Select the TabContents at the specified index. |user_gesture| is true if 470 // Select the TabContents at the specified index. |user_gesture| is true if
443 // the user actually clicked on the tab or navigated to it using a keyboard 471 // the user actually clicked on the tab or navigated to it using a keyboard
444 // command, false if the tab was selected as a by-product of some other 472 // command, false if the tab was selected as a by-product of some other
445 // action. 473 // action.
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 bool select_after_move); 746 bool select_after_move);
719 747
720 // Returns true if the tab represented by the specified data has an opener 748 // Returns true if the tab represented by the specified data has an opener
721 // that matches the specified one. If |use_group| is true, then this will 749 // that matches the specified one. If |use_group| is true, then this will
722 // fall back to check the group relationship as well. 750 // fall back to check the group relationship as well.
723 struct TabContentsData; 751 struct TabContentsData;
724 static bool OpenerMatches(const TabContentsData* data, 752 static bool OpenerMatches(const TabContentsData* data,
725 const NavigationController* opener, 753 const NavigationController* opener,
726 bool use_group); 754 bool use_group);
727 755
756 // Does the work for ReplaceTabContentsAt returning the old TabContents.
757 // The caller owns the returned TabContents.
758 TabContents* ReplaceTabContentsAtImpl(
759 int index,
760 TabContents* new_contents,
761 TabStripModelObserver::TabReplaceType type);
762
728 // Our delegate. 763 // Our delegate.
729 TabStripModelDelegate* delegate_; 764 TabStripModelDelegate* delegate_;
730 765
731 // A hunk of data representing a TabContents and (optionally) the 766 // A hunk of data representing a TabContents and (optionally) the
732 // NavigationController that spawned it. This memory only sticks around while 767 // NavigationController that spawned it. This memory only sticks around while
733 // the TabContents is in the current TabStripModel, unless otherwise 768 // the TabContents is in the current TabStripModel, unless otherwise
734 // specified in code. 769 // specified in code.
735 struct TabContentsData { 770 struct TabContentsData {
736 explicit TabContentsData(TabContents* a_contents) 771 explicit TabContentsData(TabContents* a_contents)
737 : contents(a_contents), 772 : contents(a_contents),
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 typedef ObserverList<TabStripModelObserver> TabStripModelObservers; 842 typedef ObserverList<TabStripModelObserver> TabStripModelObservers;
808 TabStripModelObservers observers_; 843 TabStripModelObservers observers_;
809 844
810 // A scoped container for notification registries. 845 // A scoped container for notification registries.
811 NotificationRegistrar registrar_; 846 NotificationRegistrar registrar_;
812 847
813 DISALLOW_COPY_AND_ASSIGN(TabStripModel); 848 DISALLOW_COPY_AND_ASSIGN(TabStripModel);
814 }; 849 };
815 850
816 #endif // CHROME_BROWSER_TABS_TAB_STRIP_MODEL_H_ 851 #endif // CHROME_BROWSER_TABS_TAB_STRIP_MODEL_H_
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/tab_contents_delegate.cc ('k') | chrome/browser/tabs/tab_strip_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698