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

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

Issue 160496: Implement back/forward toolbar menus on Mac.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/cocoa/toolbar_button_cell.h ('k') | chrome/browser/cocoa/toolbar_controller.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_TOOLBAR_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_COCOA_TOOLBAR_CONTROLLER_H_
6 #define CHROME_BROWSER_COCOA_TOOLBAR_CONTROLLER_H_ 6 #define CHROME_BROWSER_COCOA_TOOLBAR_CONTROLLER_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
11 #include "base/scoped_nsobject.h" 11 #include "base/scoped_nsobject.h"
12 #import "chrome/browser/cocoa/command_observer_bridge.h" 12 #import "chrome/browser/cocoa/command_observer_bridge.h"
13 #import "chrome/browser/cocoa/bookmark_bar_controller.h" 13 #import "chrome/browser/cocoa/bookmark_bar_controller.h"
14 #import "chrome/browser/cocoa/delayedmenu_button.h"
14 #import "chrome/browser/cocoa/view_resizer.h" 15 #import "chrome/browser/cocoa/view_resizer.h"
15 #include "chrome/common/pref_member.h" 16 #include "chrome/common/pref_member.h"
16 17
17 @class AutocompleteTextField; 18 @class AutocompleteTextField;
18 @class AutocompleteTextFieldEditor; 19 @class AutocompleteTextFieldEditor;
20 @class DelayedMenuButton;
21 @class BackForwardMenuController;
22 class Browser;
19 class CommandUpdater; 23 class CommandUpdater;
20 class LocationBar; 24 class LocationBar;
21 class LocationBarViewMac; 25 class LocationBarViewMac;
22 namespace ToolbarControllerInternal { 26 namespace ToolbarControllerInternal {
23 class PrefObserverBridge; 27 class PrefObserverBridge;
24 } 28 }
25 class Profile; 29 class Profile;
26 class TabContents; 30 class TabContents;
27 class ToolbarModel; 31 class ToolbarModel;
28 class ToolbarView; 32 class ToolbarView;
29 33
30 // A controller for the toolbar in the browser window. Manages 34 // A controller for the toolbar in the browser window. Manages
31 // updating the state for location bar and back/fwd/reload/go buttons. 35 // updating the state for location bar and back/fwd/reload/go buttons.
32 // Manages the bookmark bar and it's position in the window relative to 36 // Manages the bookmark bar and it's position in the window relative to
33 // the web content view. 37 // the web content view.
34 38
35 @interface ToolbarController : 39 @interface ToolbarController :
36 NSViewController<CommandObserverProtocol, ViewResizer> { 40 NSViewController<CommandObserverProtocol, ViewResizer> {
37 @private 41 @private
38 ToolbarModel* toolbarModel_; // weak, one per window 42 ToolbarModel* toolbarModel_; // weak, one per window
39 CommandUpdater* commands_; // weak, one per window 43 CommandUpdater* commands_; // weak, one per window
40 Profile* profile_; // weak, one per window 44 Profile* profile_; // weak, one per window
45 Browser* browser_; // weak, one per window
41 scoped_ptr<CommandObserverBridge> commandObserver_; 46 scoped_ptr<CommandObserverBridge> commandObserver_;
42 scoped_ptr<LocationBarViewMac> locationBarView_; 47 scoped_ptr<LocationBarViewMac> locationBarView_;
43 scoped_nsobject<AutocompleteTextFieldEditor> autocompleteTextFieldEditor_; 48 scoped_nsobject<AutocompleteTextFieldEditor> autocompleteTextFieldEditor_;
44 scoped_nsobject<BookmarkBarController> bookmarkBarController_; 49 scoped_nsobject<BookmarkBarController> bookmarkBarController_;
45 id<ViewResizer> resizeDelegate_; // weak 50 id<ViewResizer> resizeDelegate_; // weak
46 id<BookmarkURLOpener> bookmarkBarDelegate_; // weak 51 id<BookmarkURLOpener> bookmarkBarDelegate_; // weak
52 scoped_nsobject<BackForwardMenuController> backMenuController_;
53 scoped_nsobject<BackForwardMenuController> forwardMenuController_;
47 54
48 // Used for monitoring the optional toolbar button prefs. 55 // Used for monitoring the optional toolbar button prefs.
49 scoped_ptr<ToolbarControllerInternal::PrefObserverBridge> prefObserver_; 56 scoped_ptr<ToolbarControllerInternal::PrefObserverBridge> prefObserver_;
50 BooleanPrefMember showHomeButton_; 57 BooleanPrefMember showHomeButton_;
51 BooleanPrefMember showPageOptionButtons_; 58 BooleanPrefMember showPageOptionButtons_;
52 BOOL hasToolbar_; // if NO, we only have the location bar. 59 BOOL hasToolbar_; // if NO, we only have the location bar.
53 60
54 IBOutlet NSMenu* pageMenu_; 61 IBOutlet NSMenu* pageMenu_;
55 IBOutlet NSMenu* wrenchMenu_; 62 IBOutlet NSMenu* wrenchMenu_;
56 63
57 // The ordering is important for unit tests. If new items are added or the 64 // The ordering is important for unit tests. If new items are added or the
58 // ordering is changed, make sure to update |-toolbarViews| and the 65 // ordering is changed, make sure to update |-toolbarViews| and the
59 // corresponding enum in the unit tests. 66 // corresponding enum in the unit tests.
60 IBOutlet NSButton* backButton_; 67 IBOutlet DelayedMenuButton* backButton_;
61 IBOutlet NSButton* forwardButton_; 68 IBOutlet DelayedMenuButton* forwardButton_;
62 IBOutlet NSButton* reloadButton_; 69 IBOutlet NSButton* reloadButton_;
63 IBOutlet NSButton* homeButton_; 70 IBOutlet NSButton* homeButton_;
64 IBOutlet NSButton* starButton_; 71 IBOutlet NSButton* starButton_;
65 IBOutlet NSButton* goButton_; 72 IBOutlet NSButton* goButton_;
66 IBOutlet NSButton* pageButton_; 73 IBOutlet NSButton* pageButton_;
67 IBOutlet NSButton* wrenchButton_; 74 IBOutlet NSButton* wrenchButton_;
68 IBOutlet AutocompleteTextField* locationBar_; 75 IBOutlet AutocompleteTextField* locationBar_;
69 } 76 }
70 77
71 // Initialize the toolbar and register for command updates. The profile is 78 // Initialize the toolbar and register for command updates. The profile is
72 // needed for initializing the location bar. 79 // needed for initializing the location bar. The browser is needed for
80 // initializing the back/forward menus.
73 - (id)initWithModel:(ToolbarModel*)model 81 - (id)initWithModel:(ToolbarModel*)model
74 commands:(CommandUpdater*)commands 82 commands:(CommandUpdater*)commands
75 profile:(Profile*)profile 83 profile:(Profile*)profile
84 browser:(Browser*)browser
76 resizeDelegate:(id<ViewResizer>)resizeDelegate 85 resizeDelegate:(id<ViewResizer>)resizeDelegate
77 bookmarkDelegate:(id<BookmarkURLOpener>)delegate; 86 bookmarkDelegate:(id<BookmarkURLOpener>)delegate;
78 87
79 // Get the C++ bridge object representing the location bar for this tab. 88 // Get the C++ bridge object representing the location bar for this tab.
80 - (LocationBar*)locationBar; 89 - (LocationBar*)locationBar;
81 90
82 // Called by the Window delegate so we can provide a custom field editor if 91 // Called by the Window delegate so we can provide a custom field editor if
83 // needed. 92 // needed.
84 // Note that this may be called for objects unrelated to the toolbar. 93 // Note that this may be called for objects unrelated to the toolbar.
85 // returns nil if we don't want to override the custom field editor for |obj|. 94 // returns nil if we don't want to override the custom field editor for |obj|.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 128
120 // A set of private methods used by tests, in the absence of "friends" in ObjC. 129 // A set of private methods used by tests, in the absence of "friends" in ObjC.
121 @interface ToolbarController(PrivateTestMethods) 130 @interface ToolbarController(PrivateTestMethods)
122 // Returns an array of views in the order of the outlets above. 131 // Returns an array of views in the order of the outlets above.
123 - (NSArray*)toolbarViews; 132 - (NSArray*)toolbarViews;
124 - (void)showOptionalHomeButton; 133 - (void)showOptionalHomeButton;
125 - (void)showOptionalPageWrenchButtons; 134 - (void)showOptionalPageWrenchButtons;
126 @end 135 @end
127 136
128 #endif // CHROME_BROWSER_COCOA_TOOLBAR_CONTROLLER_H_ 137 #endif // CHROME_BROWSER_COCOA_TOOLBAR_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/toolbar_button_cell.h ('k') | chrome/browser/cocoa/toolbar_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698