OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "app/l10n_util_mac.h" | 9 #include "app/l10n_util_mac.h" |
10 #include "base/mac_util.h" | 10 #include "base/mac_util.h" |
11 #include "base/nsimage_cache_mac.h" | 11 #include "base/nsimage_cache_mac.h" |
12 #include "base/sys_string_conversions.h" | 12 #include "base/sys_string_conversions.h" |
13 #include "chrome/app/chrome_dll_resource.h" | 13 #include "chrome/app/chrome_dll_resource.h" |
14 #include "chrome/browser/app_menu_model.h" | |
15 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" | 14 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" |
16 #include "chrome/browser/browser.h" | 15 #include "chrome/browser/browser.h" |
17 #include "chrome/browser/browser_window.h" | 16 #include "chrome/browser/browser_window.h" |
18 #import "chrome/browser/cocoa/autocomplete_text_field.h" | 17 #import "chrome/browser/cocoa/autocomplete_text_field.h" |
19 #import "chrome/browser/cocoa/autocomplete_text_field_editor.h" | 18 #import "chrome/browser/cocoa/autocomplete_text_field_editor.h" |
20 #import "chrome/browser/cocoa/back_forward_menu_controller.h" | 19 #import "chrome/browser/cocoa/back_forward_menu_controller.h" |
21 #import "chrome/browser/cocoa/background_gradient_view.h" | 20 #import "chrome/browser/cocoa/background_gradient_view.h" |
22 #import "chrome/browser/cocoa/encoding_menu_controller_delegate_mac.h" | 21 #import "chrome/browser/cocoa/encoding_menu_controller_delegate_mac.h" |
23 #import "chrome/browser/cocoa/extensions/browser_action_button.h" | 22 #import "chrome/browser/cocoa/extensions/browser_action_button.h" |
24 #import "chrome/browser/cocoa/extensions/browser_actions_container_view.h" | 23 #import "chrome/browser/cocoa/extensions/browser_actions_container_view.h" |
25 #import "chrome/browser/cocoa/extensions/browser_actions_controller.h" | 24 #import "chrome/browser/cocoa/extensions/browser_actions_controller.h" |
26 #import "chrome/browser/cocoa/gradient_button_cell.h" | 25 #import "chrome/browser/cocoa/gradient_button_cell.h" |
27 #import "chrome/browser/cocoa/location_bar_view_mac.h" | 26 #import "chrome/browser/cocoa/location_bar_view_mac.h" |
28 #import "chrome/browser/cocoa/menu_button.h" | 27 #import "chrome/browser/cocoa/menu_button.h" |
29 #import "chrome/browser/cocoa/menu_controller.h" | 28 #import "chrome/browser/cocoa/menu_controller.h" |
30 #import "chrome/browser/cocoa/toolbar_view.h" | 29 #import "chrome/browser/cocoa/toolbar_view.h" |
31 #include "chrome/browser/net/url_fixer_upper.h" | 30 #include "chrome/browser/net/url_fixer_upper.h" |
32 #include "chrome/browser/page_menu_model.h" | |
33 #include "chrome/browser/pref_service.h" | 31 #include "chrome/browser/pref_service.h" |
34 #include "chrome/browser/profile.h" | 32 #include "chrome/browser/profile.h" |
35 #include "chrome/browser/search_engines/template_url_model.h" | 33 #include "chrome/browser/search_engines/template_url_model.h" |
36 #include "chrome/browser/tab_contents/tab_contents.h" | 34 #include "chrome/browser/tab_contents/tab_contents.h" |
37 #include "chrome/browser/toolbar_model.h" | 35 #include "chrome/browser/toolbar_model.h" |
| 36 #include "chrome/browser/wrench_menu_model.h" |
38 #include "chrome/common/notification_details.h" | 37 #include "chrome/common/notification_details.h" |
39 #include "chrome/common/notification_observer.h" | 38 #include "chrome/common/notification_observer.h" |
40 #include "chrome/common/notification_type.h" | 39 #include "chrome/common/notification_type.h" |
41 #include "chrome/common/pref_names.h" | 40 #include "chrome/common/pref_names.h" |
42 #include "gfx/rect.h" | 41 #include "gfx/rect.h" |
43 #include "grit/chromium_strings.h" | 42 #include "grit/chromium_strings.h" |
44 #include "grit/generated_resources.h" | 43 #include "grit/generated_resources.h" |
45 | 44 |
46 namespace { | 45 namespace { |
47 | 46 |
48 // Names of images in the bundle for buttons. | 47 // Names of images in the bundle for buttons. |
49 NSString* const kBackButtonImageName = @"back_Template.pdf"; | 48 NSString* const kBackButtonImageName = @"back_Template.pdf"; |
50 NSString* const kForwardButtonImageName = @"forward_Template.pdf"; | 49 NSString* const kForwardButtonImageName = @"forward_Template.pdf"; |
51 NSString* const kReloadButtonReloadImageName = @"reload_Template.pdf"; | 50 NSString* const kReloadButtonReloadImageName = @"reload_Template.pdf"; |
52 NSString* const kReloadButtonStopImageName = @"stop_Template.pdf"; | 51 NSString* const kReloadButtonStopImageName = @"stop_Template.pdf"; |
53 NSString* const kHomeButtonImageName = @"home_Template.pdf"; | 52 NSString* const kHomeButtonImageName = @"home_Template.pdf"; |
54 NSString* const kPageButtonImageName = @"menu_page_Template.pdf"; | |
55 NSString* const kWrenchButtonImageName = @"menu_chrome_Template.pdf"; | 53 NSString* const kWrenchButtonImageName = @"menu_chrome_Template.pdf"; |
56 | 54 |
57 // Height of the toolbar in pixels when the bookmark bar is closed. | 55 // Height of the toolbar in pixels when the bookmark bar is closed. |
58 const CGFloat kBaseToolbarHeight = 36.0; | 56 const CGFloat kBaseToolbarHeight = 36.0; |
59 | 57 |
60 // The distance from the location bar to the Browser Actions container | 58 // The distance from the location bar to the Browser Actions container |
61 // in pixels. | 59 // in pixels. |
62 const CGFloat kBrowserActionsContainerLeftPadding = 5.0; | 60 const CGFloat kBrowserActionsContainerLeftPadding = 5.0; |
63 | 61 |
64 // The minimum width of the location bar in pixels. | 62 // The minimum width of the location bar in pixels. |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 - (void)awakeFromNib { | 211 - (void)awakeFromNib { |
214 // A bug in AppKit (<rdar://7298597>, <http://openradar.me/7298597>) causes | 212 // A bug in AppKit (<rdar://7298597>, <http://openradar.me/7298597>) causes |
215 // images loaded directly from nibs in a framework to not get their "template" | 213 // images loaded directly from nibs in a framework to not get their "template" |
216 // flags set properly. Thus, despite the images being set on the buttons in | 214 // flags set properly. Thus, despite the images being set on the buttons in |
217 // the xib, we must set them in code. | 215 // the xib, we must set them in code. |
218 [backButton_ setImage:nsimage_cache::ImageNamed(kBackButtonImageName)]; | 216 [backButton_ setImage:nsimage_cache::ImageNamed(kBackButtonImageName)]; |
219 [forwardButton_ setImage:nsimage_cache::ImageNamed(kForwardButtonImageName)]; | 217 [forwardButton_ setImage:nsimage_cache::ImageNamed(kForwardButtonImageName)]; |
220 [reloadButton_ | 218 [reloadButton_ |
221 setImage:nsimage_cache::ImageNamed(kReloadButtonReloadImageName)]; | 219 setImage:nsimage_cache::ImageNamed(kReloadButtonReloadImageName)]; |
222 [homeButton_ setImage:nsimage_cache::ImageNamed(kHomeButtonImageName)]; | 220 [homeButton_ setImage:nsimage_cache::ImageNamed(kHomeButtonImageName)]; |
223 [pageButton_ setImage:nsimage_cache::ImageNamed(kPageButtonImageName)]; | |
224 [wrenchButton_ setImage:nsimage_cache::ImageNamed(kWrenchButtonImageName)]; | 221 [wrenchButton_ setImage:nsimage_cache::ImageNamed(kWrenchButtonImageName)]; |
225 | 222 |
226 [pageButton_ setShowsBorderOnlyWhileMouseInside:YES]; | |
227 [wrenchButton_ setShowsBorderOnlyWhileMouseInside:YES]; | 223 [wrenchButton_ setShowsBorderOnlyWhileMouseInside:YES]; |
228 | 224 |
229 [self initCommandStatus:commands_]; | 225 [self initCommandStatus:commands_]; |
230 locationBarView_.reset(new LocationBarViewMac(locationBar_, | 226 locationBarView_.reset(new LocationBarViewMac(locationBar_, |
231 commands_, toolbarModel_, | 227 commands_, toolbarModel_, |
232 profile_, browser_)); | 228 profile_, browser_)); |
233 [locationBar_ setFont:[NSFont systemFontOfSize:[NSFont systemFontSize]]]; | 229 [locationBar_ setFont:[NSFont systemFontOfSize:[NSFont systemFontSize]]]; |
234 // Register pref observers for the optional home and page/options buttons | 230 // Register pref observers for the optional home and page/options buttons |
235 // and then add them to the toolbar based on those prefs. | 231 // and then add them to the toolbar based on those prefs. |
236 prefObserver_.reset(new ToolbarControllerInternal::PrefObserverBridge(self)); | 232 prefObserver_.reset(new ToolbarControllerInternal::PrefObserverBridge(self)); |
237 PrefService* prefs = profile_->GetPrefs(); | 233 PrefService* prefs = profile_->GetPrefs(); |
238 showHomeButton_.Init(prefs::kShowHomeButton, prefs, prefObserver_.get()); | 234 showHomeButton_.Init(prefs::kShowHomeButton, prefs, prefObserver_.get()); |
239 showPageOptionButtons_.Init(prefs::kShowPageOptionsButtons, prefs, | 235 showPageOptionButtons_.Init(prefs::kShowPageOptionsButtons, prefs, |
240 prefObserver_.get()); | 236 prefObserver_.get()); |
241 [self showOptionalHomeButton]; | 237 [self showOptionalHomeButton]; |
242 [self showOptionalPageWrenchButtons]; | 238 [self installWrenchMenu]; |
243 | 239 |
244 // Create the controllers for the back/forward menus. | 240 // Create the controllers for the back/forward menus. |
245 backMenuController_.reset([[BackForwardMenuController alloc] | 241 backMenuController_.reset([[BackForwardMenuController alloc] |
246 initWithBrowser:browser_ | 242 initWithBrowser:browser_ |
247 modelType:BACK_FORWARD_MENU_TYPE_BACK | 243 modelType:BACK_FORWARD_MENU_TYPE_BACK |
248 button:backButton_]); | 244 button:backButton_]); |
249 forwardMenuController_.reset([[BackForwardMenuController alloc] | 245 forwardMenuController_.reset([[BackForwardMenuController alloc] |
250 initWithBrowser:browser_ | 246 initWithBrowser:browser_ |
251 modelType:BACK_FORWARD_MENU_TYPE_FORWARD | 247 modelType:BACK_FORWARD_MENU_TYPE_FORWARD |
252 button:forwardButton_]); | 248 button:forwardButton_]); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 accessibilitySetOverrideValue:description | 296 accessibilitySetOverrideValue:description |
301 forAttribute:NSAccessibilityDescriptionAttribute]; | 297 forAttribute:NSAccessibilityDescriptionAttribute]; |
302 description = l10n_util::GetNSStringWithFixup(IDS_ACCNAME_HOME); | 298 description = l10n_util::GetNSStringWithFixup(IDS_ACCNAME_HOME); |
303 [[homeButton_ cell] | 299 [[homeButton_ cell] |
304 accessibilitySetOverrideValue:description | 300 accessibilitySetOverrideValue:description |
305 forAttribute:NSAccessibilityDescriptionAttribute]; | 301 forAttribute:NSAccessibilityDescriptionAttribute]; |
306 description = l10n_util::GetNSStringWithFixup(IDS_ACCNAME_LOCATION); | 302 description = l10n_util::GetNSStringWithFixup(IDS_ACCNAME_LOCATION); |
307 [[locationBar_ cell] | 303 [[locationBar_ cell] |
308 accessibilitySetOverrideValue:description | 304 accessibilitySetOverrideValue:description |
309 forAttribute:NSAccessibilityDescriptionAttribute]; | 305 forAttribute:NSAccessibilityDescriptionAttribute]; |
310 description = l10n_util::GetNSStringWithFixup(IDS_ACCNAME_PAGE); | |
311 [[pageButton_ cell] | |
312 accessibilitySetOverrideValue:description | |
313 forAttribute:NSAccessibilityDescriptionAttribute]; | |
314 description = l10n_util::GetNSStringWithFixup(IDS_ACCNAME_APP); | 306 description = l10n_util::GetNSStringWithFixup(IDS_ACCNAME_APP); |
315 [[wrenchButton_ cell] | 307 [[wrenchButton_ cell] |
316 accessibilitySetOverrideValue:description | 308 accessibilitySetOverrideValue:description |
317 forAttribute:NSAccessibilityDescriptionAttribute]; | 309 forAttribute:NSAccessibilityDescriptionAttribute]; |
318 } | 310 } |
319 | 311 |
320 - (void)mouseExited:(NSEvent*)theEvent { | 312 - (void)mouseExited:(NSEvent*)theEvent { |
321 [[hoveredButton_ cell] setMouseInside:NO animate:YES]; | 313 [[hoveredButton_ cell] setMouseInside:NO animate:YES]; |
322 [hoveredButton_ release]; | 314 [hoveredButton_ release]; |
323 hoveredButton_ = nil; | 315 hoveredButton_ = nil; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 DCHECK(autocompleteTextFieldEditor_.get()); | 453 DCHECK(autocompleteTextFieldEditor_.get()); |
462 [autocompleteTextFieldEditor_.get() setFieldEditor:YES]; | 454 [autocompleteTextFieldEditor_.get() setFieldEditor:YES]; |
463 return autocompleteTextFieldEditor_.get(); | 455 return autocompleteTextFieldEditor_.get(); |
464 } | 456 } |
465 return nil; | 457 return nil; |
466 } | 458 } |
467 | 459 |
468 // Returns an array of views in the order of the outlets above. | 460 // Returns an array of views in the order of the outlets above. |
469 - (NSArray*)toolbarViews { | 461 - (NSArray*)toolbarViews { |
470 return [NSArray arrayWithObjects:backButton_, forwardButton_, reloadButton_, | 462 return [NSArray arrayWithObjects:backButton_, forwardButton_, reloadButton_, |
471 homeButton_, pageButton_, wrenchButton_, locationBar_, | 463 homeButton_, wrenchButton_, locationBar_, |
472 browserActionsContainerView_, nil]; | 464 browserActionsContainerView_, nil]; |
473 } | 465 } |
474 | 466 |
475 // Moves |rect| to the right by |delta|, keeping the right side fixed by | 467 // Moves |rect| to the right by |delta|, keeping the right side fixed by |
476 // shrinking the width to compensate. Passing a negative value for |deltaX| | 468 // shrinking the width to compensate. Passing a negative value for |deltaX| |
477 // moves to the left and increases the width. | 469 // moves to the left and increases the width. |
478 - (NSRect)adjustRect:(NSRect)rect byAmount:(CGFloat)deltaX { | 470 - (NSRect)adjustRect:(NSRect)rect byAmount:(CGFloat)deltaX { |
479 NSRect frame = NSOffsetRect(rect, deltaX, 0); | 471 NSRect frame = NSOffsetRect(rect, deltaX, 0); |
480 frame.size.width -= deltaX; | 472 frame.size.width -= deltaX; |
481 return frame; | 473 return frame; |
(...skipping 26 matching lines...) Expand all Loading... |
508 CGFloat moveX = [self interButtonSpacing] + [homeButton_ frame].size.width; | 500 CGFloat moveX = [self interButtonSpacing] + [homeButton_ frame].size.width; |
509 if (hide) | 501 if (hide) |
510 moveX *= -1; // Reverse the direction of the move. | 502 moveX *= -1; // Reverse the direction of the move. |
511 | 503 |
512 [reloadButton_ setFrame:NSOffsetRect([reloadButton_ frame], moveX, 0)]; | 504 [reloadButton_ setFrame:NSOffsetRect([reloadButton_ frame], moveX, 0)]; |
513 [locationBar_ setFrame:[self adjustRect:[locationBar_ frame] | 505 [locationBar_ setFrame:[self adjustRect:[locationBar_ frame] |
514 byAmount:moveX]]; | 506 byAmount:moveX]]; |
515 [homeButton_ setHidden:hide]; | 507 [homeButton_ setHidden:hide]; |
516 } | 508 } |
517 | 509 |
518 // Lazily install the menus on the page and wrench buttons. Calling this | 510 // Install the menu wrench buttons. Calling this repeatedly is inexpensive so it |
519 // repeatedly is inexpensive so it can be done every time the buttons are shown. | 511 // can be done every time the buttons are shown. |
520 - (void)installPageWrenchMenus { | 512 - (void)installWrenchMenu { |
521 if (pageMenuModel_.get()) | 513 if (wrenchMenuModel_.get()) |
522 return; | 514 return; |
523 menuDelegate_.reset(new ToolbarControllerInternal::MenuDelegate(browser_)); | 515 menuDelegate_.reset(new ToolbarControllerInternal::MenuDelegate(browser_)); |
524 pageMenuModel_.reset(new PageMenuModel(menuDelegate_.get(), browser_)); | 516 |
525 pageMenuController_.reset( | 517 wrenchMenuModel_.reset(new WrenchMenuModel(menuDelegate_.get(), browser_)); |
526 [[MenuController alloc] initWithModel:pageMenuModel_.get() | 518 wrenchMenuController_.reset( |
| 519 [[MenuController alloc] initWithModel:wrenchMenuModel_.get() |
527 useWithPopUpButtonCell:YES]); | 520 useWithPopUpButtonCell:YES]); |
528 [pageButton_ setAttachedMenu:[pageMenuController_ menu]]; | 521 [wrenchButton_ setAttachedMenu:[wrenchMenuController_ menu]]; |
529 | |
530 appMenuModel_.reset(new AppMenuModel(menuDelegate_.get(), browser_)); | |
531 appMenuController_.reset( | |
532 [[MenuController alloc] initWithModel:appMenuModel_.get() | |
533 useWithPopUpButtonCell:YES]); | |
534 [wrenchButton_ setAttachedMenu:[appMenuController_ menu]]; | |
535 } | |
536 | |
537 // Show or hide the page and wrench buttons based on the pref. | |
538 - (void)showOptionalPageWrenchButtons { | |
539 // Ignore this message if only showing the URL bar. | |
540 if (!hasToolbar_) | |
541 return; | |
542 DCHECK([pageButton_ isHidden] == [wrenchButton_ isHidden]); | |
543 BOOL hide = showPageOptionButtons_.GetValue() ? NO : YES; | |
544 if (!hide) | |
545 [self installPageWrenchMenus]; | |
546 if (hide == [pageButton_ isHidden]) | |
547 return; // Nothing to do, view state matches pref state. | |
548 | |
549 // Resize the text field and move the browser actions by the width | |
550 // of the page/wrench buttons plus two times the gap width. | |
551 CGFloat dX = 2 * [self interButtonSpacing] + NSWidth([pageButton_ frame]) + | |
552 NSWidth([wrenchButton_ frame]); | |
553 | |
554 // Larger if hiding menus, smaller if showing. | |
555 if (!hide) | |
556 dX *= -1; | |
557 | |
558 [self adjustLocationSizeBy:dX animate:NO]; | |
559 [browserActionsContainerView_ setFrame:NSOffsetRect( | |
560 [browserActionsContainerView_ frame], dX, 0)]; | |
561 | |
562 [browserActionsContainerView_ setRightBorderShown:!hide]; | |
563 [pageButton_ setHidden:hide]; | |
564 [wrenchButton_ setHidden:hide]; | |
565 } | 522 } |
566 | 523 |
567 - (void)prefChanged:(std::wstring*)prefName { | 524 - (void)prefChanged:(std::wstring*)prefName { |
568 if (!prefName) return; | 525 if (!prefName) return; |
569 if (*prefName == prefs::kShowHomeButton) { | 526 if (*prefName == prefs::kShowHomeButton) { |
570 [self showOptionalHomeButton]; | 527 [self showOptionalHomeButton]; |
571 } else if (*prefName == prefs::kShowPageOptionsButtons) { | |
572 [self showOptionalPageWrenchButtons]; | |
573 } | 528 } |
574 } | 529 } |
575 | 530 |
576 - (void)createBrowserActionButtons { | 531 - (void)createBrowserActionButtons { |
577 if (!browserActionsController_.get()) { | 532 if (!browserActionsController_.get()) { |
578 browserActionsController_.reset([[BrowserActionsController alloc] | 533 browserActionsController_.reset([[BrowserActionsController alloc] |
579 initWithBrowser:browser_ | 534 initWithBrowser:browser_ |
580 containerView:browserActionsContainerView_]); | 535 containerView:browserActionsContainerView_]); |
581 [[NSNotificationCenter defaultCenter] | 536 [[NSNotificationCenter defaultCenter] |
582 addObserver:self | 537 addObserver:self |
(...skipping 13 matching lines...) Expand all Loading... |
596 [[NSNotificationCenter defaultCenter] | 551 [[NSNotificationCenter defaultCenter] |
597 addObserver:self | 552 addObserver:self |
598 selector:@selector(adjustBrowserActionsContainerForNewWindow:) | 553 selector:@selector(adjustBrowserActionsContainerForNewWindow:) |
599 name:NSWindowDidBecomeKeyNotification | 554 name:NSWindowDidBecomeKeyNotification |
600 object:[[self view] window]]; | 555 object:[[self view] window]]; |
601 } | 556 } |
602 CGFloat containerWidth = [browserActionsContainerView_ isHidden] ? 0.0 : | 557 CGFloat containerWidth = [browserActionsContainerView_ isHidden] ? 0.0 : |
603 NSWidth([browserActionsContainerView_ frame]); | 558 NSWidth([browserActionsContainerView_ frame]); |
604 if (containerWidth > 0.0) | 559 if (containerWidth > 0.0) |
605 [self adjustLocationSizeBy:(containerWidth * -1) animate:NO]; | 560 [self adjustLocationSizeBy:(containerWidth * -1) animate:NO]; |
606 BOOL rightBorderShown = !([pageButton_ isHidden] && [wrenchButton_ isHidden]); | 561 // Right border should always be visible because wrench menu can no longer |
607 [browserActionsContainerView_ setRightBorderShown:rightBorderShown]; | 562 // hide. |
| 563 [browserActionsContainerView_ setRightBorderShown:YES]; |
608 } | 564 } |
609 | 565 |
610 - (void)adjustBrowserActionsContainerForNewWindow: | 566 - (void)adjustBrowserActionsContainerForNewWindow: |
611 (NSNotification*)notification { | 567 (NSNotification*)notification { |
612 [self toolbarFrameChanged]; | 568 [self toolbarFrameChanged]; |
613 [[NSNotificationCenter defaultCenter] | 569 [[NSNotificationCenter defaultCenter] |
614 removeObserver:self | 570 removeObserver:self |
615 name:NSWindowDidBecomeKeyNotification | 571 name:NSWindowDidBecomeKeyNotification |
616 object:[[self view] window]]; | 572 object:[[self view] window]]; |
617 } | 573 } |
(...skipping 14 matching lines...) Expand all Loading... |
632 | 588 |
633 - (void)browserActionsVisibilityChanged:(NSNotification*)notification { | 589 - (void)browserActionsVisibilityChanged:(NSNotification*)notification { |
634 [self pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:NO]; | 590 [self pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:NO]; |
635 } | 591 } |
636 | 592 |
637 - (void)pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:(BOOL)animate { | 593 - (void)pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:(BOOL)animate { |
638 CGFloat locationBarXPos = NSMaxX([locationBar_ frame]); | 594 CGFloat locationBarXPos = NSMaxX([locationBar_ frame]); |
639 CGFloat leftPadding; | 595 CGFloat leftPadding; |
640 | 596 |
641 if ([browserActionsContainerView_ isHidden]) { | 597 if ([browserActionsContainerView_ isHidden]) { |
642 CGFloat edgeXPos = [pageButton_ isHidden] ? | 598 CGFloat edgeXPos = [wrenchButton_ frame].origin.x; |
643 NSWidth([[locationBar_ window] frame]) : [pageButton_ frame].origin.x; | |
644 leftPadding = edgeXPos - locationBarXPos; | 599 leftPadding = edgeXPos - locationBarXPos; |
645 } else { | 600 } else { |
646 NSRect containerFrame = animate ? | 601 NSRect containerFrame = animate ? |
647 [browserActionsContainerView_ animationEndFrame] : | 602 [browserActionsContainerView_ animationEndFrame] : |
648 [browserActionsContainerView_ frame]; | 603 [browserActionsContainerView_ frame]; |
649 | 604 |
650 leftPadding = containerFrame.origin.x - locationBarXPos; | 605 leftPadding = containerFrame.origin.x - locationBarXPos; |
651 } | 606 } |
652 if (leftPadding != kBrowserActionsContainerLeftPadding) { | 607 if (leftPadding != kBrowserActionsContainerLeftPadding) { |
653 CGFloat dX = leftPadding - kBrowserActionsContainerLeftPadding; | 608 CGFloat dX = leftPadding - kBrowserActionsContainerLeftPadding; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 - (void)indicateDropURLsInView:(NSView*)view at:(NSPoint)point { | 738 - (void)indicateDropURLsInView:(NSView*)view at:(NSPoint)point { |
784 // Do nothing. | 739 // Do nothing. |
785 } | 740 } |
786 | 741 |
787 // (URLDropTargetController protocol) | 742 // (URLDropTargetController protocol) |
788 - (void)hideDropURLsIndicatorInView:(NSView*)view { | 743 - (void)hideDropURLsIndicatorInView:(NSView*)view { |
789 // Do nothing. | 744 // Do nothing. |
790 } | 745 } |
791 | 746 |
792 @end | 747 @end |
OLD | NEW |