| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_COCOA_TRANSLATE_INFOBAR_BASE_H_ | 5 #ifndef CHROME_BROWSER_COCOA_TRANSLATE_INFOBAR_BASE_H_ |
| 6 #define CHROME_BROWSER_COCOA_TRANSLATE_INFOBAR_BASE_H_ | 6 #define CHROME_BROWSER_COCOA_TRANSLATE_INFOBAR_BASE_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 #import "chrome/browser/cocoa/infobar_controller.h" | 9 #import "chrome/browser/cocoa/infobar_controller.h" |
| 10 | 10 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // Returns the delegate as a TranslateInfoBarDelegate. | 76 // Returns the delegate as a TranslateInfoBarDelegate. |
| 77 - (TranslateInfoBarDelegate*)delegate; | 77 - (TranslateInfoBarDelegate*)delegate; |
| 78 | 78 |
| 79 // Called when the "Show Original" button is pressed. | 79 // Called when the "Show Original" button is pressed. |
| 80 - (IBAction)showOriginal:(id)sender; | 80 - (IBAction)showOriginal:(id)sender; |
| 81 | 81 |
| 82 @end | 82 @end |
| 83 | 83 |
| 84 @interface TranslateInfoBarControllerBase (ProtectedAPI) | 84 @interface TranslateInfoBarControllerBase (ProtectedAPI) |
| 85 | 85 |
| 86 // Resizes or hides the options button based on how much space is available |
| 87 // so that it doesn't overlap other buttons. |
| 88 // lastView is the rightmost view, the first one that the options button |
| 89 // would overlap with. |
| 90 - (void)adjustOptionsButtonSizeAndVisibilityForView:(NSView*)lastView; |
| 91 |
| 86 // Move all the currently visible views into the correct place for the | 92 // Move all the currently visible views into the correct place for the |
| 87 // current mode. | 93 // current mode. |
| 88 // Must be implemented by the subclass. | 94 // Must be implemented by the subclass. |
| 89 - (void)layout; | 95 - (void)layout; |
| 90 | 96 |
| 91 // Loads the text for the 3 labels. There is only one message, but since | 97 // Loads the text for the 3 labels. There is only one message, but since |
| 92 // it has controls separating parts of it, it is separated into 3 separate | 98 // it has controls separating parts of it, it is separated into 3 separate |
| 93 // labels. | 99 // labels. |
| 94 // Must be implemented by the subclass. | 100 // Must be implemented by the subclass. |
| 95 - (void)loadLabelText; | 101 - (void)loadLabelText; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 111 // |newLanguageIdx| is the index of the newly selected item in the appropriate | 117 // |newLanguageIdx| is the index of the newly selected item in the appropriate |
| 112 // menu. | 118 // menu. |
| 113 - (void)sourceLanguageModified:(NSInteger)newLanguageIdx; | 119 - (void)sourceLanguageModified:(NSInteger)newLanguageIdx; |
| 114 - (void)targetLanguageModified:(NSInteger)newLanguageIdx; | 120 - (void)targetLanguageModified:(NSInteger)newLanguageIdx; |
| 115 | 121 |
| 116 // Called when an item in one of the toolbar's language or options | 122 // Called when an item in one of the toolbar's language or options |
| 117 // menus is selected. | 123 // menus is selected. |
| 118 - (void)languageMenuChanged:(id)item; | 124 - (void)languageMenuChanged:(id)item; |
| 119 - (void)optionsMenuChanged:(id)item; | 125 - (void)optionsMenuChanged:(id)item; |
| 120 | 126 |
| 121 // Teardown and rebuild the options menu. | 127 // Teardown and rebuild the options menu. When the infobar is small, the |
| 122 - (void)rebuildOptionsMenu; | 128 // options menu is shrunk to just a drop down arrow, so the title needs |
| 129 // to be empty. |
| 130 - (void)rebuildOptionsMenu:(BOOL)hideTitle; |
| 123 | 131 |
| 124 @end // TranslateInfoBarControllerBase (ProtectedAPI) | 132 @end // TranslateInfoBarControllerBase (ProtectedAPI) |
| 125 | 133 |
| 126 #pragma mark TestingAPI | 134 #pragma mark TestingAPI |
| 127 | 135 |
| 128 @interface TranslateInfoBarControllerBase (TestingAPI) | 136 @interface TranslateInfoBarControllerBase (TestingAPI) |
| 129 | 137 |
| 138 // All the controls used in any of the translate states. |
| 139 // This is used for verifying layout and for setting the |
| 140 // correct styles on each button. |
| 141 - (NSArray*)allControls; |
| 142 |
| 130 // Verifies that the layout of the infobar is correct. | 143 // Verifies that the layout of the infobar is correct. |
| 131 // Must be implmented by the subclass. | 144 // Must be implmented by the subclass. |
| 132 - (bool)verifyLayout; | 145 - (bool)verifyLayout; |
| 133 | 146 |
| 134 // Returns the underlying options menu. | 147 // Returns the underlying options menu. |
| 135 - (NSMenu*)optionsMenu; | 148 - (NSMenu*)optionsMenu; |
| 136 | 149 |
| 137 // Returns the "try again" button. | 150 // Returns the "try again" button. |
| 138 - (NSButton*)tryAgainButton; | 151 - (NSButton*)tryAgainButton; |
| 139 | 152 |
| 140 @end // TranslateInfoBarControllerBase (TestingAPI) | 153 @end // TranslateInfoBarControllerBase (TestingAPI) |
| 141 | 154 |
| 142 | 155 |
| 143 #endif // CHROME_BROWSER_COCOA_TRANSLATE_INFOBAR_BASE_H_ | 156 #endif // CHROME_BROWSER_COCOA_TRANSLATE_INFOBAR_BASE_H_ |
| OLD | NEW |