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

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: Cleanup. 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 <set> 8 #include <set>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/observer_list.h" 12 #include "base/observer_list.h"
13 #include "chromeos/chromeos_export.h" 13 #include "chromeos/chromeos_export.h"
14 #include "chromeos/ime/input_method_descriptor.h" 14 #include "chromeos/ime/input_method_descriptor.h"
15 15
16 class Profile;
17
16 namespace chromeos { 18 namespace chromeos {
17 19
18 // Represents an engine in component extension IME. 20 // Represents an engine in component extension IME.
19 struct CHROMEOS_EXPORT ComponentExtensionEngine { 21 struct CHROMEOS_EXPORT ComponentExtensionEngine {
20 ComponentExtensionEngine(); 22 ComponentExtensionEngine();
21 ~ComponentExtensionEngine(); 23 ~ComponentExtensionEngine();
22 std::string engine_id; // The engine id. 24 std::string engine_id; // The engine id.
23 std::string display_name; // The display name. 25 std::string display_name; // The display name.
24 std::vector<std::string> language_codes; // The engine's language(ex. "en"). 26 std::vector<std::string> language_codes; // The engine's language(ex. "en").
25 std::string description; // The engine description. 27 std::string description; // The engine description.
(...skipping 18 matching lines...) Expand all
44 class CHROMEOS_EXPORT ComponentExtensionIMEManagerDelegate { 46 class CHROMEOS_EXPORT ComponentExtensionIMEManagerDelegate {
45 public: 47 public:
46 ComponentExtensionIMEManagerDelegate(); 48 ComponentExtensionIMEManagerDelegate();
47 virtual ~ComponentExtensionIMEManagerDelegate(); 49 virtual ~ComponentExtensionIMEManagerDelegate();
48 50
49 // Lists installed component extension IMEs. 51 // Lists installed component extension IMEs.
50 virtual std::vector<ComponentExtensionIME> ListIME() = 0; 52 virtual std::vector<ComponentExtensionIME> ListIME() = 0;
51 53
52 // Loads component extension IME associated with |extension_id|. 54 // Loads component extension IME associated with |extension_id|.
53 // Returns false if it fails, otherwise returns true. 55 // Returns false if it fails, otherwise returns true.
54 virtual bool Load(const std::string& extension_id, 56 virtual bool Load(Profile* profile,
57 const std::string& extension_id,
55 const std::string& manifest, 58 const std::string& manifest,
56 const base::FilePath& path) = 0; 59 const base::FilePath& path) = 0;
57 60
58 // Unloads component extension IME associated with |extension_id|. 61 // Unloads component extension IME associated with |extension_id|.
59 virtual void Unload(const std::string& extension_id, 62 virtual void Unload(Profile* profile,
63 const std::string& extension_id,
60 const base::FilePath& path) = 0; 64 const base::FilePath& path) = 0;
61 }; 65 };
62 66
63 // This class manages component extension input method. 67 // This class manages component extension input method.
64 class CHROMEOS_EXPORT ComponentExtensionIMEManager { 68 class CHROMEOS_EXPORT ComponentExtensionIMEManager {
65 public: 69 public:
66 ComponentExtensionIMEManager(); 70 ComponentExtensionIMEManager();
67 virtual ~ComponentExtensionIMEManager(); 71 virtual ~ComponentExtensionIMEManager();
68 72
69 // Initializes component extension manager. This function create internal 73 // Initializes component extension manager. This function create internal
70 // mapping between input method id and engine components. This function must 74 // mapping between input method id and engine components. This function must
71 // be called before using any other function. 75 // be called before using any other function.
72 void Initialize(scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate); 76 void Initialize(scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate);
73 77
74 // Loads |input_method_id| component extension IME. This function returns true 78 // Loads |input_method_id| component extension IME. This function returns true
75 // on success. This function is safe to call multiple times. Returns false if 79 // on success. This function is safe to call multiple times. Returns false if
76 // already corresponding component extension is loaded. 80 // already corresponding component extension is loaded.
77 bool LoadComponentExtensionIME(const std::string& input_method_id); 81 bool LoadComponentExtensionIME(Profile* profile,
82 const std::string& input_method_id);
78 83
79 // Unloads |input_method_id| component extension IME. This function returns 84 // Unloads |input_method_id| component extension IME. This function returns
80 // true on success. This function is safe to call multiple times. Returns 85 // true on success. This function is safe to call multiple times. Returns
81 // false if already corresponding component extension is unloaded. 86 // false if already corresponding component extension is unloaded.
82 bool UnloadComponentExtensionIME(const std::string& input_method_id); 87 bool UnloadComponentExtensionIME(Profile* profile,
88 const std::string& input_method_id);
83 89
84 // Returns true if |input_method_id| is whitelisted component extension input 90 // Returns true if |input_method_id| is whitelisted component extension input
85 // method. 91 // method.
86 bool IsWhitelisted(const std::string& input_method_id); 92 bool IsWhitelisted(const std::string& input_method_id);
87 93
88 // Returns true if |extension_id| is whitelisted component extension. 94 // Returns true if |extension_id| is whitelisted component extension.
89 bool IsWhitelistedExtension(const std::string& extension_id); 95 bool IsWhitelistedExtension(const std::string& extension_id);
90 96
91 // Returns InputMethodId. This function returns empty string if |extension_id| 97 // Returns InputMethodId. This function returns empty string if |extension_id|
92 // and |engine_id| is not a whitelisted component extention IME. 98 // and |engine_id| is not a whitelisted component extention IME.
(...skipping 30 matching lines...) Expand all
123 std::vector<ComponentExtensionIME> component_extension_imes_; 129 std::vector<ComponentExtensionIME> component_extension_imes_;
124 130
125 std::set<std::string> login_layout_set_; 131 std::set<std::string> login_layout_set_;
126 132
127 DISALLOW_COPY_AND_ASSIGN(ComponentExtensionIMEManager); 133 DISALLOW_COPY_AND_ASSIGN(ComponentExtensionIMEManager);
128 }; 134 };
129 135
130 } // namespace chromeos 136 } // namespace chromeos
131 137
132 #endif // CHROMEOS_IME_COMPONENT_EXTENSION_IME_MANAGER_H_ 138 #endif // CHROMEOS_IME_COMPONENT_EXTENSION_IME_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698