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

Side by Side Diff: chromeos/ime/component_extension_ime_manager.h

Issue 419293002: IME refactoring: ChromeOS introduce input methods State. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unit test fixed. Re-sorted methods of StateImpl and IMM. Created 6 years, 4 months 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 CHROMEOS_IME_COMPONENT_EXTENSION_IME_MANAGER_H_ 5 #ifndef CHROMEOS_IME_COMPONENT_EXTENSION_IME_MANAGER_H_
6 #define CHROMEOS_IME_COMPONENT_EXTENSION_IME_MANAGER_H_ 6 #define CHROMEOS_IME_COMPONENT_EXTENSION_IME_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 10
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/observer_list.h" 13 #include "base/observer_list.h"
14 #include "chromeos/chromeos_export.h" 14 #include "chromeos/chromeos_export.h"
15 #include "chromeos/ime/input_method_descriptor.h" 15 #include "chromeos/ime/input_method_descriptor.h"
16 16
17 class Profile;
18
17 namespace chromeos { 19 namespace chromeos {
18 20
19 // Represents an engine in component extension IME. 21 // Represents an engine in component extension IME.
20 struct CHROMEOS_EXPORT ComponentExtensionEngine { 22 struct CHROMEOS_EXPORT ComponentExtensionEngine {
21 ComponentExtensionEngine(); 23 ComponentExtensionEngine();
22 ~ComponentExtensionEngine(); 24 ~ComponentExtensionEngine();
23 std::string engine_id; // The engine id. 25 std::string engine_id; // The engine id.
24 std::string display_name; // The display name. 26 std::string display_name; // The display name.
25 std::vector<std::string> language_codes; // The engine's language(ex. "en"). 27 std::vector<std::string> language_codes; // The engine's language(ex. "en").
26 std::string description; // The engine description. 28 std::string description; // The engine description.
(...skipping 18 matching lines...) Expand all
45 class CHROMEOS_EXPORT ComponentExtensionIMEManagerDelegate { 47 class CHROMEOS_EXPORT ComponentExtensionIMEManagerDelegate {
46 public: 48 public:
47 ComponentExtensionIMEManagerDelegate(); 49 ComponentExtensionIMEManagerDelegate();
48 virtual ~ComponentExtensionIMEManagerDelegate(); 50 virtual ~ComponentExtensionIMEManagerDelegate();
49 51
50 // Lists installed component extension IMEs. 52 // Lists installed component extension IMEs.
51 virtual std::vector<ComponentExtensionIME> ListIME() = 0; 53 virtual std::vector<ComponentExtensionIME> ListIME() = 0;
52 54
53 // Loads component extension IME associated with |extension_id|. 55 // Loads component extension IME associated with |extension_id|.
54 // Returns false if it fails, otherwise returns true. 56 // Returns false if it fails, otherwise returns true.
55 virtual bool Load(const std::string& extension_id, 57 virtual bool Load(Profile* profile,
58 const std::string& extension_id,
56 const std::string& manifest, 59 const std::string& manifest,
57 const base::FilePath& path) = 0; 60 const base::FilePath& path) = 0;
58 61
59 // Unloads component extension IME associated with |extension_id|. 62 // Unloads component extension IME associated with |extension_id|.
60 virtual void Unload(const std::string& extension_id, 63 virtual void Unload(Profile* profile,
64 const std::string& extension_id,
61 const base::FilePath& path) = 0; 65 const base::FilePath& path) = 0;
62 }; 66 };
63 67
64 // This class manages component extension input method. 68 // This class manages component extension input method.
65 class CHROMEOS_EXPORT ComponentExtensionIMEManager { 69 class CHROMEOS_EXPORT ComponentExtensionIMEManager {
66 public: 70 public:
67 ComponentExtensionIMEManager(); 71 ComponentExtensionIMEManager();
68 virtual ~ComponentExtensionIMEManager(); 72 virtual ~ComponentExtensionIMEManager();
69 73
70 // Initializes component extension manager. This function create internal 74 // Initializes component extension manager. This function create internal
71 // mapping between input method id and engine components. This function must 75 // mapping between input method id and engine components. This function must
72 // be called before using any other function. 76 // be called before using any other function.
73 void Initialize(scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate); 77 void Initialize(scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate);
74 78
75 // Loads |input_method_id| component extension IME. This function returns true 79 // Loads |input_method_id| component extension IME. This function returns true
76 // on success. This function is safe to call multiple times. Returns false if 80 // on success. This function is safe to call multiple times. Returns false if
77 // already corresponding component extension is loaded. 81 // already corresponding component extension is loaded.
78 bool LoadComponentExtensionIME(const std::string& input_method_id); 82 bool LoadComponentExtensionIME(Profile* profile,
83 const std::string& input_method_id);
79 84
80 // Unloads |input_method_id| component extension IME. This function returns 85 // Unloads |input_method_id| component extension IME. This function returns
81 // true on success. This function is safe to call multiple times. Returns 86 // true on success. This function is safe to call multiple times. Returns
82 // false if already corresponding component extension is unloaded. 87 // false if already corresponding component extension is unloaded.
83 bool UnloadComponentExtensionIME(const std::string& input_method_id); 88 bool UnloadComponentExtensionIME(Profile* profile,
89 const std::string& input_method_id);
84 90
85 // Returns true if |input_method_id| is whitelisted component extension input 91 // Returns true if |input_method_id| is whitelisted component extension input
86 // method. 92 // method.
87 bool IsWhitelisted(const std::string& input_method_id); 93 bool IsWhitelisted(const std::string& input_method_id);
88 94
89 // Returns true if |extension_id| is whitelisted component extension. 95 // Returns true if |extension_id| is whitelisted component extension.
90 bool IsWhitelistedExtension(const std::string& extension_id); 96 bool IsWhitelistedExtension(const std::string& extension_id);
91 97
92 // Returns all IME as InputMethodDescriptors. 98 // Returns all IME as InputMethodDescriptors.
93 input_method::InputMethodDescriptors GetAllIMEAsInputMethodDescriptor(); 99 input_method::InputMethodDescriptors GetAllIMEAsInputMethodDescriptor();
(...skipping 21 matching lines...) Expand all
115 std::set<std::string> input_method_id_set_; 121 std::set<std::string> input_method_id_set_;
116 122
117 std::set<std::string> login_layout_set_; 123 std::set<std::string> login_layout_set_;
118 124
119 DISALLOW_COPY_AND_ASSIGN(ComponentExtensionIMEManager); 125 DISALLOW_COPY_AND_ASSIGN(ComponentExtensionIMEManager);
120 }; 126 };
121 127
122 } // namespace chromeos 128 } // namespace chromeos
123 129
124 #endif // CHROMEOS_IME_COMPONENT_EXTENSION_IME_MANAGER_H_ 130 #endif // CHROMEOS_IME_COMPONENT_EXTENSION_IME_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698