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

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

Issue 155358: More bookmark bar changes.... (Closed) Base URL: svn://chrome-svn/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 #import "chrome/browser/cocoa/toolbar_controller.h" 5 #import "chrome/browser/cocoa/toolbar_controller.h"
6 6
7 #include "base/mac_util.h" 7 #include "base/mac_util.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #include "chrome/app/chrome_dll_resource.h" 9 #include "chrome/app/chrome_dll_resource.h"
10 #import "chrome/browser/cocoa/location_bar_view_mac.h" 10 #import "chrome/browser/cocoa/location_bar_view_mac.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 PrefService* prefs = profile_->GetPrefs(); 113 PrefService* prefs = profile_->GetPrefs();
114 showHomeButton_.Init(prefs::kShowHomeButton, prefs, prefObserver_.get()); 114 showHomeButton_.Init(prefs::kShowHomeButton, prefs, prefObserver_.get());
115 showPageOptionButtons_.Init(prefs::kShowPageOptionsButtons, prefs, 115 showPageOptionButtons_.Init(prefs::kShowPageOptionsButtons, prefs,
116 prefObserver_.get()); 116 prefObserver_.get());
117 [self showOptionalHomeButton]; 117 [self showOptionalHomeButton];
118 [self showOptionalPageWrenchButtons]; 118 [self showOptionalPageWrenchButtons];
119 119
120 // Create a sub-controller for the bookmark bar. 120 // Create a sub-controller for the bookmark bar.
121 bookmarkBarController_.reset([[BookmarkBarController alloc] 121 bookmarkBarController_.reset([[BookmarkBarController alloc]
122 initWithProfile:profile_ 122 initWithProfile:profile_
123 view:bookmarkBarView_ 123 parentView:[self view]
124 webContentView:webContentView_ 124 webContentView:webContentView_
125 delegate:bookmarkBarDelegate_]); 125 delegate:bookmarkBarDelegate_]);
126
127 // Add bookmark bar to the view hierarchy. This also triggers the
128 // nib load. The bookmark bar is defined (in the nib) to be
129 // bottom-aligned to it's parent view (among other things), so
130 // position and resize properties don't need to be set.
131 [[self view] addSubview:[bookmarkBarController_ view]];
126 } 132 }
127 133
128 - (LocationBar*)locationBar { 134 - (LocationBar*)locationBar {
129 return locationBarView_.get(); 135 return locationBarView_.get();
130 } 136 }
131 137
132 - (void)focusLocationBar { 138 - (void)focusLocationBar {
133 if (locationBarView_.get()) { 139 if (locationBarView_.get()) {
134 locationBarView_->FocusLocation(); 140 locationBarView_->FocusLocation();
135 } 141 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 [locationBarFieldEditor_.get() setFieldEditor:YES]; 222 [locationBarFieldEditor_.get() setFieldEditor:YES];
217 return locationBarFieldEditor_.get(); 223 return locationBarFieldEditor_.get();
218 } 224 }
219 return nil; 225 return nil;
220 } 226 }
221 227
222 // Returns an array of views in the order of the outlets above. 228 // Returns an array of views in the order of the outlets above.
223 - (NSArray*)toolbarViews { 229 - (NSArray*)toolbarViews {
224 return [NSArray arrayWithObjects:backButton_, forwardButton_, reloadButton_, 230 return [NSArray arrayWithObjects:backButton_, forwardButton_, reloadButton_,
225 homeButton_, starButton_, goButton_, pageButton_, wrenchButton_, 231 homeButton_, starButton_, goButton_, pageButton_, wrenchButton_,
226 locationBar_, bookmarkBarView_, nil]; 232 locationBar_, nil];
227 } 233 }
228 234
229 // Moves |rect| to the right by |delta|, keeping the right side fixed by 235 // Moves |rect| to the right by |delta|, keeping the right side fixed by
230 // shrinking the width to compensate. Passing a negative value for |deltaX| 236 // shrinking the width to compensate. Passing a negative value for |deltaX|
231 // moves to the left and increases the width. 237 // moves to the left and increases the width.
232 - (NSRect)adjustRect:(NSRect)rect byAmount:(float)deltaX { 238 - (NSRect)adjustRect:(NSRect)rect byAmount:(float)deltaX {
233 NSRect frame = NSOffsetRect(rect, deltaX, 0); 239 NSRect frame = NSOffsetRect(rect, deltaX, 0);
234 frame.size.width -= deltaX; 240 frame.size.width -= deltaX;
235 return frame; 241 return frame;
236 } 242 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 forView:pageButton_]; 310 forView:pageButton_];
305 } 311 }
306 312
307 - (IBAction)showWrenchMenu:(id)sender { 313 - (IBAction)showWrenchMenu:(id)sender {
308 [NSMenu popUpContextMenu:wrenchMenu_ 314 [NSMenu popUpContextMenu:wrenchMenu_
309 withEvent:[NSApp currentEvent] 315 withEvent:[NSApp currentEvent]
310 forView:wrenchButton_]; 316 forView:wrenchButton_];
311 } 317 }
312 318
313 @end 319 @end
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/toolbar_controller.h ('k') | chrome/browser/cocoa/toolbar_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698