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

Side by Side Diff: components/arc/ime/arc_ime_service.h

Issue 2661863002: ARC IME: Fix Crash on ARC Notification (Closed)
Patch Set: Removed unnecessary include Created 3 years, 10 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
« no previous file with comments | « no previous file | components/arc/ime/arc_ime_service.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 COMPONENTS_ARC_IME_ARC_IME_SERVICE_H_ 5 #ifndef COMPONENTS_ARC_IME_ARC_IME_SERVICE_H_
6 #define COMPONENTS_ARC_IME_ARC_IME_SERVICE_H_ 6 #define COMPONENTS_ARC_IME_ARC_IME_SERVICE_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "components/arc/arc_service.h" 11 #include "components/arc/arc_service.h"
12 #include "components/arc/ime/arc_ime_bridge.h" 12 #include "components/arc/ime/arc_ime_bridge.h"
13 #include "components/exo/wm_helper.h" 13 #include "components/exo/wm_helper.h"
14 #include "ui/aura/env_observer.h" 14 #include "ui/aura/env_observer.h"
15 #include "ui/aura/window_observer.h" 15 #include "ui/aura/window_observer.h"
16 #include "ui/aura/window_tracker.h"
17 #include "ui/base/ime/text_input_client.h" 16 #include "ui/base/ime/text_input_client.h"
18 #include "ui/base/ime/text_input_flags.h" 17 #include "ui/base/ime/text_input_flags.h"
19 #include "ui/base/ime/text_input_type.h" 18 #include "ui/base/ime/text_input_type.h"
20 #include "ui/gfx/geometry/rect.h" 19 #include "ui/gfx/geometry/rect.h"
21 #include "ui/keyboard/keyboard_controller.h" 20 #include "ui/keyboard/keyboard_controller.h"
22 #include "ui/keyboard/keyboard_controller_observer.h" 21 #include "ui/keyboard/keyboard_controller_observer.h"
23 22
24 namespace aura { 23 namespace aura {
25 class Window; 24 class Window;
26 } 25 }
27 26
28 namespace ui { 27 namespace ui {
29 class InputMethod; 28 class InputMethod;
30 } 29 }
31 30
32 namespace arc { 31 namespace arc {
33 32
34 class ArcBridgeService; 33 class ArcBridgeService;
35 34
36 // This class implements ui::TextInputClient and makes ARC windows behave 35 // This class implements ui::TextInputClient and makes ARC windows behave
37 // as a text input target in Chrome OS environment. 36 // as a text input target in Chrome OS environment.
38 class ArcImeService : public ArcService, 37 class ArcImeService : public ArcService,
39 public ArcImeBridge::Delegate, 38 public ArcImeBridge::Delegate,
40 public aura::EnvObserver, 39 public aura::EnvObserver,
40 public aura::WindowObserver,
41 public exo::WMHelper::FocusObserver, 41 public exo::WMHelper::FocusObserver,
42 public keyboard::KeyboardControllerObserver, 42 public keyboard::KeyboardControllerObserver,
43 public ui::TextInputClient { 43 public ui::TextInputClient {
44 public: 44 public:
45 explicit ArcImeService(ArcBridgeService* bridge_service); 45 explicit ArcImeService(ArcBridgeService* bridge_service);
46 ~ArcImeService() override; 46 ~ArcImeService() override;
47 47
48 class ArcWindowDelegate { 48 class ArcWindowDelegate {
49 public: 49 public:
50 virtual ~ArcWindowDelegate() {} 50 virtual ~ArcWindowDelegate() {}
51 virtual bool IsArcWindow(const aura::Window* window) const = 0; 51 virtual bool IsArcWindow(const aura::Window* window) const = 0;
52 virtual void RegisterFocusObserver() = 0; 52 virtual void RegisterFocusObserver() = 0;
53 virtual void UnregisterFocusObserver() = 0; 53 virtual void UnregisterFocusObserver() = 0;
54 }; 54 };
55 55
56 // Injects the custom IPC bridge object for testing purpose only. 56 // Injects the custom IPC bridge object for testing purpose only.
57 void SetImeBridgeForTesting(std::unique_ptr<ArcImeBridge> test_ime_bridge); 57 void SetImeBridgeForTesting(std::unique_ptr<ArcImeBridge> test_ime_bridge);
58 58
59 // Injects the custom IME for testing purpose only. 59 // Injects the custom IME for testing purpose only.
60 void SetInputMethodForTesting(ui::InputMethod* test_input_method); 60 void SetInputMethodForTesting(ui::InputMethod* test_input_method);
61 61
62 // Injects the custom delegate for ARC windows, for testing purpose only. 62 // Injects the custom delegate for ARC windows, for testing purpose only.
63 void SetArcWindowDelegateForTesting( 63 void SetArcWindowDelegateForTesting(
64 std::unique_ptr<ArcWindowDelegate> delegate); 64 std::unique_ptr<ArcWindowDelegate> delegate);
65 65
66 // Overridden from aura::EnvObserver: 66 // Overridden from aura::EnvObserver:
67 void OnWindowInitialized(aura::Window* new_window) override; 67 void OnWindowInitialized(aura::Window* new_window) override;
68 68
69 // Overridden from aura::WindowObserver:
70 void OnWindowDestroying(aura::Window* window) override;
71 void OnWindowRemovingFromRootWindow(aura::Window* window,
72 aura::Window* new_root) override;
73
69 // Overridden from exo::WMHelper::FocusObserver: 74 // Overridden from exo::WMHelper::FocusObserver:
70 void OnWindowFocused(aura::Window* gained_focus, 75 void OnWindowFocused(aura::Window* gained_focus,
71 aura::Window* lost_focus) override; 76 aura::Window* lost_focus) override;
72 77
73 // Overridden from ArcImeBridge::Delegate: 78 // Overridden from ArcImeBridge::Delegate:
74 void OnTextInputTypeChanged(ui::TextInputType type) override; 79 void OnTextInputTypeChanged(ui::TextInputType type) override;
75 void OnCursorRectChanged(const gfx::Rect& rect) override; 80 void OnCursorRectChanged(const gfx::Rect& rect) override;
76 void OnCancelComposition() override; 81 void OnCancelComposition() override;
77 void ShowImeIfNeeded() override; 82 void ShowImeIfNeeded() override;
78 83
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 122
118 private: 123 private:
119 ui::InputMethod* GetInputMethod(); 124 ui::InputMethod* GetInputMethod();
120 125
121 std::unique_ptr<ArcImeBridge> ime_bridge_; 126 std::unique_ptr<ArcImeBridge> ime_bridge_;
122 std::unique_ptr<ArcWindowDelegate> arc_window_delegate_; 127 std::unique_ptr<ArcWindowDelegate> arc_window_delegate_;
123 ui::TextInputType ime_type_; 128 ui::TextInputType ime_type_;
124 gfx::Rect cursor_rect_; 129 gfx::Rect cursor_rect_;
125 bool has_composition_text_; 130 bool has_composition_text_;
126 131
127 aura::WindowTracker focused_arc_window_; 132 aura::Window* focused_arc_window_ = nullptr;
128 133
129 keyboard::KeyboardController* keyboard_controller_; 134 keyboard::KeyboardController* keyboard_controller_;
130 135
131 ui::InputMethod* test_input_method_; 136 ui::InputMethod* test_input_method_;
132 bool is_focus_observer_installed_; 137 bool is_focus_observer_installed_;
133 138
134 DISALLOW_COPY_AND_ASSIGN(ArcImeService); 139 DISALLOW_COPY_AND_ASSIGN(ArcImeService);
135 }; 140 };
136 141
137 } // namespace arc 142 } // namespace arc
138 143
139 #endif // COMPONENTS_ARC_IME_ARC_IME_SERVICE_H_ 144 #endif // COMPONENTS_ARC_IME_ARC_IME_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | components/arc/ime/arc_ime_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698