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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_COCOA_SPEECH_RECOGNITION_WINDOW_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_SPEECH_RECOGNITION_WINDOW_CONTROLLER_H_
8 #import <Cocoa/Cocoa.h>
10 #include "chrome/browser/speech/speech_recognition_bubble.h"
11 #include "chrome/browser/ui/cocoa/base_bubble_controller.h"
13 // Controller for the speech recognition bubble window. This bubble window gets
14 // displayed when the user starts speech input in a html input element.
15 @interface SpeechRecognitionWindowController
: BaseBubbleController
{
17 SpeechRecognitionBubble::Delegate
* delegate_
; // weak.
18 SpeechRecognitionBubbleBase::DisplayMode displayMode_
;
20 // References below are weak, being obtained from the nib.
21 IBOutlet NSImageView
* iconImage_
;
22 IBOutlet NSTextField
* instructionLabel_
;
23 IBOutlet NSButton
* cancelButton_
;
24 IBOutlet NSButton
* tryAgainButton_
;
25 IBOutlet NSButton
* micSettingsButton_
;
28 // Initialize the window. |anchoredAt| is in screen coordinates.
29 - (id
)initWithParentWindow
:(NSWindow
*)parentWindow
30 delegate
:(SpeechRecognitionBubbleDelegate
*)delegate
31 anchoredAt
:(NSPoint
)anchoredAt
;
33 // Handler for the cancel button.
34 - (IBAction
)cancel
:(id
)sender
;
36 // Handler for the try again button.
37 - (IBAction
)tryAgain
:(id
)sender
;
39 // Handler for the mic settings button.
40 - (IBAction
)micSettings
:(id
)sender
;
42 // Updates the UI with data related to the given display mode.
43 - (void)updateLayout
:(SpeechRecognitionBubbleBase::DisplayMode
)mode
44 messageText
:(const base::string16
&)messageText
45 iconImage
:(NSImage
*)iconImage
;
47 // Makes the speech recognition bubble visible on screen.
50 // Hides the speech recognition bubble away from screen. This does NOT release
51 // the controller and the window.
54 // Sets the image to be displayed in the bubble's status ImageView. A future
55 // call to updateLayout may change the image.
56 // TODO(satish): Clean that up and move it into the platform independent
57 // SpeechRecognitionBubbleBase class.
58 - (void)setImage
:(NSImage
*)image
;
62 #endif // CHROME_BROWSER_UI_COCOA_SPEECH_RECOGNITION_WINDOW_CONTROLLER_H_