diff options
Diffstat (limited to 'chrome/browser/cocoa/translate_infobar.h')
-rw-r--r-- | chrome/browser/cocoa/translate_infobar.h | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/chrome/browser/cocoa/translate_infobar.h b/chrome/browser/cocoa/translate_infobar.h index 2c43c3a..29536c8 100644 --- a/chrome/browser/cocoa/translate_infobar.h +++ b/chrome/browser/cocoa/translate_infobar.h @@ -11,6 +11,7 @@ #include "chrome/browser/translate/options_menu_model.h" #include "chrome/browser/translate/translate_infobars_delegates.h" #include "chrome/common/notification_registrar.h" +#include "chrome/common/translate_errors.h" class TranslateInfoBarMenuModel; class TranslateNotificationObserverBridge; @@ -33,13 +34,26 @@ class TranslateNotificationObserverBridge; // is only visible in certain locales). @interface TranslateInfoBarController : InfoBarController { @protected - // label_ is defined in InfoBarController. + // Infobar keeps track of the state it is displaying, which should match that + // in the TranslateInfoBarDelegate. UI needs to keep track separately because + // infobar may receive PAGE_TRANSLATED notifications before delegate does, in + // which case, delegate's state is not updated and hence can't be used to + // update display. After the notification is sent out to all observers, both + // infobar and delegate would end up with the same state. + TranslateInfoBarDelegate::TranslateState state_; + + // Is a translation currently in progress. + bool translationPending_; + + scoped_nsobject<NSTextField> label1_; scoped_nsobject<NSTextField> label2_; scoped_nsobject<NSTextField> label3_; scoped_nsobject<NSTextField> translatingLabel_; scoped_nsobject<NSPopUpButton> fromLanguagePopUp_; scoped_nsobject<NSPopUpButton> toLanguagePopUp_; scoped_nsobject<NSPopUpButton> optionsPopUp_; + scoped_nsobject<NSButton> showOriginalButton_; + scoped_nsobject<NSButton> tryAgainButton_; // In the current locale, are the "from" and "to" language popup menu // flipped from what they'd appear in English. @@ -56,6 +70,9 @@ class TranslateNotificationObserverBridge; scoped_ptr<TranslateNotificationObserverBridge> observer_bridge_; } +// Called when the "Show Original" button is pressed. +- (IBAction)showOriginal:(id)sender; + @end @interface TranslateInfoBarController (TestingAPI) @@ -64,7 +81,10 @@ class TranslateNotificationObserverBridge; // the state has changed. // Controls are moved around as needed and visibility changed to match the // current state. -- (void)updateState; +- (void)updateState:(TranslateInfoBarDelegate::TranslateState)newState + translationPending:(bool)newTranslationPending + error:(TranslateErrors::Type)error; + // Called when the source or target language selection changes in a menu. // |newLanguageIdx| is the index of the newly selected item in the appropriate @@ -78,8 +98,15 @@ class TranslateNotificationObserverBridge; // Returns the underlying options menu. - (NSMenu*)optionsMenu; +// Returns the "try again" button. +- (NSButton*)tryAgainButton; + +// The TranslateInfoBarController's internal idea of the current state. +- (TranslateInfoBarDelegate::TranslateState)state; + // Verifies that the layout of the infobar is correct for |state|. -- (bool)verifyLayout:(TranslateInfoBarDelegate::TranslateState)state; +- (bool)verifyLayout:(TranslateInfoBarDelegate::TranslateState)state + translationPending:(bool)translationPending; // Teardown and rebuild the options menu. - (void)rebuildOptionsMenu; |