Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: chrome/browser/chromeos/cros/input_method_library.h

Issue 4162002: Reduce CPU usage for input method switching. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review fix Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chromeos/cros/input_method_library.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_CHROMEOS_CROS_INPUT_METHOD_LIBRARY_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_INPUT_METHOD_LIBRARY_H_
6 #define CHROME_BROWSER_CHROMEOS_CROS_INPUT_METHOD_LIBRARY_H_ 6 #define CHROME_BROWSER_CHROMEOS_CROS_INPUT_METHOD_LIBRARY_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/observer_list.h" 12 #include "base/observer_list.h"
13 #include "base/time.h" 13 #include "base/time.h"
14 #include "base/timer.h" 14 #include "base/timer.h"
15 #include "cros/chromeos_input_method.h" 15 #include "cros/chromeos_input_method.h"
16 16
17 namespace chromeos { 17 namespace chromeos {
18 18
19 // This class handles the interaction with the ChromeOS language library APIs. 19 // This class handles the interaction with the ChromeOS language library APIs.
20 // Classes can add themselves as observers. Users can get an instance of this 20 // Classes can add themselves as observers. Users can get an instance of this
21 // library class like this: 21 // library class like this:
22 // chromeos::CrosLibrary::Get()->GetInputMethodLibrary() 22 // chromeos::CrosLibrary::Get()->GetInputMethodLibrary()
23 class InputMethodLibrary { 23 class InputMethodLibrary {
24 public: 24 public:
25 class Observer { 25 class Observer {
26 public: 26 public:
27 virtual ~Observer() = 0; 27 virtual ~Observer() = 0;
28 // Called when the current input method is changed. 28 // Called when the current input method is changed.
29 virtual void InputMethodChanged(InputMethodLibrary* obj) = 0; 29 virtual void InputMethodChanged(
30 30 InputMethodLibrary* obj,
31 // Called when input method properties (see chromeos_input_method.h 31 const InputMethodDescriptor& previous_input_method,
32 // for details) are changed. 32 const InputMethodDescriptor& current_input_method,
33 virtual void ImePropertiesChanged(InputMethodLibrary* obj) = 0; 33 size_t num_active_input_methods) = 0;
34 34
35 // Called when the active input methods are changed. 35 // Called when the active input methods are changed.
36 virtual void ActiveInputMethodsChanged(InputMethodLibrary* obj) = 0; 36 virtual void ActiveInputMethodsChanged(
37 InputMethodLibrary* obj,
38 const InputMethodDescriptor& current_input_method,
39 size_t num_active_input_methods) = 0;
40
41 // Called when the preferences have to be updated.
42 virtual void PreferenceUpdateNeeded(
43 InputMethodLibrary* obj,
44 const InputMethodDescriptor& previous_input_method,
45 const InputMethodDescriptor& current_input_method) = 0;
37 }; 46 };
38 virtual ~InputMethodLibrary() {} 47 virtual ~InputMethodLibrary() {}
39 48
40 // Adds an observer to receive notifications of input method related 49 // Adds an observer to receive notifications of input method related
41 // changes as desribed in the Observer class above. 50 // changes as desribed in the Observer class above.
42 virtual void AddObserver(Observer* observer) = 0; 51 virtual void AddObserver(Observer* observer) = 0;
43 virtual void RemoveObserver(Observer* observer) = 0; 52 virtual void RemoveObserver(Observer* observer) = 0;
44 53
45 // Returns the list of input methods we can select (i.e. active). If the cros 54 // Returns the list of input methods we can select (i.e. active). If the cros
46 // library is not found or IBus/DBus daemon is not alive, this function 55 // library is not found or IBus/DBus daemon is not alive, this function
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 virtual const ImePropertyList& current_ime_properties() const = 0; 122 virtual const ImePropertyList& current_ime_properties() const = 0;
114 123
115 // Factory function, creates a new instance and returns ownership. 124 // Factory function, creates a new instance and returns ownership.
116 // For normal usage, access the singleton via CrosLibrary::Get(). 125 // For normal usage, access the singleton via CrosLibrary::Get().
117 static InputMethodLibrary* GetImpl(bool stub); 126 static InputMethodLibrary* GetImpl(bool stub);
118 }; 127 };
119 128
120 } // namespace chromeos 129 } // namespace chromeos
121 130
122 #endif // CHROME_BROWSER_CHROMEOS_CROS_INPUT_METHOD_LIBRARY_H_ 131 #endif // CHROME_BROWSER_CHROMEOS_CROS_INPUT_METHOD_LIBRARY_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/cros/input_method_library.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698