Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_H_ |
| 7 | 7 |
| 8 #include <map> | |
| 9 #include <string> | 8 #include <string> |
| 9 #include <unordered_map> | |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
| 14 #include "base/scoped_observer.h" | 14 #include "base/scoped_observer.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/ui/input_method/input_method_engine_base.h" | 18 #include "chrome/browser/ui/input_method/input_method_engine_base.h" |
| 19 #include "components/keyed_service/core/keyed_service.h" | 19 #include "components/keyed_service/core/keyed_service.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 public: | 110 public: |
| 111 static InputImeEventRouterFactory* GetInstance(); | 111 static InputImeEventRouterFactory* GetInstance(); |
| 112 InputImeEventRouter* GetRouter(Profile* profile); | 112 InputImeEventRouter* GetRouter(Profile* profile); |
| 113 void RemoveProfile(Profile* profile); | 113 void RemoveProfile(Profile* profile); |
| 114 | 114 |
| 115 private: | 115 private: |
| 116 friend struct base::DefaultSingletonTraits<InputImeEventRouterFactory>; | 116 friend struct base::DefaultSingletonTraits<InputImeEventRouterFactory>; |
| 117 InputImeEventRouterFactory(); | 117 InputImeEventRouterFactory(); |
| 118 ~InputImeEventRouterFactory(); | 118 ~InputImeEventRouterFactory(); |
| 119 | 119 |
| 120 std::map<Profile*, InputImeEventRouter*, ProfileCompare> router_map_; | 120 std::unordered_map<Profile*, InputImeEventRouter*> router_map_; |
|
Shu Chen
2016/04/19 07:27:17
why using unordered_map?
Azure Wei
2016/04/19 08:15:15
We don't need to sort the profile, so std::unorder
| |
| 121 | 121 |
| 122 DISALLOW_COPY_AND_ASSIGN(InputImeEventRouterFactory); | 122 DISALLOW_COPY_AND_ASSIGN(InputImeEventRouterFactory); |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 class InputImeKeyEventHandledFunction : public UIThreadExtensionFunction { | 125 class InputImeKeyEventHandledFunction : public UIThreadExtensionFunction { |
| 126 public: | 126 public: |
| 127 DECLARE_EXTENSION_FUNCTION("input.ime.keyEventHandled", | 127 DECLARE_EXTENSION_FUNCTION("input.ime.keyEventHandled", |
| 128 INPUT_IME_KEYEVENTHANDLED) | 128 INPUT_IME_KEYEVENTHANDLED) |
| 129 | 129 |
| 130 protected: | 130 protected: |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 extension_registry_observer_; | 211 extension_registry_observer_; |
| 212 | 212 |
| 213 content::NotificationRegistrar registrar_; | 213 content::NotificationRegistrar registrar_; |
| 214 }; | 214 }; |
| 215 | 215 |
| 216 InputImeEventRouter* GetInputImeEventRouter(Profile* profile); | 216 InputImeEventRouter* GetInputImeEventRouter(Profile* profile); |
| 217 | 217 |
| 218 } // namespace extensions | 218 } // namespace extensions |
| 219 | 219 |
| 220 #endif // CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_H_ | 220 #endif // CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_H_ |
| OLD | NEW |