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 WIN8_METRO_DRIVER_CHROME_APP_VIEW_ASH_H_ | 5 #ifndef WIN8_METRO_DRIVER_CHROME_APP_VIEW_ASH_H_ |
6 #define WIN8_METRO_DRIVER_CHROME_APP_VIEW_ASH_H_ | 6 #define WIN8_METRO_DRIVER_CHROME_APP_VIEW_ASH_H_ |
7 | 7 |
8 #include <windows.applicationmodel.core.h> | 8 #include <windows.applicationmodel.core.h> |
9 #include <windows.ui.core.h> | 9 #include <windows.ui.core.h> |
10 #include <windows.ui.input.h> | 10 #include <windows.ui.input.h> |
11 #include <windows.ui.viewmanagement.h> | 11 #include <windows.ui.viewmanagement.h> |
12 | 12 |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
16 #include "ui/events/event_constants.h" | 16 #include "ui/events/event_constants.h" |
| 17 #include "ui/metro_viewer/ime_types.h" |
17 #include "win8/metro_driver/direct3d_helper.h" | 18 #include "win8/metro_driver/direct3d_helper.h" |
| 19 #include "win8/metro_driver/ime/ime_popup_observer.h" |
| 20 #include "win8/metro_driver/ime/language_profile_observer.h" |
| 21 #include "win8/metro_driver/ime/text_store_delegate.h" |
18 | 22 |
19 namespace base { | 23 namespace base { |
20 class FilePath; | 24 class FilePath; |
21 } | 25 } |
22 | 26 |
23 namespace IPC { | 27 namespace IPC { |
24 class Listener; | 28 class Listener; |
25 class ChannelProxy; | 29 class ChannelProxy; |
26 } | 30 } |
27 | 31 |
| 32 namespace metro_driver { |
| 33 class TextService; |
| 34 struct CompositionText; |
| 35 } |
| 36 |
| 37 namespace metro_viewer { |
| 38 struct UnderlineInfo; |
| 39 } |
| 40 |
28 class OpenFilePickerSession; | 41 class OpenFilePickerSession; |
29 class SaveFilePickerSession; | 42 class SaveFilePickerSession; |
30 class FolderPickerSession; | 43 class FolderPickerSession; |
31 class FilePickerSessionBase; | 44 class FilePickerSessionBase; |
32 | 45 |
33 struct MetroViewerHostMsg_SaveAsDialogParams; | 46 struct MetroViewerHostMsg_SaveAsDialogParams; |
34 | 47 |
35 class ChromeAppViewAsh | 48 class ChromeAppViewAsh |
36 : public mswr::RuntimeClass<winapp::Core::IFrameworkView> { | 49 : public mswr::RuntimeClass<winapp::Core::IFrameworkView>, |
| 50 public metro_driver::ImePopupObserver, |
| 51 public metro_driver::LanguageProfileObserver, |
| 52 public metro_driver::TextStoreDelegate { |
37 public: | 53 public: |
38 ChromeAppViewAsh(); | 54 ChromeAppViewAsh(); |
39 ~ChromeAppViewAsh(); | 55 ~ChromeAppViewAsh(); |
40 | 56 |
41 // IViewProvider overrides. | 57 // IViewProvider overrides. |
42 IFACEMETHOD(Initialize)(winapp::Core::ICoreApplicationView* view); | 58 IFACEMETHOD(Initialize)(winapp::Core::ICoreApplicationView* view); |
43 IFACEMETHOD(SetWindow)(winui::Core::ICoreWindow* window); | 59 IFACEMETHOD(SetWindow)(winui::Core::ICoreWindow* window); |
44 IFACEMETHOD(Load)(HSTRING entryPoint); | 60 IFACEMETHOD(Load)(HSTRING entryPoint); |
45 IFACEMETHOD(Run)(); | 61 IFACEMETHOD(Run)(); |
46 IFACEMETHOD(Uninitialize)(); | 62 IFACEMETHOD(Uninitialize)(); |
(...skipping 28 matching lines...) Expand all Loading... |
75 void OnSaveFileCompleted(SaveFilePickerSession* save_file_picker, | 91 void OnSaveFileCompleted(SaveFilePickerSession* save_file_picker, |
76 bool success); | 92 bool success); |
77 | 93 |
78 // This function is invoked when the folder picker operation completes. The | 94 // This function is invoked when the folder picker operation completes. The |
79 // result of the operation is passed in along with the FolderPickerSession | 95 // result of the operation is passed in along with the FolderPickerSession |
80 // instance which is deleted after we read the required information from | 96 // instance which is deleted after we read the required information from |
81 // the FolderPickerSession class. | 97 // the FolderPickerSession class. |
82 void OnFolderPickerCompleted(FolderPickerSession* folder_picker, | 98 void OnFolderPickerCompleted(FolderPickerSession* folder_picker, |
83 bool success); | 99 bool success); |
84 | 100 |
| 101 void OnImeCancelComposition(); |
| 102 void OnImeUpdateTextInputClient( |
| 103 const std::vector<int32>& input_scopes, |
| 104 const std::vector<metro_viewer::CharacterBounds>& character_bounds); |
| 105 |
85 HWND core_window_hwnd() const { return core_window_hwnd_; } | 106 HWND core_window_hwnd() const { return core_window_hwnd_; } |
86 | 107 |
| 108 |
87 private: | 109 private: |
| 110 // ImePopupObserver overrides. |
| 111 virtual void OnCandidatePopupChanged(bool shown) OVERRIDE; |
| 112 |
| 113 // LanguageProfileObserver: |
| 114 virtual void OnInputSourceChanged(LANGID langid, bool is_ime) OVERRIDE; |
| 115 |
| 116 // TextStoreDelegate overrides. |
| 117 virtual void OnCompositionChanged( |
| 118 const string16& text, |
| 119 int32 selection_start, |
| 120 int32 selection_end, |
| 121 const std::vector<metro_viewer::UnderlineInfo>& underlines) OVERRIDE; |
| 122 virtual void OnTextCommitted(const string16& text) OVERRIDE; |
| 123 virtual RECT GetCaretBounds() OVERRIDE; |
| 124 virtual bool GetCompositionCharacterBounds(uint32 index, RECT* rect) OVERRIDE; |
| 125 |
88 HRESULT OnActivate(winapp::Core::ICoreApplicationView* view, | 126 HRESULT OnActivate(winapp::Core::ICoreApplicationView* view, |
89 winapp::Activation::IActivatedEventArgs* args); | 127 winapp::Activation::IActivatedEventArgs* args); |
90 | 128 |
91 HRESULT OnPointerMoved(winui::Core::ICoreWindow* sender, | 129 HRESULT OnPointerMoved(winui::Core::ICoreWindow* sender, |
92 winui::Core::IPointerEventArgs* args); | 130 winui::Core::IPointerEventArgs* args); |
93 | 131 |
94 HRESULT OnPointerPressed(winui::Core::ICoreWindow* sender, | 132 HRESULT OnPointerPressed(winui::Core::ICoreWindow* sender, |
95 winui::Core::IPointerEventArgs* args); | 133 winui::Core::IPointerEventArgs* args); |
96 | 134 |
97 HRESULT OnPointerReleased(winui::Core::ICoreWindow* sender, | 135 HRESULT OnPointerReleased(winui::Core::ICoreWindow* sender, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 metro_driver::Direct3DHelper direct3d_helper_; | 194 metro_driver::Direct3DHelper direct3d_helper_; |
157 | 195 |
158 // The channel to Chrome, in particular to the MetroViewerProcessHost. | 196 // The channel to Chrome, in particular to the MetroViewerProcessHost. |
159 IPC::ChannelProxy* ui_channel_; | 197 IPC::ChannelProxy* ui_channel_; |
160 | 198 |
161 // The actual window behind the view surface. | 199 // The actual window behind the view surface. |
162 HWND core_window_hwnd_; | 200 HWND core_window_hwnd_; |
163 | 201 |
164 // UI message loop to allow message passing into this thread. | 202 // UI message loop to allow message passing into this thread. |
165 base::MessageLoop ui_loop_; | 203 base::MessageLoop ui_loop_; |
| 204 |
| 205 // For IME support. |
| 206 scoped_ptr<metro_driver::TextService> text_service_; |
| 207 struct TextInputClientState; |
| 208 scoped_ptr<TextInputClientState> text_input_client_state_; |
166 }; | 209 }; |
167 | 210 |
168 #endif // WIN8_METRO_DRIVER_CHROME_APP_VIEW_ASH_H_ | 211 #endif // WIN8_METRO_DRIVER_CHROME_APP_VIEW_ASH_H_ |
OLD | NEW |