OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/cocoa/extensions/browser_actions_controller.h" | 5 #import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 [item setTarget:self]; | 412 [item setTarget:self]; |
413 [item setEnabled:[button isEnabled]]; | 413 [item setEnabled:[button isEnabled]]; |
414 } | 414 } |
415 } | 415 } |
416 | 416 |
417 #pragma mark - | 417 #pragma mark - |
418 #pragma mark Private Methods | 418 #pragma mark Private Methods |
419 | 419 |
420 - (void)addViewForAction:(ToolbarActionViewController*)action | 420 - (void)addViewForAction:(ToolbarActionViewController*)action |
421 withIndex:(NSUInteger)index { | 421 withIndex:(NSUInteger)index { |
422 NSRect buttonFrame = NSMakeRect(0.0, | 422 NSRect buttonFrame = NSMakeRect(NSMaxX([containerView_ bounds]), |
423 kBrowserActionOriginYOffset, | 423 kBrowserActionOriginYOffset, |
424 ToolbarActionsBar::IconWidth(false), | 424 ToolbarActionsBar::IconWidth(false), |
425 ToolbarActionsBar::IconHeight()); | 425 ToolbarActionsBar::IconHeight()); |
426 BrowserActionButton* newButton = | 426 BrowserActionButton* newButton = |
427 [[[BrowserActionButton alloc] | 427 [[[BrowserActionButton alloc] |
428 initWithFrame:buttonFrame | 428 initWithFrame:buttonFrame |
429 viewController:action | 429 viewController:action |
430 controller:self] autorelease]; | 430 controller:self] autorelease]; |
431 [newButton setTarget:self]; | 431 [newButton setTarget:self]; |
432 [newButton setAction:@selector(browserActionClicked:)]; | 432 [newButton setAction:@selector(browserActionClicked:)]; |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 | 759 |
760 - (BrowserActionButton*)buttonWithIndex:(NSUInteger)index { | 760 - (BrowserActionButton*)buttonWithIndex:(NSUInteger)index { |
761 const std::vector<ToolbarActionViewController*>& toolbar_actions = | 761 const std::vector<ToolbarActionViewController*>& toolbar_actions = |
762 toolbarActionsBar_->toolbar_actions(); | 762 toolbarActionsBar_->toolbar_actions(); |
763 if (index < toolbar_actions.size()) | 763 if (index < toolbar_actions.size()) |
764 return [self buttonForId:toolbar_actions[index]->GetId()]; | 764 return [self buttonForId:toolbar_actions[index]->GetId()]; |
765 return nil; | 765 return nil; |
766 } | 766 } |
767 | 767 |
768 @end | 768 @end |
OLD | NEW |