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

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

Issue 126075: Fix http://crbug.com/13971: OSX: Text copied from Omnibox is styled (Closed)
Patch Set: Fix-ed Created 11 years, 6 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 #import "chrome/browser/cocoa/command_observer_bridge.h" 12 #import "chrome/browser/cocoa/command_observer_bridge.h"
12 13
13 class CommandUpdater; 14 class CommandUpdater;
14 class LocationBar; 15 class LocationBar;
15 class LocationBarViewMac; 16 class LocationBarViewMac;
16 class Profile; 17 class Profile;
17 class TabContents; 18 class TabContents;
18 class ToolbarModel; 19 class ToolbarModel;
19 class ToolbarView; 20 class ToolbarView;
20 21
22 // Field editor used for the location bar.
23 @interface LocationBarFieldEditor : NSTextView
24 // Copy contents of the TextView to the designated clipboard as plain text.
25 - (void)performCopy:(NSPasteboard*)pb;
26
27 // Same as above, note that this calls through to performCopy.
28 - (void)performCut:(NSPasteboard*)pb;
29 @end
30
21 // A controller for the toolbar in the browser window. Manages updating the 31 // A controller for the toolbar in the browser window. Manages updating the
22 // state for location bar and back/fwd/reload/go buttons. 32 // state for location bar and back/fwd/reload/go buttons.
23 33
24 @interface ToolbarController : NSViewController<CommandObserverProtocol> { 34 @interface ToolbarController : NSViewController<CommandObserverProtocol> {
25 @private 35 @private
26 ToolbarModel* toolbarModel_; // weak, one per window 36 ToolbarModel* toolbarModel_; // weak, one per window
27 CommandUpdater* commands_; // weak, one per window 37 CommandUpdater* commands_; // weak, one per window
28 Profile* profile_; // weak, one per window 38 Profile* profile_; // weak, one per window
29 scoped_ptr<CommandObserverBridge> commandObserver_; 39 scoped_ptr<CommandObserverBridge> commandObserver_;
30 scoped_ptr<LocationBarViewMac> locationBarView_; 40 scoped_ptr<LocationBarViewMac> locationBarView_;
41 scoped_nsobject<LocationBarFieldEditor> locationBarFieldEditor_; // strong
31 42
32 // The ordering is important for unit tests. If new items are added or the 43 // The ordering is important for unit tests. If new items are added or the
33 // ordering is changed, make sure to update |-toolbarViews| and the 44 // ordering is changed, make sure to update |-toolbarViews| and the
34 // corresponding enum in the unit tests. 45 // corresponding enum in the unit tests.
35 IBOutlet NSButton* backButton_; 46 IBOutlet NSButton* backButton_;
36 IBOutlet NSButton* forwardButton_; 47 IBOutlet NSButton* forwardButton_;
37 IBOutlet NSButton* reloadButton_; 48 IBOutlet NSButton* reloadButton_;
38 IBOutlet NSButton* starButton_; 49 IBOutlet NSButton* starButton_;
39 IBOutlet NSButton* goButton_; 50 IBOutlet NSButton* goButton_;
40 IBOutlet NSTextField* locationBar_; 51 IBOutlet NSTextField* locationBar_;
41 } 52 }
42 53
43 // Initialize the toolbar and register for command updates. The profile is 54 // Initialize the toolbar and register for command updates. The profile is
44 // needed for initializing the location bar. 55 // needed for initializing the location bar.
45 - (id)initWithModel:(ToolbarModel*)model 56 - (id)initWithModel:(ToolbarModel*)model
46 commands:(CommandUpdater*)commands 57 commands:(CommandUpdater*)commands
47 profile:(Profile*)profile; 58 profile:(Profile*)profile;
48 59
49 // Get the C++ bridge object representing the location bar for this tab. 60 // Get the C++ bridge object representing the location bar for this tab.
50 - (LocationBar*)locationBar; 61 - (LocationBar*)locationBar;
51 62
63 // Called by the Window delegate so we can provide a custom field editor if
64 // needed.
65 // Note that this may be called for objects unrelated to the toolbar.
66 // returns nil if we don't want to override the custom field editor for |obj|.
67 - (id)customFieldEditorForObject:(id)obj;
68
52 // Make the location bar the first responder, if possible. 69 // Make the location bar the first responder, if possible.
53 - (void)focusLocationBar; 70 - (void)focusLocationBar;
54 71
55 // Updates the toolbar (and transitively the location bar) with the states of 72 // Updates the toolbar (and transitively the location bar) with the states of
56 // the specified |tab|. If |shouldRestore| is true, we're switching 73 // the specified |tab|. If |shouldRestore| is true, we're switching
57 // (back?) to this tab and should restore any previous location bar state 74 // (back?) to this tab and should restore any previous location bar state
58 // (such as user editing) as well. 75 // (such as user editing) as well.
59 - (void)updateToolbarWithContents:(TabContents*)tabForRestoring 76 - (void)updateToolbarWithContents:(TabContents*)tabForRestoring
60 shouldRestoreState:(BOOL)shouldRestore; 77 shouldRestoreState:(BOOL)shouldRestore;
61 78
62 // Sets whether or not the current page in the frontmost tab is bookmarked. 79 // Sets whether or not the current page in the frontmost tab is bookmarked.
63 - (void)setStarredState:(BOOL)isStarred; 80 - (void)setStarredState:(BOOL)isStarred;
64 81
65 // Called to update the loading state. Handles updating the go/stop button 82 // Called to update the loading state. Handles updating the go/stop button
66 // state. 83 // state.
67 - (void)setIsLoading:(BOOL)isLoading; 84 - (void)setIsLoading:(BOOL)isLoading;
68 85
69 @end 86 @end
70 87
71 // A set of private methods used by tests, in the absence of "friends" in ObjC. 88 // A set of private methods used by tests, in the absence of "friends" in ObjC.
72 @interface ToolbarController(PrivateTestMethods) 89 @interface ToolbarController(PrivateTestMethods)
73 // Returns an array of views in the order of the outlets above. 90 // Returns an array of views in the order of the outlets above.
74 - (NSArray*)toolbarViews; 91 - (NSArray*)toolbarViews;
75 @end 92 @end
76 93
77 #endif // CHROME_BROWSER_COCOA_TOOLBAR_CONTROLLER_H_ 94 #endif // CHROME_BROWSER_COCOA_TOOLBAR_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698