Home | History | Annotate | Download | only in cocoa
      1 // Copyright (c) 2011 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.
      4 
      5 #ifndef CHROME_BROWSER_UI_COCOA_SPEECH_INPUT_WINDOW_CONTROLLER_H_
      6 #define CHROME_BROWSER_UI_COCOA_SPEECH_INPUT_WINDOW_CONTROLLER_H_
      7 #pragma once
      8 
      9 #import <Cocoa/Cocoa.h>
     10 
     11 #include "chrome/browser/speech/speech_input_bubble.h"
     12 #include "chrome/browser/ui/cocoa/base_bubble_controller.h"
     13 
     14 // Controller for the speech input bubble window. This bubble window gets
     15 // displayed when the user starts speech input in a html input element.
     16 @interface SpeechInputWindowController : BaseBubbleController {
     17  @private
     18   SpeechInputBubble::Delegate* delegate_;  // weak.
     19   SpeechInputBubbleBase::DisplayMode displayMode_;
     20 
     21   // References below are weak, being obtained from the nib.
     22   IBOutlet NSImageView* iconImage_;
     23   IBOutlet NSTextField* instructionLabel_;
     24   IBOutlet NSButton* cancelButton_;
     25   IBOutlet NSButton* tryAgainButton_;
     26   IBOutlet NSButton* micSettingsButton_;
     27 }
     28 
     29 // Initialize the window. |anchoredAt| is in screen coordinates.
     30 - (id)initWithParentWindow:(NSWindow*)parentWindow
     31                   delegate:(SpeechInputBubbleDelegate*)delegate
     32                 anchoredAt:(NSPoint)anchoredAt;
     33 
     34 // Handler for the cancel button.
     35 - (IBAction)cancel:(id)sender;
     36 
     37 // Handler for the try again button.
     38 - (IBAction)tryAgain:(id)sender;
     39 
     40 // Handler for the mic settings button.
     41 - (IBAction)micSettings:(id)sender;
     42 
     43 // Updates the UI with data related to the given display mode.
     44 - (void)updateLayout:(SpeechInputBubbleBase::DisplayMode)mode
     45          messageText:(const string16&)messageText
     46            iconImage:(NSImage*)iconImage;
     47 
     48 // Makes the speech input bubble visible on screen.
     49 - (void)show;
     50 
     51 // Hides the speech input bubble away from screen. This does NOT release the
     52 // controller and the window.
     53 - (void)hide;
     54 
     55 // Sets the image to be displayed in the bubble's status ImageView. A future
     56 // call to updateLayout may change the image.
     57 // TODO(satish): Clean that up and move it into the platform independent
     58 // SpeechInputBubbleBase class.
     59 - (void)setImage:(NSImage*)image;
     60 
     61 @end
     62 
     63 #endif  // CHROME_BROWSER_UI_COCOA_SPEECH_INPUT_WINDOW_CONTROLLER_H_
     64