Home | History | Annotate | Download | only in input_method
      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.
      4 //
      5 // This file implements the input method candidate window used on Chrome OS.
      6 
      7 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_CONTROLLER_H_
      8 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_CONTROLLER_H_
      9 
     10 #include "base/basictypes.h"
     11 
     12 namespace chromeos {
     13 namespace input_method {
     14 
     15 class IBusController;
     16 
     17 // CandidateWindowController is used for controlling the input method
     18 // candidate window. Once the initialization is done, the controller
     19 // starts monitoring signals sent from the the background input method
     20 // daemon, and shows and hides the candidate window as neeeded. Upon
     21 // deletion of the object, monitoring stops and the view used for
     22 // rendering the candidate view is deleted.
     23 class CandidateWindowController {
     24  public:
     25   class Observer {
     26    public:
     27     virtual ~Observer() {}
     28 
     29     virtual void CandidateWindowOpened() = 0;
     30     virtual void CandidateWindowClosed() = 0;
     31   };
     32 
     33   virtual ~CandidateWindowController() {}
     34 
     35   // Initializes the candidate window. Returns true on success. |controller| can
     36   // be NULL.
     37   // TODO(nona): Refine observer chain once IBusUiController is removed.
     38   virtual bool Init() = 0;
     39 
     40   // Shutdown the candidate window controller. |controller| can be NULL.
     41   // TODO(nona): Refine observer chain once IBusUiController is removed.
     42   virtual void Shutdown() = 0;
     43   virtual void AddObserver(Observer* observer) = 0;
     44   virtual void RemoveObserver(Observer* observer) = 0;
     45 
     46   // Gets an instance of CandidateWindowController. Caller has to delete the
     47   // returned object.
     48   static CandidateWindowController* CreateCandidateWindowController();
     49 };
     50 
     51 }  // namespace input_method
     52 }  // namespace chromeos
     53 
     54 #endif  // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_CONTROLLER_H_
     55