| OLD | NEW |
| 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 "url/gurl.h" | 13 #include "url/gurl.h" |
| 14 | 14 |
| 15 // The loading/waiting state of the tab. | 15 // The loading/waiting state of the tab. |
| 16 enum TabLoadingState { | 16 enum TabLoadingState { |
| 17 kTabDone, | 17 kTabDone, |
| 18 kTabLoading, | 18 kTabLoading, |
| 19 kTabWaiting, | 19 kTabWaiting, |
| 20 kTabCrashed, | 20 kTabCrashed, |
| 21 }; | 21 }; |
| 22 | 22 |
| 23 @class MediaIndicatorView; | 23 @class MediaIndicatorButton; |
| 24 @class MenuController; | 24 @class MenuController; |
| 25 namespace TabControllerInternal { | 25 namespace TabControllerInternal { |
| 26 class MenuDelegate; | 26 class MenuDelegate; |
| 27 } | 27 } |
| 28 @class SpriteView; | 28 @class SpriteView; |
| 29 @class TabView; | 29 @class TabView; |
| 30 @protocol TabControllerTarget; | 30 @protocol TabControllerTarget; |
| 31 | 31 |
| 32 // A class that manages a single tab in the tab strip. Set its target/action | 32 // A class that manages a single tab in the tab strip. Set its target/action |
| 33 // to be sent a message when the tab is selected by the user clicking. Setting | 33 // to be sent a message when the tab is selected by the user clicking. Setting |
| 34 // the |loading| property to YES visually indicates that this tab is currently | 34 // the |loading| property to YES visually indicates that this tab is currently |
| 35 // loading content via a spinner. | 35 // loading content via a spinner. |
| 36 // | 36 // |
| 37 // The tab has the notion of an "icon view" which can be used to display | 37 // The tab has the notion of an "icon view" which can be used to display |
| 38 // identifying characteristics such as a favicon, or since it's a full-fledged | 38 // identifying characteristics such as a favicon, or since it's a full-fledged |
| 39 // view, something with state and animation such as a throbber for illustrating | 39 // view, something with state and animation such as a throbber for illustrating |
| 40 // progress. The default in the nib is an image view so nothing special is | 40 // progress. The default in the nib is an image view so nothing special is |
| 41 // required if that's all you need. | 41 // required if that's all you need. |
| 42 | 42 |
| 43 @interface TabController : NSViewController<TabDraggingEventTarget> { | 43 @interface TabController : NSViewController<TabDraggingEventTarget> { |
| 44 @private | 44 @private |
| 45 base::scoped_nsobject<SpriteView> iconView_; | 45 base::scoped_nsobject<SpriteView> iconView_; |
| 46 base::scoped_nsobject<MediaIndicatorView> mediaIndicatorView_; | 46 base::scoped_nsobject<MediaIndicatorButton> mediaIndicatorButton_; |
| 47 base::scoped_nsobject<HoverCloseButton> closeButton_; | 47 base::scoped_nsobject<HoverCloseButton> closeButton_; |
| 48 | 48 |
| 49 NSRect originalIconFrame_; // frame of iconView_ as loaded from nib | 49 NSRect originalIconFrame_; // frame of iconView_ as loaded from nib |
| 50 BOOL isIconShowing_; // last state of iconView_ in updateVisibility | 50 BOOL isIconShowing_; // last state of iconView_ in updateVisibility |
| 51 | 51 |
| 52 BOOL app_; | 52 BOOL app_; |
| 53 BOOL mini_; | 53 BOOL mini_; |
| 54 BOOL pinned_; | 54 BOOL pinned_; |
| 55 BOOL active_; | 55 BOOL active_; |
| 56 BOOL selected_; | 56 BOOL selected_; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 71 @property(assign, nonatomic) BOOL pinned; | 71 @property(assign, nonatomic) BOOL pinned; |
| 72 @property(assign, nonatomic) NSString* toolTip; | 72 @property(assign, nonatomic) NSString* toolTip; |
| 73 // Note that |-selected| will return YES if the controller is |-active|, too. | 73 // Note that |-selected| will return YES if the controller is |-active|, too. |
| 74 // |-setSelected:| affects the selection, while |-setActive:| affects the key | 74 // |-setSelected:| affects the selection, while |-setActive:| affects the key |
| 75 // status/focus of the content. | 75 // status/focus of the content. |
| 76 @property(assign, nonatomic) BOOL active; | 76 @property(assign, nonatomic) BOOL active; |
| 77 @property(assign, nonatomic) BOOL selected; | 77 @property(assign, nonatomic) BOOL selected; |
| 78 @property(assign, nonatomic) id target; | 78 @property(assign, nonatomic) id target; |
| 79 @property(assign, nonatomic) GURL url; | 79 @property(assign, nonatomic) GURL url; |
| 80 @property(readonly, nonatomic) NSView* iconView; | 80 @property(readonly, nonatomic) NSView* iconView; |
| 81 @property(assign, nonatomic) MediaIndicatorView* mediaIndicatorView; | 81 @property(readonly, nonatomic) MediaIndicatorButton* mediaIndicatorButton; |
| 82 @property(readonly, nonatomic) HoverCloseButton* closeButton; | 82 @property(readonly, nonatomic) HoverCloseButton* closeButton; |
| 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)miniTabWidth; | 90 + (CGFloat)miniTabWidth; |
| 91 + (CGFloat)appTabWidth; | 91 + (CGFloat)appTabWidth; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 @end | 123 @end |
| 124 | 124 |
| 125 @interface TabController(TestingAPI) | 125 @interface TabController(TestingAPI) |
| 126 - (int)iconCapacity; | 126 - (int)iconCapacity; |
| 127 - (BOOL)shouldShowIcon; | 127 - (BOOL)shouldShowIcon; |
| 128 - (BOOL)shouldShowMediaIndicator; | 128 - (BOOL)shouldShowMediaIndicator; |
| 129 - (BOOL)shouldShowCloseButton; | 129 - (BOOL)shouldShowCloseButton; |
| 130 @end // TabController(TestingAPI) | 130 @end // TabController(TestingAPI) |
| 131 | 131 |
| 132 #endif // CHROME_BROWSER_UI_COCOA_TABS_TAB_CONTROLLER_H_ | 132 #endif // CHROME_BROWSER_UI_COCOA_TABS_TAB_CONTROLLER_H_ |
| OLD | NEW |