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

Side by Side Diff: chrome/browser/cocoa/bookmark_bar_controller.h

Issue 164547: Mac: make save/open dialogs operate as tab-modal sheets.... Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Painfully (but hopefully correctly) merged ToT. Created 11 years, 2 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
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_COCOA_BOOKMARK_BAR_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_COCOA_BOOKMARK_BAR_CONTROLLER_H_
6 #define CHROME_BROWSER_COCOA_BOOKMARK_BAR_CONTROLLER_H_ 6 #define CHROME_BROWSER_COCOA_BOOKMARK_BAR_CONTROLLER_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 #include <map> 9 #include <map>
10 10
11 #include "base/scoped_nsobject.h" 11 #include "base/scoped_nsobject.h"
12 #include "base/scoped_ptr.h" 12 #include "base/scoped_ptr.h"
13 #include "chrome/browser/cocoa/bookmark_bar_bridge.h" 13 #include "chrome/browser/cocoa/bookmark_bar_bridge.h"
14 #include "chrome/browser/cocoa/tab_strip_model_observer_bridge.h" 14 #include "chrome/browser/cocoa/tab_strip_model_observer_bridge.h"
15 #import "chrome/browser/cocoa/command_observer_bridge.h"
15 #include "webkit/glue/window_open_disposition.h" 16 #include "webkit/glue/window_open_disposition.h"
16 17
17 @class BackgroundGradientView; 18 @class BackgroundGradientView;
18 @class BookmarkBarStateController; 19 @class BookmarkBarStateController;
19 class BookmarkModel; 20 class BookmarkModel;
20 class BookmarkNode; 21 class BookmarkNode;
21 @class BookmarkBarView; 22 @class BookmarkBarView;
22 class Browser; 23 class Browser;
23 @protocol ToolbarCompressable; 24 @protocol ToolbarCompressable;
25 class CommandUpdater;
24 class GURL; 26 class GURL;
25 @class MenuButton; 27 @class MenuButton;
26 class Profile; 28 class Profile;
27 class PrefService; 29 class PrefService;
28 @class ToolbarController; 30 @class ToolbarController;
29 @protocol ViewResizer; 31 @protocol ViewResizer;
30 32
31 // The interface for an object which can open URLs for a bookmark. 33 // The interface for an object which can open URLs for a bookmark.
32 @protocol BookmarkURLOpener 34 @protocol BookmarkURLOpener
33 - (void)openBookmarkURL:(const GURL&)url 35 - (void)openBookmarkURL:(const GURL&)url
34 disposition:(WindowOpenDisposition)disposition; 36 disposition:(WindowOpenDisposition)disposition;
35 @end 37 @end
36 38
37 // An interface to allow mocking of a BookmarkBarController by the 39 // An interface to allow mocking of a BookmarkBarController by the
38 // BookmarkBarToolbarView. 40 // BookmarkBarToolbarView.
39 @protocol BookmarkBarFloating 41 @protocol BookmarkBarFloating
40 // Returns true if the bookmark bar should be drawn as if it's a disconnected 42 // Returns true if the bookmark bar should be drawn as if it's a disconnected
41 // bookmark bar on the New Tag Page. 43 // bookmark bar on the New Tag Page.
42 - (BOOL)drawAsFloatingBar; 44 - (BOOL)drawAsFloatingBar;
43 @end 45 @end
44 46
45 // A controller for the bookmark bar in the browser window. Handles showing 47 // A controller for the bookmark bar in the browser window. Handles showing
46 // and hiding based on the preference in the given profile. 48 // and hiding based on the preference in the given profile.
47 @interface BookmarkBarController : NSViewController<BookmarkBarFloating> { 49 @interface BookmarkBarController : NSViewController<BookmarkBarFloating,
50 CommandObserverProtocol> {
48 @private 51 @private
49 Browser* browser_; // weak; owned by its window 52 Browser* browser_; // weak; owned by its window
50 BookmarkModel* bookmarkModel_; // weak; part of the profile owned by the 53 BookmarkModel* bookmarkModel_; // weak; part of the profile owned by the
51 // top-level Browser object. 54 // top-level Browser object.
52 55
53 // Our initial view width, which is applied in awakeFromNib. 56 // Our initial view width, which is applied in awakeFromNib.
54 float initialWidth_; 57 float initialWidth_;
55 58
56 // BookmarkNodes have a 64bit id. NSMenuItems have a 32bit tag used 59 // BookmarkNodes have a 64bit id. NSMenuItems have a 32bit tag used
57 // to represent the bookmark node they refer to. This map provides 60 // to represent the bookmark node they refer to. This map provides
58 // a mapping from one to the other, so we can properly identify the 61 // a mapping from one to the other, so we can properly identify the
59 // node from the item. When adding items in, we start with seedId_. 62 // node from the item. When adding items in, we start with seedId_.
60 int32 seedId_; 63 int32 seedId_;
61 std::map<int32,int64> menuTagMap_; 64 std::map<int32,int64> menuTagMap_;
62 65
63 // Our bookmark buttons, ordered from L-->R. 66 // Our bookmark buttons, ordered from L-->R.
64 scoped_nsobject<NSMutableArray> buttons_; 67 scoped_nsobject<NSMutableArray> buttons_;
65 68
66 // The folder image so we can use one copy for all buttons 69 // The folder image so we can use one copy for all buttons
67 scoped_nsobject<NSImage> folderImage_; 70 scoped_nsobject<NSImage> folderImage_;
68 71
69 // If the bar is disabled, we hide it and ignore show/hide commands. 72 // If the bar is disabled, we hide it and ignore show/hide commands.
70 // Set when using fullscreen mode. 73 // Set when using fullscreen mode.
71 BOOL barIsEnabled_; 74 BOOL barIsEnabled_;
72 75
76 // Normally NO; YES when it should be greyed out (for tab-modal sheets).
77 BOOL barIsGreyedOut_;
78
73 // Bridge from Chrome-style C++ notifications (e.g. derived from 79 // Bridge from Chrome-style C++ notifications (e.g. derived from
74 // BookmarkModelObserver) 80 // BookmarkModelObserver)
75 scoped_ptr<BookmarkBarBridge> bridge_; 81 scoped_ptr<BookmarkBarBridge> bridge_;
76 82
77 // Delegate that is alerted about whether it should be compressed because 83 // Delegate that is alerted about whether it should be compressed because
78 // it's right next to us. 84 // it's right next to us.
79 id<ToolbarCompressable> compressDelegate_; // weak 85 id<ToolbarCompressable> compressDelegate_; // weak
80 86
87 // Allows us to observe for when to grey out the bookmark bar.
88 scoped_ptr<CommandObserverBridge> commandObserver_;
89
81 // Delegate that can resize us. 90 // Delegate that can resize us.
82 id<ViewResizer> resizeDelegate_; // weak 91 id<ViewResizer> resizeDelegate_; // weak
83 92
84 // Delegate that can open URLs for us. 93 // Delegate that can open URLs for us.
85 id<BookmarkURLOpener> urlDelegate_; // weak 94 id<BookmarkURLOpener> urlDelegate_; // weak
86 95
87 // Lets us get TabSelectedAt notifications. 96 // Lets us get TabSelectedAt notifications.
88 scoped_ptr<TabStripModelObserverBridge> tabObserver_; 97 scoped_ptr<TabStripModelObserverBridge> tabObserver_;
89 98
90 IBOutlet BookmarkBarView* buttonView_; 99 IBOutlet BookmarkBarView* buttonView_;
91 IBOutlet MenuButton* offTheSideButton_; 100 IBOutlet MenuButton* offTheSideButton_;
92 IBOutlet NSMenu* buttonContextMenu_; 101 IBOutlet NSMenu* buttonContextMenu_;
93 } 102 }
94 103
95 // Initializes the bookmark bar controller with the given browser 104 // Initializes the bookmark bar controller with the given browser
96 // profile and delegates. 105 // profile and delegates.
97 - (id)initWithBrowser:(Browser*)browser 106 - (id)initWithBrowser:(Browser*)browser
98 initialWidth:(float)initialWidth 107 initialWidth:(float)initialWidth
99 compressDelegate:(id<ToolbarCompressable>)compressDelegate 108 compressDelegate:(id<ToolbarCompressable>)compressDelegate
100 resizeDelegate:(id<ViewResizer>)resizeDelegate 109 resizeDelegate:(id<ViewResizer>)resizeDelegate
101 urlDelegate:(id<BookmarkURLOpener>)urlDelegate; 110 urlDelegate:(id<BookmarkURLOpener>)urlDelegate
111 commands:(CommandUpdater*)commands;
102 112
103 // Returns the backdrop to the bookmark bar. 113 // Returns the backdrop to the bookmark bar.
104 - (BackgroundGradientView*)backgroundGradientView; 114 - (BackgroundGradientView*)backgroundGradientView;
105 115
106 // Tell the bar to show itself if needed (e.g. if the kShowBookmarkBar 116 // Tell the bar to show itself if needed (e.g. if the kShowBookmarkBar
107 // is set). Called once after the controller is first created. 117 // is set). Called once after the controller is first created.
108 - (void)showIfNeeded; 118 - (void)showIfNeeded;
109 119
110 // Update the visible state of the bookmark bar based on the current value of 120 // Update the visible state of the bookmark bar based on the current value of
111 // -[BookmarkBarController isAlwaysVisible]. 121 // -[BookmarkBarController isAlwaysVisible].
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 - (void)frameDidChange; 192 - (void)frameDidChange;
183 - (BOOL)offTheSideButtonIsHidden; 193 - (BOOL)offTheSideButtonIsHidden;
184 - (NSMenu *)menuForFolderNode:(const BookmarkNode*)node; 194 - (NSMenu *)menuForFolderNode:(const BookmarkNode*)node;
185 - (int64)nodeIdFromMenuTag:(int32)tag; 195 - (int64)nodeIdFromMenuTag:(int32)tag;
186 - (int32)menuTagFromNodeId:(int64)menuid; 196 - (int32)menuTagFromNodeId:(int64)menuid;
187 - (void)buildOffTheSideMenu; 197 - (void)buildOffTheSideMenu;
188 - (NSMenu*)offTheSideMenu; 198 - (NSMenu*)offTheSideMenu;
189 @end 199 @end
190 200
191 #endif // CHROME_BROWSER_COCOA_BOOKMARK_BAR_CONTROLLER_H_ 201 #endif // CHROME_BROWSER_COCOA_BOOKMARK_BAR_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/bookmark_bar_bridge_unittest.mm ('k') | chrome/browser/cocoa/bookmark_bar_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698