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

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

Issue 155151: Hook up the prefs for the optional home buttons and page/wrench buttons. Move... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 5 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_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 #include "chrome/common/pref_member.h"
13 14
14 class CommandUpdater; 15 class CommandUpdater;
15 class LocationBar; 16 class LocationBar;
16 class LocationBarViewMac; 17 class LocationBarViewMac;
18 namespace ToolbarControllerInternal {
19 class PrefObserverBridge;
20 }
17 class Profile; 21 class Profile;
18 class TabContents; 22 class TabContents;
19 class ToolbarModel; 23 class ToolbarModel;
20 class ToolbarView; 24 class ToolbarView;
21 25
22 // Field editor used for the location bar. 26 // Field editor used for the location bar.
23 @interface LocationBarFieldEditor : NSTextView 27 @interface LocationBarFieldEditor : NSTextView
24 // Copy contents of the TextView to the designated clipboard as plain text. 28 // Copy contents of the TextView to the designated clipboard as plain text.
25 - (void)performCopy:(NSPasteboard*)pb; 29 - (void)performCopy:(NSPasteboard*)pb;
26 30
27 // Same as above, note that this calls through to performCopy. 31 // Same as above, note that this calls through to performCopy.
28 - (void)performCut:(NSPasteboard*)pb; 32 - (void)performCut:(NSPasteboard*)pb;
29 @end 33 @end
30 34
31 // A controller for the toolbar in the browser window. Manages updating the 35 // A controller for the toolbar in the browser window. Manages updating the
32 // state for location bar and back/fwd/reload/go buttons. 36 // state for location bar and back/fwd/reload/go buttons.
33 37
34 @interface ToolbarController : NSViewController<CommandObserverProtocol> { 38 @interface ToolbarController : NSViewController<CommandObserverProtocol> {
35 @private 39 @private
36 ToolbarModel* toolbarModel_; // weak, one per window 40 ToolbarModel* toolbarModel_; // weak, one per window
37 CommandUpdater* commands_; // weak, one per window 41 CommandUpdater* commands_; // weak, one per window
38 Profile* profile_; // weak, one per window 42 Profile* profile_; // weak, one per window
39 scoped_ptr<CommandObserverBridge> commandObserver_; 43 scoped_ptr<CommandObserverBridge> commandObserver_;
40 scoped_ptr<LocationBarViewMac> locationBarView_; 44 scoped_ptr<LocationBarViewMac> locationBarView_;
41 scoped_nsobject<LocationBarFieldEditor> locationBarFieldEditor_; // strong 45 scoped_nsobject<LocationBarFieldEditor> locationBarFieldEditor_; // strong
42 46
47 // Used for monitoring the optional toolbar button prefs.
48 scoped_ptr<ToolbarControllerInternal::PrefObserverBridge> prefObserver_;
49 BooleanPrefMember showHomeButton_;
50 BooleanPrefMember showPageOptionButtons_;
51
52 IBOutlet NSMenu* pageMenu_;
53 IBOutlet NSMenu* wrenchMenu_;
54
43 // The ordering is important for unit tests. If new items are added or the 55 // The ordering is important for unit tests. If new items are added or the
44 // ordering is changed, make sure to update |-toolbarViews| and the 56 // ordering is changed, make sure to update |-toolbarViews| and the
45 // corresponding enum in the unit tests. 57 // corresponding enum in the unit tests.
46 IBOutlet NSButton* backButton_; 58 IBOutlet NSButton* backButton_;
47 IBOutlet NSButton* forwardButton_; 59 IBOutlet NSButton* forwardButton_;
48 IBOutlet NSButton* reloadButton_; 60 IBOutlet NSButton* reloadButton_;
61 IBOutlet NSButton* homeButton_;
49 IBOutlet NSButton* starButton_; 62 IBOutlet NSButton* starButton_;
50 IBOutlet NSButton* goButton_; 63 IBOutlet NSButton* goButton_;
64 IBOutlet NSButton* pageButton_;
65 IBOutlet NSButton* wrenchButton_;
51 IBOutlet NSTextField* locationBar_; 66 IBOutlet NSTextField* locationBar_;
52 } 67 }
53 68
54 // Initialize the toolbar and register for command updates. The profile is 69 // Initialize the toolbar and register for command updates. The profile is
55 // needed for initializing the location bar. 70 // needed for initializing the location bar.
56 - (id)initWithModel:(ToolbarModel*)model 71 - (id)initWithModel:(ToolbarModel*)model
57 commands:(CommandUpdater*)commands 72 commands:(CommandUpdater*)commands
58 profile:(Profile*)profile; 73 profile:(Profile*)profile;
59 74
60 // Get the C++ bridge object representing the location bar for this tab. 75 // Get the C++ bridge object representing the location bar for this tab.
(...skipping 15 matching lines...) Expand all
76 - (void)updateToolbarWithContents:(TabContents*)tabForRestoring 91 - (void)updateToolbarWithContents:(TabContents*)tabForRestoring
77 shouldRestoreState:(BOOL)shouldRestore; 92 shouldRestoreState:(BOOL)shouldRestore;
78 93
79 // Sets whether or not the current page in the frontmost tab is bookmarked. 94 // Sets whether or not the current page in the frontmost tab is bookmarked.
80 - (void)setStarredState:(BOOL)isStarred; 95 - (void)setStarredState:(BOOL)isStarred;
81 96
82 // Called to update the loading state. Handles updating the go/stop button 97 // Called to update the loading state. Handles updating the go/stop button
83 // state. 98 // state.
84 - (void)setIsLoading:(BOOL)isLoading; 99 - (void)setIsLoading:(BOOL)isLoading;
85 100
101 // Actions for the optional menu buttons for the page and wrench menus. These
102 // will show a menu while the mouse is down.
103 - (IBAction)showPageMenu:(id)sender;
104 - (IBAction)showWrenchMenu:(id)sender;
105
86 @end 106 @end
87 107
88 // A set of private methods used by tests, in the absence of "friends" in ObjC. 108 // A set of private methods used by tests, in the absence of "friends" in ObjC.
89 @interface ToolbarController(PrivateTestMethods) 109 @interface ToolbarController(PrivateTestMethods)
90 // Returns an array of views in the order of the outlets above. 110 // Returns an array of views in the order of the outlets above.
91 - (NSArray*)toolbarViews; 111 - (NSArray*)toolbarViews;
112 - (void)showOptionalHomeButton;
113 - (void)showOptionalPageWrenchButtons;
92 @end 114 @end
93 115
94 #endif // CHROME_BROWSER_COCOA_TOOLBAR_CONTROLLER_H_ 116 #endif // CHROME_BROWSER_COCOA_TOOLBAR_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698