OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ios/chrome/browser/ui/toolbar/toolbar_controller.h" | 5 #import "ios/chrome/browser/ui/toolbar/toolbar_controller.h" |
6 | 6 |
7 #include <QuartzCore/QuartzCore.h> | 7 #include <QuartzCore/QuartzCore.h> |
8 | 8 |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 @end | 242 @end |
243 | 243 |
244 @implementation ToolbarController | 244 @implementation ToolbarController |
245 | 245 |
246 @synthesize readingListModel = readingListModel_; | 246 @synthesize readingListModel = readingListModel_; |
247 @synthesize view = view_; | 247 @synthesize view = view_; |
248 @synthesize backgroundView = backgroundView_; | 248 @synthesize backgroundView = backgroundView_; |
249 @synthesize shadowView = shadowView_; | 249 @synthesize shadowView = shadowView_; |
250 @synthesize toolsPopupController = toolsPopupController_; | 250 @synthesize toolsPopupController = toolsPopupController_; |
251 @synthesize style = style_; | 251 @synthesize style = style_; |
| 252 @synthesize dispatcher = dispatcher_; |
252 | 253 |
253 - (void)setReadingListModel:(ReadingListModel*)readingListModel { | 254 - (void)setReadingListModel:(ReadingListModel*)readingListModel { |
254 readingListModel_ = readingListModel; | 255 readingListModel_ = readingListModel; |
255 if (readingListModel_) { | 256 if (readingListModel_) { |
256 toolsMenuButtonObserverBridge_ = | 257 toolsMenuButtonObserverBridge_ = |
257 [[ToolsMenuButtonObserverBridge alloc] initWithModel:readingListModel_ | 258 [[ToolsMenuButtonObserverBridge alloc] initWithModel:readingListModel_ |
258 toolbarButton:toolsMenuButton_]; | 259 toolbarButton:toolsMenuButton_]; |
259 } | 260 } |
260 } | 261 } |
261 | 262 |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 if (button != toolsMenuButton_) { | 552 if (button != toolsMenuButton_) { |
552 // |target| must be |self| (as opposed to |nil|) because |self| isn't in the | 553 // |target| must be |self| (as opposed to |nil|) because |self| isn't in the |
553 // responder chain. | 554 // responder chain. |
554 [button addTarget:self | 555 [button addTarget:self |
555 action:@selector(standardButtonPressed:) | 556 action:@selector(standardButtonPressed:) |
556 forControlEvents:UIControlEventTouchUpInside]; | 557 forControlEvents:UIControlEventTouchUpInside]; |
557 } | 558 } |
558 [button addTarget:self | 559 [button addTarget:self |
559 action:@selector(recordUserMetrics:) | 560 action:@selector(recordUserMetrics:) |
560 forControlEvents:UIControlEventTouchUpInside]; | 561 forControlEvents:UIControlEventTouchUpInside]; |
561 [button addTarget:button | 562 // Only register buttons with defined tags for -chromeExecuteCommand: |
562 action:@selector(chromeExecuteCommand:) | 563 if (button.tag) { |
563 forControlEvents:UIControlEventTouchUpInside]; | 564 [button addTarget:button |
| 565 action:@selector(chromeExecuteCommand:) |
| 566 forControlEvents:UIControlEventTouchUpInside]; |
| 567 } |
564 } | 568 } |
565 | 569 |
566 - (CGRect)shareButtonAnchorRect { | 570 - (CGRect)shareButtonAnchorRect { |
567 // Shrink the padding around the shareButton so the popovers are anchored | 571 // Shrink the padding around the shareButton so the popovers are anchored |
568 // correctly. | 572 // correctly. |
569 return CGRectInset([shareButton_ bounds], 10, 0); | 573 return CGRectInset([shareButton_ bounds], 10, 0); |
570 } | 574 } |
571 | 575 |
572 - (UIView*)shareButtonView { | 576 - (UIView*)shareButtonView { |
573 return shareButton_; | 577 return shareButton_; |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 #pragma mark - | 1037 #pragma mark - |
1034 #pragma mark PopupMenuDelegate methods. | 1038 #pragma mark PopupMenuDelegate methods. |
1035 | 1039 |
1036 - (void)dismissPopupMenu:(PopupMenuController*)controller { | 1040 - (void)dismissPopupMenu:(PopupMenuController*)controller { |
1037 if ([controller isKindOfClass:[ToolsPopupController class]] && | 1041 if ([controller isKindOfClass:[ToolsPopupController class]] && |
1038 (ToolsPopupController*)controller == toolsPopupController_) | 1042 (ToolsPopupController*)controller == toolsPopupController_) |
1039 [self dismissToolsMenuPopup]; | 1043 [self dismissToolsMenuPopup]; |
1040 } | 1044 } |
1041 | 1045 |
1042 @end | 1046 @end |
OLD | NEW |