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

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

Issue 6362007: [Mac] Organize all tab/tab strip files into chrome/browser/ui/cocoa/tabs/.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_COCOA_TAB_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_TAB_CONTROLLER_H_
7 #pragma once
8
9 #import <Cocoa/Cocoa.h>
10 #import "chrome/browser/ui/cocoa/hover_close_button.h"
11 #include "chrome/browser/ui/tabs/tab_menu_model.h"
12
13 // The loading/waiting state of the tab.
14 enum TabLoadingState {
15 kTabDone,
16 kTabLoading,
17 kTabWaiting,
18 kTabCrashed,
19 };
20
21 @class MenuController;
22 namespace TabControllerInternal {
23 class MenuDelegate;
24 }
25 @class TabView;
26 @protocol TabControllerTarget;
27
28 // A class that manages a single tab in the tab strip. Set its target/action
29 // to be sent a message when the tab is selected by the user clicking. Setting
30 // the |loading| property to YES visually indicates that this tab is currently
31 // loading content via a spinner.
32 //
33 // The tab has the notion of an "icon view" which can be used to display
34 // identifying characteristics such as a favicon, or since it's a full-fledged
35 // view, something with state and animation such as a throbber for illustrating
36 // progress. The default in the nib is an image view so nothing special is
37 // required if that's all you need.
38
39 @interface TabController : NSViewController {
40 @private
41 IBOutlet NSView* iconView_;
42 IBOutlet NSTextField* titleView_;
43 IBOutlet HoverCloseButton* closeButton_;
44
45 NSRect originalIconFrame_; // frame of iconView_ as loaded from nib
46 BOOL isIconShowing_; // last state of iconView_ in updateVisibility
47
48 BOOL app_;
49 BOOL mini_;
50 BOOL pinned_;
51 BOOL selected_;
52 TabLoadingState loadingState_;
53 CGFloat iconTitleXOffset_; // between left edges of icon and title
54 id<TabControllerTarget> target_; // weak, where actions are sent
55 SEL action_; // selector sent when tab is selected by clicking
56 scoped_ptr<TabMenuModel> contextMenuModel_;
57 scoped_ptr<TabControllerInternal::MenuDelegate> contextMenuDelegate_;
58 scoped_nsobject<MenuController> contextMenuController_;
59 }
60
61 @property(assign, nonatomic) TabLoadingState loadingState;
62
63 @property(assign, nonatomic) SEL action;
64 @property(assign, nonatomic) BOOL app;
65 @property(assign, nonatomic) BOOL mini;
66 @property(assign, nonatomic) BOOL pinned;
67 @property(assign, nonatomic) BOOL selected;
68 @property(assign, nonatomic) id target;
69 @property(assign, nonatomic) NSView* iconView;
70 @property(assign, nonatomic) NSTextField* titleView;
71 @property(assign, nonatomic) HoverCloseButton* closeButton;
72
73 // Minimum and maximum allowable tab width. The minimum width does not show
74 // the icon or the close button. The selected tab always has at least a close
75 // button so it has a different minimum width.
76 + (CGFloat)minTabWidth;
77 + (CGFloat)maxTabWidth;
78 + (CGFloat)minSelectedTabWidth;
79 + (CGFloat)miniTabWidth;
80 + (CGFloat)appTabWidth;
81
82 // The view associated with this controller, pre-casted as a TabView
83 - (TabView*)tabView;
84
85 // Closes the associated TabView by relaying the message to |target_| to
86 // perform the close.
87 - (IBAction)closeTab:(id)sender;
88
89 // Replace the current icon view with the given view. |iconView| will be
90 // resized to the size of the current icon view.
91 - (void)setIconView:(NSView*)iconView;
92 - (NSView*)iconView;
93
94 // Called by the tabs to determine whether we are in rapid (tab) closure mode.
95 // In this mode, we handle clicks slightly differently due to animation.
96 // Ideally, tabs would know about their own animation and wouldn't need this.
97 - (BOOL)inRapidClosureMode;
98
99 // Updates the visibility of certain subviews, such as the icon and close
100 // button, based on criteria such as the tab's selected state and its current
101 // width.
102 - (void)updateVisibility;
103
104 // Update the title color to match the tabs current state.
105 - (void)updateTitleColor;
106 @end
107
108 @interface TabController(TestingAPI)
109 - (NSString*)toolTip;
110 - (int)iconCapacity;
111 - (BOOL)shouldShowIcon;
112 - (BOOL)shouldShowCloseButton;
113 @end // TabController(TestingAPI)
114
115 #endif // CHROME_BROWSER_UI_COCOA_TAB_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/side_tab_strip_view_unittest.mm ('k') | chrome/browser/ui/cocoa/tab_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698