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

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

Issue 149717: [Mac] Refactor location-bar autocomplete cell classes. (Closed)
Patch Set: jrg comment 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
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 #include "chrome/common/pref_member.h" 14 #include "chrome/common/pref_member.h"
15 15
16 @class AutocompleteTextField;
17 @class AutocompleteTextFieldEditor;
16 class CommandUpdater; 18 class CommandUpdater;
17 class LocationBar; 19 class LocationBar;
18 class LocationBarViewMac; 20 class LocationBarViewMac;
19 namespace ToolbarControllerInternal { 21 namespace ToolbarControllerInternal {
20 class PrefObserverBridge; 22 class PrefObserverBridge;
21 } 23 }
22 class Profile; 24 class Profile;
23 class TabContents; 25 class TabContents;
24 class ToolbarModel; 26 class ToolbarModel;
25 class ToolbarView; 27 class ToolbarView;
26 28
27 // Field editor used for the location bar.
28 @interface LocationBarFieldEditor : NSTextView
29 // Copy contents of the TextView to the designated clipboard as plain text.
30 - (void)performCopy:(NSPasteboard*)pb;
31
32 // Same as above, note that this calls through to performCopy.
33 - (void)performCut:(NSPasteboard*)pb;
34 @end
35
36 // A controller for the toolbar in the browser window. Manages 29 // A controller for the toolbar in the browser window. Manages
37 // updating the state for location bar and back/fwd/reload/go buttons. 30 // updating the state for location bar and back/fwd/reload/go buttons.
38 // Manages the bookmark bar and it's position in the window relative to 31 // Manages the bookmark bar and it's position in the window relative to
39 // the web content view. 32 // the web content view.
40 33
41 @interface ToolbarController : NSViewController<CommandObserverProtocol> { 34 @interface ToolbarController : NSViewController<CommandObserverProtocol> {
42 @private 35 @private
43 ToolbarModel* toolbarModel_; // weak, one per window 36 ToolbarModel* toolbarModel_; // weak, one per window
44 CommandUpdater* commands_; // weak, one per window 37 CommandUpdater* commands_; // weak, one per window
45 Profile* profile_; // weak, one per window 38 Profile* profile_; // weak, one per window
46 scoped_ptr<CommandObserverBridge> commandObserver_; 39 scoped_ptr<CommandObserverBridge> commandObserver_;
47 scoped_ptr<LocationBarViewMac> locationBarView_; 40 scoped_ptr<LocationBarViewMac> locationBarView_;
48 scoped_nsobject<LocationBarFieldEditor> locationBarFieldEditor_; // strong 41 scoped_nsobject<AutocompleteTextFieldEditor> autocompleteTextFieldEditor_;
49 scoped_nsobject<BookmarkBarController> bookmarkBarController_; 42 scoped_nsobject<BookmarkBarController> bookmarkBarController_;
50 id<BookmarkURLOpener> bookmarkBarDelegate_; // weak 43 id<BookmarkURLOpener> bookmarkBarDelegate_; // weak
51 NSView* webContentView_; // weak; where the web goes 44 NSView* webContentView_; // weak; where the web goes
52 45
53 // Used for monitoring the optional toolbar button prefs. 46 // Used for monitoring the optional toolbar button prefs.
54 scoped_ptr<ToolbarControllerInternal::PrefObserverBridge> prefObserver_; 47 scoped_ptr<ToolbarControllerInternal::PrefObserverBridge> prefObserver_;
55 BooleanPrefMember showHomeButton_; 48 BooleanPrefMember showHomeButton_;
56 BooleanPrefMember showPageOptionButtons_; 49 BooleanPrefMember showPageOptionButtons_;
57 BOOL hasToolbar_; // if NO, we only have the location bar. 50 BOOL hasToolbar_; // if NO, we only have the location bar.
58 51
59 IBOutlet NSMenu* pageMenu_; 52 IBOutlet NSMenu* pageMenu_;
60 IBOutlet NSMenu* wrenchMenu_; 53 IBOutlet NSMenu* wrenchMenu_;
61 54
62 // 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
63 // ordering is changed, make sure to update |-toolbarViews| and the 56 // ordering is changed, make sure to update |-toolbarViews| and the
64 // corresponding enum in the unit tests. 57 // corresponding enum in the unit tests.
65 IBOutlet NSButton* backButton_; 58 IBOutlet NSButton* backButton_;
66 IBOutlet NSButton* forwardButton_; 59 IBOutlet NSButton* forwardButton_;
67 IBOutlet NSButton* reloadButton_; 60 IBOutlet NSButton* reloadButton_;
68 IBOutlet NSButton* homeButton_; 61 IBOutlet NSButton* homeButton_;
69 IBOutlet NSButton* starButton_; 62 IBOutlet NSButton* starButton_;
70 IBOutlet NSButton* goButton_; 63 IBOutlet NSButton* goButton_;
71 IBOutlet NSButton* pageButton_; 64 IBOutlet NSButton* pageButton_;
72 IBOutlet NSButton* wrenchButton_; 65 IBOutlet NSButton* wrenchButton_;
73 IBOutlet NSTextField* locationBar_; 66 IBOutlet AutocompleteTextField* locationBar_;
74 } 67 }
75 68
76 // Initialize the toolbar and register for command updates. The profile is 69 // Initialize the toolbar and register for command updates. The profile is
77 // needed for initializing the location bar. 70 // needed for initializing the location bar.
78 - (id)initWithModel:(ToolbarModel*)model 71 - (id)initWithModel:(ToolbarModel*)model
79 commands:(CommandUpdater*)commands 72 commands:(CommandUpdater*)commands
80 profile:(Profile*)profile 73 profile:(Profile*)profile
81 webContentView:(NSView*)webContentView 74 webContentView:(NSView*)webContentView
82 bookmarkDelegate:(id<BookmarkURLOpener>)delegate; 75 bookmarkDelegate:(id<BookmarkURLOpener>)delegate;
83 76
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 117
125 // A set of private methods used by tests, in the absence of "friends" in ObjC. 118 // A set of private methods used by tests, in the absence of "friends" in ObjC.
126 @interface ToolbarController(PrivateTestMethods) 119 @interface ToolbarController(PrivateTestMethods)
127 // Returns an array of views in the order of the outlets above. 120 // Returns an array of views in the order of the outlets above.
128 - (NSArray*)toolbarViews; 121 - (NSArray*)toolbarViews;
129 - (void)showOptionalHomeButton; 122 - (void)showOptionalHomeButton;
130 - (void)showOptionalPageWrenchButtons; 123 - (void)showOptionalPageWrenchButtons;
131 @end 124 @end
132 125
133 #endif // CHROME_BROWSER_COCOA_TOOLBAR_CONTROLLER_H_ 126 #endif // CHROME_BROWSER_COCOA_TOOLBAR_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/location_bar_view_mac.mm ('k') | chrome/browser/cocoa/toolbar_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698