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/web_toolbar_controller.h" | 5 #import "ios/chrome/browser/ui/toolbar/web_toolbar_controller.h" |
6 | 6 |
7 #import <CoreLocation/CoreLocation.h> | 7 #import <CoreLocation/CoreLocation.h> |
8 #include <QuartzCore/QuartzCore.h> | 8 #include <QuartzCore/QuartzCore.h> |
9 | 9 |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 } | 477 } |
478 } | 478 } |
479 | 479 |
480 [_webToolbar addSubview:_omniBox]; | 480 [_webToolbar addSubview:_omniBox]; |
481 | 481 |
482 [_backButton setEnabled:NO]; | 482 [_backButton setEnabled:NO]; |
483 [_forwardButton setEnabled:NO]; | 483 [_forwardButton setEnabled:NO]; |
484 | 484 |
485 // Assign tags before calling -setUpButton, since only buttons with tags | 485 // Assign tags before calling -setUpButton, since only buttons with tags |
486 // have -chromeExecuteCommand added as a target. | 486 // have -chromeExecuteCommand added as a target. |
487 [_reloadButton setTag:IDC_RELOAD]; | |
488 [_stopButton setTag:IDC_STOP]; | |
489 [_starButton setTag:IDC_BOOKMARK_PAGE]; | 487 [_starButton setTag:IDC_BOOKMARK_PAGE]; |
490 [_voiceSearchButton setTag:IDC_VOICE_SEARCH]; | 488 [_voiceSearchButton setTag:IDC_VOICE_SEARCH]; |
491 | 489 |
492 if (idiom == IPAD_IDIOM) { | 490 if (idiom == IPAD_IDIOM) { |
493 // Note that the reload button gets repositioned when -layoutOmnibox is | 491 // Note that the reload button gets repositioned when -layoutOmnibox is |
494 // called. | 492 // called. |
495 _reloadButton = [[UIButton alloc] | 493 _reloadButton = [[UIButton alloc] |
496 initWithFrame:LayoutRectGetRect(kStopReloadButtonFrame)]; | 494 initWithFrame:LayoutRectGetRect(kStopReloadButtonFrame)]; |
497 [_reloadButton | 495 [_reloadButton |
498 setAutoresizingMask:UIViewAutoresizingFlexibleTrailingMargin() | | 496 setAutoresizingMask:UIViewAutoresizingFlexibleTrailingMargin() | |
(...skipping 30 matching lines...) Expand all Loading... |
529 withImageEnum:WebToolbarButtonNameStop | 527 withImageEnum:WebToolbarButtonNameStop |
530 forInitialState:UIControlStateDisabled | 528 forInitialState:UIControlStateDisabled |
531 hasDisabledImage:YES | 529 hasDisabledImage:YES |
532 synchronously:NO]; | 530 synchronously:NO]; |
533 [self setUpButton:_reloadButton | 531 [self setUpButton:_reloadButton |
534 withImageEnum:WebToolbarButtonNameReload | 532 withImageEnum:WebToolbarButtonNameReload |
535 forInitialState:UIControlStateNormal | 533 forInitialState:UIControlStateNormal |
536 hasDisabledImage:YES | 534 hasDisabledImage:YES |
537 synchronously:NO]; | 535 synchronously:NO]; |
538 [_stopButton setHidden:YES]; | 536 [_stopButton setHidden:YES]; |
| 537 |
| 538 // Assign targets for buttons using the dispatcher. |
| 539 [_stopButton addTarget:self.dispatcher |
| 540 action:@selector(stopLoading) |
| 541 forControlEvents:UIControlEventTouchUpInside]; |
| 542 [_reloadButton addTarget:self.dispatcher |
| 543 action:@selector(reload) |
| 544 forControlEvents:UIControlEventTouchUpInside]; |
539 } else { | 545 } else { |
540 [_forwardButton setAlpha:0.0]; | 546 [_forwardButton setAlpha:0.0]; |
541 } | 547 } |
542 | 548 |
543 // Set up the button images and omnibox background. | 549 // Set up the button images and omnibox background. |
544 [self setUpButton:_backButton | 550 [self setUpButton:_backButton |
545 withImageEnum:WebToolbarButtonNameBack | 551 withImageEnum:WebToolbarButtonNameBack |
546 forInitialState:UIControlStateDisabled | 552 forInitialState:UIControlStateDisabled |
547 hasDisabledImage:YES | 553 hasDisabledImage:YES |
548 synchronously:NO]; | 554 synchronously:NO]; |
(...skipping 1941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2490 | 2496 |
2491 - (BOOL)isPrerenderAnimationRunning { | 2497 - (BOOL)isPrerenderAnimationRunning { |
2492 return _prerenderAnimating; | 2498 return _prerenderAnimating; |
2493 } | 2499 } |
2494 | 2500 |
2495 - (OmniboxTextFieldIOS*)omnibox { | 2501 - (OmniboxTextFieldIOS*)omnibox { |
2496 return _omniBox; | 2502 return _omniBox; |
2497 } | 2503 } |
2498 | 2504 |
2499 @end | 2505 @end |
OLD | NEW |