Revert 168224 - Update V8 to version 3.15.4.
[chromium-blink-merge.git] / chrome / browser / chromeos / input_method / ibus_controller_base.h
blobd95b0ea7a2f308344bdc214cf28a80c0cf960800
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_CHROMEOS_INPUT_METHOD_IBUS_CONTROLLER_BASE_H_
6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_CONTROLLER_BASE_H_
8 #include <map>
9 #include <utility>
11 #include "base/observer_list.h"
12 #include "chrome/browser/chromeos/input_method/ibus_controller.h"
13 #include "chrome/browser/chromeos/input_method/input_method_config.h"
14 #include "chrome/browser/chromeos/input_method/input_method_property.h"
16 namespace chromeos {
17 namespace input_method {
19 // The common implementation of the IBusController. This file does not depend on
20 // libibus, hence is unit-testable.
21 class IBusControllerBase : public IBusController {
22 public:
23 IBusControllerBase();
24 virtual ~IBusControllerBase();
26 // IBusController overrides. Derived classes should not override these 4
27 // functions.
28 virtual void AddObserver(Observer* observer) OVERRIDE;
29 virtual void RemoveObserver(Observer* observer) OVERRIDE;
30 virtual bool SetInputMethodConfig(
31 const std::string& section,
32 const std::string& config_name,
33 const InputMethodConfigValue& value) OVERRIDE;
34 virtual const InputMethodPropertyList& GetCurrentProperties() const OVERRIDE;
36 // Gets the current input method configuration.
37 bool GetInputMethodConfigForTesting(const std::string& section,
38 const std::string& config_name,
39 InputMethodConfigValue* out_value);
41 // Notifies all |observers_|.
42 void NotifyPropertyChangedForTesting();
44 // Updates |current_property_list_|.
45 void SetCurrentPropertiesForTesting(
46 const InputMethodPropertyList& current_property_list);
48 protected:
49 typedef std::pair<std::string, std::string> ConfigKeyType;
50 typedef std::map<
51 ConfigKeyType, InputMethodConfigValue> InputMethodConfigRequests;
53 virtual bool SetInputMethodConfigInternal(
54 const ConfigKeyType& key,
55 const InputMethodConfigValue& value) = 0;
57 ObserverList<Observer> observers_;
59 // Values that have been set via SetInputMethodConfig(). We keep a copy
60 // available to (re)send when the system input method framework (re)starts.
61 InputMethodConfigRequests current_config_values_;
63 // The value which will be returned by GetCurrentProperties(). Derived classes
64 // should update this variable when needed.
65 InputMethodPropertyList current_property_list_;
67 DISALLOW_COPY_AND_ASSIGN(IBusControllerBase);
70 } // namespace input_method
71 } // namespace chromeos
73 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_CONTROLLER_BASE_H_