OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/infobars/translate_infobar_base.h" | 5 #import "chrome/browser/ui/cocoa/infobars/translate_infobar_base.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 [optionsPopUp_ setFrame:oldFrame]; | 493 [optionsPopUp_ setFrame:oldFrame]; |
494 [[optionsPopUp_ cell] setArrowPosition:NSPopUpArrowAtCenter]; | 494 [[optionsPopUp_ cell] setArrowPosition:NSPopUpArrowAtCenter]; |
495 MoveControl(closeButton_, optionsPopUp_, spaceBetweenControls_, false); | 495 MoveControl(closeButton_, optionsPopUp_, spaceBetweenControls_, false); |
496 if (!VerifyControlOrderAndSpacing(lastView, optionsPopUp_)) { | 496 if (!VerifyControlOrderAndSpacing(lastView, optionsPopUp_)) { |
497 [optionsPopUp_ setHidden:YES]; | 497 [optionsPopUp_ setHidden:YES]; |
498 } | 498 } |
499 } | 499 } |
500 } | 500 } |
501 | 501 |
502 // Called when "Translate" button is clicked. | 502 // Called when "Translate" button is clicked. |
503 - (IBAction)ok:(id)sender { | 503 - (void)ok:(id)sender { |
504 if (![self isOwned]) | 504 if (![self isOwned]) |
505 return; | 505 return; |
506 TranslateInfoBarDelegate* delegate = [self delegate]; | 506 TranslateInfoBarDelegate* delegate = [self delegate]; |
507 TranslateInfoBarDelegate::Type state = delegate->type(); | 507 TranslateInfoBarDelegate::Type state = delegate->type(); |
508 DCHECK(state == TranslateInfoBarDelegate::BEFORE_TRANSLATE || | 508 DCHECK(state == TranslateInfoBarDelegate::BEFORE_TRANSLATE || |
509 state == TranslateInfoBarDelegate::TRANSLATION_ERROR); | 509 state == TranslateInfoBarDelegate::TRANSLATION_ERROR); |
510 delegate->Translate(); | 510 delegate->Translate(); |
511 UMA_HISTOGRAM_COUNTS("Translate.Translate", 1); | 511 UMA_HISTOGRAM_COUNTS("Translate.Translate", 1); |
512 } | 512 } |
513 | 513 |
514 // Called when someone clicks on the "Nope" button. | 514 // Called when someone clicks on the "Nope" button. |
515 - (IBAction)cancel:(id)sender { | 515 - (void)cancel:(id)sender { |
516 if (![self isOwned]) | 516 if (![self isOwned]) |
517 return; | 517 return; |
518 TranslateInfoBarDelegate* delegate = [self delegate]; | 518 TranslateInfoBarDelegate* delegate = [self delegate]; |
519 DCHECK(delegate->type() == TranslateInfoBarDelegate::BEFORE_TRANSLATE); | 519 DCHECK(delegate->type() == TranslateInfoBarDelegate::BEFORE_TRANSLATE); |
520 delegate->TranslationDeclined(); | 520 delegate->TranslationDeclined(); |
521 UMA_HISTOGRAM_COUNTS("Translate.DeclineTranslate", 1); | 521 UMA_HISTOGRAM_COUNTS("Translate.DeclineTranslate", 1); |
522 [super removeSelf]; | 522 [super removeSelf]; |
523 } | 523 } |
524 | 524 |
525 - (void)messageButtonPressed:(id)sender { | 525 - (void)messageButtonPressed:(id)sender { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 [[control description] UTF8String] <<[title UTF8String]; | 651 [[control description] UTF8String] <<[title UTF8String]; |
652 return false; | 652 return false; |
653 } | 653 } |
654 previousControl = control; | 654 previousControl = control; |
655 } | 655 } |
656 | 656 |
657 return true; | 657 return true; |
658 } | 658 } |
659 | 659 |
660 @end // TranslateInfoBarControllerBase (TestingAPI) | 660 @end // TranslateInfoBarControllerBase (TestingAPI) |
OLD | NEW |