| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "speech_recognition_window_controller.h" | 5 #import "speech_recognition_window_controller.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
| 9 #include "chrome/browser/ui/cocoa/info_bubble_view.h" | 9 #include "chrome/browser/ui/cocoa/info_bubble_view.h" |
| 10 #include "grit/generated_resources.h" | 10 #include "grit/generated_resources.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // recording mode, so from warm up it can transition to recording without any | 81 // recording mode, so from warm up it can transition to recording without any |
| 82 // UI jank. | 82 // UI jank. |
| 83 bool isWarmUp = (displayMode_ == | 83 bool isWarmUp = (displayMode_ == |
| 84 SpeechRecognitionBubbleBase::DISPLAY_MODE_WARM_UP); | 84 SpeechRecognitionBubbleBase::DISPLAY_MODE_WARM_UP); |
| 85 | 85 |
| 86 if (![iconImage_ isHidden]) { | 86 if (![iconImage_ isHidden]) { |
| 87 NSSize size = [[iconImage_ image] size]; | 87 NSSize size = [[iconImage_ image] size]; |
| 88 if (isWarmUp) { | 88 if (isWarmUp) { |
| 89 NSImage* volumeIcon = | 89 NSImage* volumeIcon = |
| 90 ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 90 ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
| 91 IDR_SPEECH_INPUT_MIC_EMPTY); | 91 IDR_SPEECH_INPUT_MIC_EMPTY).ToNSImage(); |
| 92 size = [volumeIcon size]; | 92 size = [volumeIcon size]; |
| 93 } | 93 } |
| 94 newHeight += size.height; | 94 newHeight += size.height; |
| 95 newWidth = std::max(newWidth, size.width + 2 * kBubbleHorizontalMargin); | 95 newWidth = std::max(newWidth, size.width + 2 * kBubbleHorizontalMargin); |
| 96 } | 96 } |
| 97 | 97 |
| 98 if (![instructionLabel_ isHidden] || isWarmUp) { | 98 if (![instructionLabel_ isHidden] || isWarmUp) { |
| 99 [instructionLabel_ sizeToFit]; | 99 [instructionLabel_ sizeToFit]; |
| 100 NSSize textSize = [[instructionLabel_ cell] cellSize]; | 100 NSSize textSize = [[instructionLabel_ cell] cellSize]; |
| 101 NSRect boundsRect = NSMakeRect(0, 0, kInstructionLabelMaxWidth, | 101 NSRect boundsRect = NSMakeRect(0, 0, kInstructionLabelMaxWidth, |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 | 223 |
| 224 - (void)hide { | 224 - (void)hide { |
| 225 [[self window] orderOut:nil]; | 225 [[self window] orderOut:nil]; |
| 226 } | 226 } |
| 227 | 227 |
| 228 - (void)setImage:(NSImage*)image { | 228 - (void)setImage:(NSImage*)image { |
| 229 [iconImage_ setImage:image]; | 229 [iconImage_ setImage:image]; |
| 230 } | 230 } |
| 231 | 231 |
| 232 @end // implementation SpeechRecognitionWindowController | 232 @end // implementation SpeechRecognitionWindowController |
| OLD | NEW |