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

Side by Side Diff: chrome/browser/ui/cocoa/tabs/tab_controller.h

Issue 1827083004: UI: Rename MediaState to AlertState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-tab-indicator
Patch Set: Keep gypi ordered Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_UI_COCOA_TABS_TAB_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_TABS_TAB_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_TABS_TAB_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_COCOA_TABS_TAB_CONTROLLER_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #import "chrome/browser/ui/cocoa/hover_close_button.h" 10 #import "chrome/browser/ui/cocoa/hover_close_button.h"
11 #import "chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.h" 11 #import "chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.h"
12 #include "chrome/browser/ui/tabs/tab_menu_model.h" 12 #include "chrome/browser/ui/tabs/tab_menu_model.h"
13 #include "chrome/browser/ui/tabs/tab_utils.h" 13 #include "chrome/browser/ui/tabs/tab_utils.h"
14 #include "url/gurl.h" 14 #include "url/gurl.h"
15 15
16 // The loading/waiting state of the tab. 16 // The loading/waiting state of the tab.
17 enum TabLoadingState { 17 enum TabLoadingState {
18 kTabDone, 18 kTabDone,
19 kTabLoading, 19 kTabLoading,
20 kTabWaiting, 20 kTabWaiting,
21 kTabCrashed, 21 kTabCrashed,
22 }; 22 };
23 23
24 @class MediaIndicatorButton; 24 @class AlertIndicatorButton;
25 @class MenuController; 25 @class MenuController;
26 namespace TabControllerInternal { 26 namespace TabControllerInternal {
27 class MenuDelegate; 27 class MenuDelegate;
28 } 28 }
29 @class SpriteView; 29 @class SpriteView;
30 @class TabView; 30 @class TabView;
31 @protocol TabControllerTarget; 31 @protocol TabControllerTarget;
32 32
33 // A class that manages a single tab in the tab strip. Set its target/action 33 // A class that manages a single tab in the tab strip. Set its target/action
34 // to be sent a message when the tab is selected by the user clicking. Setting 34 // to be sent a message when the tab is selected by the user clicking. Setting
35 // the |loading| property to YES visually indicates that this tab is currently 35 // the |loading| property to YES visually indicates that this tab is currently
36 // loading content via a spinner. 36 // loading content via a spinner.
37 // 37 //
38 // The tab has the notion of an "icon view" which can be used to display 38 // The tab has the notion of an "icon view" which can be used to display
39 // identifying characteristics such as a favicon, or since it's a full-fledged 39 // identifying characteristics such as a favicon, or since it's a full-fledged
40 // view, something with state and animation such as a throbber for illustrating 40 // view, something with state and animation such as a throbber for illustrating
41 // progress. The default in the nib is an image view so nothing special is 41 // progress. The default in the nib is an image view so nothing special is
42 // required if that's all you need. 42 // required if that's all you need.
43 43
44 @interface TabController : NSViewController<TabDraggingEventTarget> { 44 @interface TabController : NSViewController<TabDraggingEventTarget> {
45 @private 45 @private
46 base::scoped_nsobject<SpriteView> iconView_; 46 base::scoped_nsobject<SpriteView> iconView_;
47 base::scoped_nsobject<MediaIndicatorButton> mediaIndicatorButton_; 47 base::scoped_nsobject<AlertIndicatorButton> alertIndicatorButton_;
48 base::scoped_nsobject<HoverCloseButton> closeButton_; 48 base::scoped_nsobject<HoverCloseButton> closeButton_;
49 49
50 NSRect originalIconFrame_; // frame of iconView_ as loaded from nib 50 NSRect originalIconFrame_; // frame of iconView_ as loaded from nib
51 BOOL isIconShowing_; // last state of iconView_ in updateVisibility 51 BOOL isIconShowing_; // last state of iconView_ in updateVisibility
52 52
53 BOOL pinned_; 53 BOOL pinned_;
54 BOOL active_; 54 BOOL active_;
55 BOOL selected_; 55 BOOL selected_;
56 GURL url_; 56 GURL url_;
57 TabLoadingState loadingState_; 57 TabLoadingState loadingState_;
(...skipping 10 matching lines...) Expand all
68 @property(assign, nonatomic) BOOL pinned; 68 @property(assign, nonatomic) BOOL pinned;
69 @property(assign, nonatomic) NSString* toolTip; 69 @property(assign, nonatomic) NSString* toolTip;
70 // Note that |-selected| will return YES if the controller is |-active|, too. 70 // Note that |-selected| will return YES if the controller is |-active|, too.
71 // |-setSelected:| affects the selection, while |-setActive:| affects the key 71 // |-setSelected:| affects the selection, while |-setActive:| affects the key
72 // status/focus of the content. 72 // status/focus of the content.
73 @property(assign, nonatomic) BOOL active; 73 @property(assign, nonatomic) BOOL active;
74 @property(assign, nonatomic) BOOL selected; 74 @property(assign, nonatomic) BOOL selected;
75 @property(assign, nonatomic) id target; 75 @property(assign, nonatomic) id target;
76 @property(assign, nonatomic) GURL url; 76 @property(assign, nonatomic) GURL url;
77 @property(readonly, nonatomic) NSView* iconView; 77 @property(readonly, nonatomic) NSView* iconView;
78 @property(readonly, nonatomic) MediaIndicatorButton* mediaIndicatorButton; 78 @property(readonly, nonatomic) AlertIndicatorButton* alertIndicatorButton;
79 @property(readonly, nonatomic) HoverCloseButton* closeButton; 79 @property(readonly, nonatomic) HoverCloseButton* closeButton;
80 80
81 // Default height for tabs. 81 // Default height for tabs.
82 + (CGFloat)defaultTabHeight; 82 + (CGFloat)defaultTabHeight;
83 83
84 // Minimum and maximum allowable tab width. The minimum width does not show 84 // Minimum and maximum allowable tab width. The minimum width does not show
85 // the icon or the close button. The active tab always has at least a close 85 // the icon or the close button. The active tab always has at least a close
86 // button so it has a different minimum width. 86 // button so it has a different minimum width.
87 + (CGFloat)minTabWidth; 87 + (CGFloat)minTabWidth;
88 + (CGFloat)maxTabWidth; 88 + (CGFloat)maxTabWidth;
89 + (CGFloat)minActiveTabWidth; 89 + (CGFloat)minActiveTabWidth;
90 + (CGFloat)pinnedTabWidth; 90 + (CGFloat)pinnedTabWidth;
91 91
92 // The view associated with this controller, pre-casted as a TabView 92 // The view associated with this controller, pre-casted as a TabView
93 - (TabView*)tabView; 93 - (TabView*)tabView;
94 94
95 // Sets the tab's icon image. 95 // Sets the tab's icon image.
96 // |image| must be 16x16 in size. 96 // |image| must be 16x16 in size.
97 // |image| can be a horizontal strip of image sprites which will be animated. 97 // |image| can be a horizontal strip of image sprites which will be animated.
98 // Setting |animate| to YES will animate away the old image before animating 98 // Setting |animate| to YES will animate away the old image before animating
99 // the new image back to position. 99 // the new image back to position.
100 - (void)setIconImage:(NSImage*)image; 100 - (void)setIconImage:(NSImage*)image;
101 - (void)setIconImage:(NSImage*)image withToastAnimation:(BOOL)animate; 101 - (void)setIconImage:(NSImage*)image withToastAnimation:(BOOL)animate;
102 102
103 // Sets the current tab media state and updates the views. 103 // Sets the current tab alert state and updates the views.
104 - (void)setMediaState:(TabMediaState)mediaState; 104 - (void)setAlertState:(TabAlertState)alertState;
105 105
106 // Closes the associated TabView by relaying the message to |target_| to 106 // Closes the associated TabView by relaying the message to |target_| to
107 // perform the close. 107 // perform the close.
108 - (void)closeTab:(id)sender; 108 - (void)closeTab:(id)sender;
109 109
110 // Selects the associated TabView by sending |action_| to |target_|. 110 // Selects the associated TabView by sending |action_| to |target_|.
111 - (void)selectTab:(id)sender; 111 - (void)selectTab:(id)sender;
112 112
113 // Called by the tabs to determine whether we are in rapid (tab) closure mode. 113 // Called by the tabs to determine whether we are in rapid (tab) closure mode.
114 // In this mode, we handle clicks slightly differently due to animation. 114 // In this mode, we handle clicks slightly differently due to animation.
115 // Ideally, tabs would know about their own animation and wouldn't need this. 115 // Ideally, tabs would know about their own animation and wouldn't need this.
116 - (BOOL)inRapidClosureMode; 116 - (BOOL)inRapidClosureMode;
117 117
118 // Updates the visibility of certain subviews, such as the icon and close 118 // Updates the visibility of certain subviews, such as the icon and close
119 // button, based on criteria such as the tab's selected state and its current 119 // button, based on criteria such as the tab's selected state and its current
120 // width. 120 // width.
121 - (void)updateVisibility; 121 - (void)updateVisibility;
122 122
123 // Update the title color to match the tabs current state. 123 // Update the title color to match the tabs current state.
124 - (void)updateTitleColor; 124 - (void)updateTitleColor;
125 @end 125 @end
126 126
127 @interface TabController(TestingAPI) 127 @interface TabController(TestingAPI)
128 - (int)iconCapacity; 128 - (int)iconCapacity;
129 - (BOOL)shouldShowIcon; 129 - (BOOL)shouldShowIcon;
130 - (BOOL)shouldShowMediaIndicator; 130 - (BOOL)shouldShowAlertIndicator;
131 - (BOOL)shouldShowCloseButton; 131 - (BOOL)shouldShowCloseButton;
132 @end // TabController(TestingAPI) 132 @end // TabController(TestingAPI)
133 133
134 #endif // CHROME_BROWSER_UI_COCOA_TABS_TAB_CONTROLLER_H_ 134 #endif // CHROME_BROWSER_UI_COCOA_TABS_TAB_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/media_indicator_button_cocoa_unittest.mm ('k') | chrome/browser/ui/cocoa/tabs/tab_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698