| 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 #import "speech_input_window_controller.h" | 5 #import "speech_input_window_controller.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/mac_util.h" | 9 #include "base/mac_util.h" |
| 10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 windowDelta = [[window contentView] convertSize:windowDelta toView:nil]; | 56 windowDelta = [[window contentView] convertSize:windowDelta toView:nil]; |
| 57 NSRect newFrame = [window frame]; | 57 NSRect newFrame = [window frame]; |
| 58 newFrame.size.width += windowDelta.width; | 58 newFrame.size.width += windowDelta.width; |
| 59 newFrame.size.height += windowDelta.height; | 59 newFrame.size.height += windowDelta.height; |
| 60 [window setFrame:newFrame display:NO]; | 60 [window setFrame:newFrame display:NO]; |
| 61 | 61 |
| 62 [self layout:newSize]; // Layout all the child controls. | 62 [self layout:newSize]; // Layout all the child controls. |
| 63 } | 63 } |
| 64 | 64 |
| 65 - (IBAction)cancel:(id)sender { | 65 - (IBAction)cancel:(id)sender { |
| 66 delegate_->RecognitionCancelled(); | 66 delegate_->InfoBubbleButtonClicked(SpeechInputBubble::BUTTON_CANCEL); |
| 67 } | 67 } |
| 68 | 68 |
| 69 // Calculate the window dimensions to reflect the sum height and max width of | 69 // Calculate the window dimensions to reflect the sum height and max width of |
| 70 // all controls, with appropriate spacing between and around them. The returned | 70 // all controls, with appropriate spacing between and around them. The returned |
| 71 // size is in view coordinates. | 71 // size is in view coordinates. |
| 72 - (NSSize)calculateContentSize { | 72 - (NSSize)calculateContentSize { |
| 73 [GTMUILocalizerAndLayoutTweaker sizeToFitView:cancelButton_]; | 73 [GTMUILocalizerAndLayoutTweaker sizeToFitView:cancelButton_]; |
| 74 NSSize size = [cancelButton_ bounds].size; | 74 NSSize size = [cancelButton_ bounds].size; |
| 75 int newHeight = size.height + kBubbleControlVerticalSpacing; | 75 int newHeight = size.height + kBubbleControlVerticalSpacing; |
| 76 int newWidth = size.width; | 76 int newWidth = size.width; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } | 116 } |
| 117 | 117 |
| 118 - (void)didStartRecognition { | 118 - (void)didStartRecognition { |
| 119 NSImage* icon = ResourceBundle::GetSharedInstance().GetNSImageNamed( | 119 NSImage* icon = ResourceBundle::GetSharedInstance().GetNSImageNamed( |
| 120 IDR_SPEECH_INPUT_PROCESSING); | 120 IDR_SPEECH_INPUT_PROCESSING); |
| 121 [iconImage_ setImage:icon]; | 121 [iconImage_ setImage:icon]; |
| 122 [iconImage_ setNeedsDisplay:YES]; | 122 [iconImage_ setNeedsDisplay:YES]; |
| 123 } | 123 } |
| 124 | 124 |
| 125 - (void)windowWillClose:(NSNotification*)notification { | 125 - (void)windowWillClose:(NSNotification*)notification { |
| 126 delegate_->InfoBubbleClosed(); | 126 delegate_->InfoBubbleFocusChanged(); |
| 127 } | 127 } |
| 128 | 128 |
| 129 @end // implementation SpeechInputWindowController | 129 @end // implementation SpeechInputWindowController |
| OLD | NEW |