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

Side by Side Diff: chrome/browser/browser_window_controller.mm

Issue 18501: remove the NSToolbar, improve the appearance a little bit. ObjC style member ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 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/browser_window_controller.h ('k') | no next file » | 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 #import "chrome/browser/browser.h" 5 #import "chrome/browser/browser.h"
6 #import "chrome/browser/browser_window_cocoa.h" 6 #import "chrome/browser/browser_window_cocoa.h"
7 #import "chrome/browser/browser_window_controller.h" 7 #import "chrome/browser/browser_window_controller.h"
8 8
9 @implementation BrowserWindowController 9 @implementation BrowserWindowController
10 10
11 // Load the browser window nib and do any Cocoa-specific initialization. 11 // Load the browser window nib and do any Cocoa-specific initialization.
12 // Takes ownership of |browser|. Note that the nib also sets this controller 12 // Takes ownership of |browser|. Note that the nib also sets this controller
13 // up as the window's delegate. 13 // up as the window's delegate.
14 - (id)initWithBrowser:(Browser*)browser { 14 - (id)initWithBrowser:(Browser*)browser {
15 if ((self = [super initWithWindowNibName:@"BrowserWindow"])) { 15 if ((self = [super initWithWindowNibName:@"BrowserWindow"])) {
16 browser_ = browser; 16 browser_ = browser;
17 window_shim_ = new BrowserWindowCocoa(self, [self window]); 17 windowShim_ = new BrowserWindowCocoa(self, [self window]);
18 } 18 }
19 return self; 19 return self;
20 } 20 }
21 21
22 - (void)dealloc { 22 - (void)dealloc {
23 browser_->CloseAllTabs(); 23 browser_->CloseAllTabs();
24 delete browser_; 24 delete browser_;
25 delete window_shim_; 25 delete windowShim_;
26 [super dealloc]; 26 [super dealloc];
27 } 27 }
28 28
29 // Access the C++ bridge between the NSWindow and the rest of Chromium 29 // Access the C++ bridge between the NSWindow and the rest of Chromium
30 - (BrowserWindow*)browserWindow { 30 - (BrowserWindow*)browserWindow {
31 return window_shim_; 31 return windowShim_;
32 } 32 }
33 33
34 - (void)windowDidLoad { 34 - (void)windowDidLoad {
35 [(NSControl*)[url_bar_ view] 35 [urlBarView_ setStringValue:@"http://the.interwebs.start.here"];
36 setStringValue:@"http://the.interwebs.start.here"];
37 } 36 }
38 37
39 - (void)destroyBrowser { 38 - (void)destroyBrowser {
40 // we need the window to go away now, other areas of code will be checking 39 // we need the window to go away now, other areas of code will be checking
41 // the number of browser objects remaining after we finish so we can't defer 40 // the number of browser objects remaining after we finish so we can't defer
42 // deletion via autorelease. 41 // deletion via autorelease.
43 [self autorelease]; 42 [self autorelease];
44 } 43 }
45 44
46 // Called when the window is closing from Cocoa. Destroy this controller, 45 // Called when the window is closing from Cocoa. Destroy this controller,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 80
82 // Called when the user picks a menu or toolbar item when this window is key. 81 // Called when the user picks a menu or toolbar item when this window is key.
83 // Calls through to the browser object to execute the command. This assumes that 82 // Calls through to the browser object to execute the command. This assumes that
84 // the command is supported and doesn't check, otherwise it would have been 83 // the command is supported and doesn't check, otherwise it would have been
85 // disabled in the UI in validateUserInterfaceItem:. 84 // disabled in the UI in validateUserInterfaceItem:.
86 - (void)commandDispatch:(id)sender { 85 - (void)commandDispatch:(id)sender {
87 NSInteger tag = [sender tag]; 86 NSInteger tag = [sender tag];
88 browser_->ExecuteCommand(tag); 87 browser_->ExecuteCommand(tag);
89 } 88 }
90 89
91 // NSToolbar delegate methods
92
93 - (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar *)toolbar {
94 return [NSArray arrayWithObjects:[back_button_ itemIdentifier],
95 [forward_button_ itemIdentifier],
96 [url_bar_ itemIdentifier], nil];
97 }
98
99 - (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar {
100 return [NSArray arrayWithObjects:[back_button_ itemIdentifier],
101 [forward_button_ itemIdentifier],
102 [url_bar_ itemIdentifier], nil];
103 }
104
105 @end 90 @end
OLDNEW
« no previous file with comments | « chrome/browser/browser_window_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698