Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 BLIMP_ENGINE_FEATURE_ENGINE_RENDER_WIDGET_FEATURE_H_ | 5 #ifndef BLIMP_ENGINE_FEATURE_ENGINE_RENDER_WIDGET_FEATURE_H_ |
| 6 #define BLIMP_ENGINE_FEATURE_ENGINE_RENDER_WIDGET_FEATURE_H_ | 6 #define BLIMP_ENGINE_FEATURE_ENGINE_RENDER_WIDGET_FEATURE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/atomic_sequence_num.h" | 13 #include "base/atomic_sequence_num.h" |
| 14 #include "base/containers/small_map.h" | 14 #include "base/containers/small_map.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "blimp/net/blimp_message_processor.h" | 17 #include "blimp/net/blimp_message_processor.h" |
| 18 #include "blimp/net/input_message_converter.h" | 18 #include "blimp/net/input_message_converter.h" |
| 19 #include "ui/base/ime/text_input_client.h" | |
| 19 | 20 |
| 20 namespace blink { | 21 namespace blink { |
| 21 class WebGestureEvent; | 22 class WebGestureEvent; |
| 22 } | 23 } |
| 23 | 24 |
| 24 namespace content { | 25 namespace content { |
| 25 class RenderWidgetHost; | 26 class RenderWidgetHost; |
| 26 } | 27 } |
| 27 | 28 |
| 28 namespace blimp { | 29 namespace blimp { |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 56 | 57 |
| 57 void set_render_widget_message_sender( | 58 void set_render_widget_message_sender( |
| 58 scoped_ptr<BlimpMessageProcessor> message_processor); | 59 scoped_ptr<BlimpMessageProcessor> message_processor); |
| 59 | 60 |
| 60 void set_input_message_sender( | 61 void set_input_message_sender( |
| 61 scoped_ptr<BlimpMessageProcessor> message_processor); | 62 scoped_ptr<BlimpMessageProcessor> message_processor); |
| 62 | 63 |
| 63 void set_compositor_message_sender( | 64 void set_compositor_message_sender( |
| 64 scoped_ptr<BlimpMessageProcessor> message_processor); | 65 scoped_ptr<BlimpMessageProcessor> message_processor); |
| 65 | 66 |
| 67 void set_ime_message_sender( | |
| 68 scoped_ptr<BlimpMessageProcessor> message_processor); | |
| 69 | |
| 66 // Notifes the client that a new RenderWidget for a particular WebContents has | 70 // Notifes the client that a new RenderWidget for a particular WebContents has |
| 67 // been created. This will trigger the creation of the BlimpCompositor for | 71 // been created. This will trigger the creation of the BlimpCompositor for |
| 68 // this widget on the client. | 72 // this widget on the client. |
| 69 void OnRenderWidgetCreated(const int tab_id, | 73 void OnRenderWidgetCreated(const int tab_id, |
| 70 content::RenderWidgetHost* render_widget_host); | 74 content::RenderWidgetHost* render_widget_host); |
| 71 | 75 |
| 72 // Notifies the client that the RenderWidget for a particular WebContents has | 76 // Notifies the client that the RenderWidget for a particular WebContents has |
| 73 // changed. When this is sent the native view on the client becomes bound to | 77 // changed. When this is sent the native view on the client becomes bound to |
| 74 // the BlimpCompositor for this widget. | 78 // the BlimpCompositor for this widget. |
| 75 // Since the compositor on the client performs the operations of the view for | 79 // Since the compositor on the client performs the operations of the view for |
| 76 // this widget, this will set the visibility and draw state correctly for this | 80 // this widget, this will set the visibility and draw state correctly for this |
| 77 // widget. | 81 // widget. |
| 78 // Note: This assumes that this is the RenderWidgetHost for the main frame. | 82 // Note: This assumes that this is the RenderWidgetHost for the main frame. |
| 79 // Only one RenderWidget can be in initialized state for a tab. | 83 // Only one RenderWidget can be in initialized state for a tab. |
| 80 void OnRenderWidgetInitialized(const int tab_id, | 84 void OnRenderWidgetInitialized(const int tab_id, |
| 81 content::RenderWidgetHost* render_widget_host); | 85 content::RenderWidgetHost* render_widget_host); |
| 82 | 86 |
| 83 void OnRenderWidgetDeleted(const int tab_id, | 87 void OnRenderWidgetDeleted(const int tab_id, |
| 84 content::RenderWidgetHost* render_widget_host); | 88 content::RenderWidgetHost* render_widget_host); |
| 85 | 89 |
| 90 // Sends an ImeMessage to show/hide IME. | |
|
haibinlu
2016/03/17 18:59:46
Notifies the client to show/hide IME.
shaktisahu
2016/03/18 19:08:06
Done.
shaktisahu
2016/03/18 19:08:06
Done.
| |
| 91 void SendShowImeRequest(const int tab_id, | |
| 92 content::RenderWidgetHost* render_widget_host, | |
| 93 const ui::TextInputClient* client); | |
| 94 void SendHideImeRequest(const int tab_id, | |
| 95 content::RenderWidgetHost* render_widget_host, | |
| 96 const ui::TextInputClient* client); | |
|
David Trainor- moved to gerrit
2016/03/17 21:53:29
Do we need the client for hide?
| |
| 97 | |
| 86 // Sends a CompositorMessage for |tab_id| to the client. | 98 // Sends a CompositorMessage for |tab_id| to the client. |
| 87 void SendCompositorMessage(const int tab_id, | 99 void SendCompositorMessage(const int tab_id, |
| 88 content::RenderWidgetHost* render_widget_host, | 100 content::RenderWidgetHost* render_widget_host, |
| 89 const std::vector<uint8_t>& message); | 101 const std::vector<uint8_t>& message); |
| 90 | 102 |
| 91 // Sets a RenderWidgetMessageDelegate to be notified of all incoming | 103 // Sets a RenderWidgetMessageDelegate to be notified of all incoming |
| 92 // RenderWidget related messages for |tab_id| from the client. There can only | 104 // RenderWidget related messages for |tab_id| from the client. There can only |
| 93 // be one RenderWidgetMessageDelegate per tab. | 105 // be one RenderWidgetMessageDelegate per tab. |
| 94 void SetDelegate(const int tab_id, RenderWidgetMessageDelegate* delegate); | 106 void SetDelegate(const int tab_id, RenderWidgetMessageDelegate* delegate); |
| 95 void RemoveDelegate(const int tab_id); | 107 void RemoveDelegate(const int tab_id); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 // Returns the render_widget_id for the RenderWidgetHost. Will return 0U if | 139 // Returns the render_widget_id for the RenderWidgetHost. Will return 0U if |
| 128 // the host is not found. | 140 // the host is not found. |
| 129 int GetRenderWidgetId(const int tab_id, | 141 int GetRenderWidgetId(const int tab_id, |
| 130 content::RenderWidgetHost* render_widget_host); | 142 content::RenderWidgetHost* render_widget_host); |
| 131 | 143 |
| 132 // Returns the RenderWidgetHost for the given render_widget_id. Will return | 144 // Returns the RenderWidgetHost for the given render_widget_id. Will return |
| 133 // nullptr if no host is found. | 145 // nullptr if no host is found. |
| 134 content::RenderWidgetHost* GetRenderWidgetHost(const int tab_id, | 146 content::RenderWidgetHost* GetRenderWidgetHost(const int tab_id, |
| 135 const int render_widget_id); | 147 const int render_widget_id); |
| 136 | 148 |
| 149 void InsertTextFromIME(ui::TextInputClient* client, std::string text); | |
|
haibinlu
2016/03/17 18:59:46
add method document
shaktisahu
2016/03/18 19:08:06
Done.
shaktisahu
2016/03/18 19:08:06
Done.
| |
| 150 | |
| 137 DelegateMap delegates_; | 151 DelegateMap delegates_; |
| 138 TabMap tabs_; | 152 TabMap tabs_; |
| 139 | 153 |
| 140 // A RenderWidgetHost can also be uniquely identified by the | 154 // A RenderWidgetHost can also be uniquely identified by the |
| 141 // <process_id, routing_id> where the process_id is the id for the | 155 // <process_id, routing_id> where the process_id is the id for the |
| 142 // RenderProcessHost for this widget and the routing_id is the id for the | 156 // RenderProcessHost for this widget and the routing_id is the id for the |
| 143 // widget. | 157 // widget. |
| 144 // But we generate our own ids to avoid having the render widget protocol tied | 158 // But we generate our own ids to avoid having the render widget protocol tied |
| 145 // to always using a combination of these ids, generated by the content layer. | 159 // to always using a combination of these ids, generated by the content layer. |
| 146 // By using an AtomicSequenceNumber for identifying render widgets across | 160 // By using an AtomicSequenceNumber for identifying render widgets across |
| 147 // tabs, we can be sure that there will always be a 1:1 mapping between the | 161 // tabs, we can be sure that there will always be a 1:1 mapping between the |
| 148 // render widget and the consumer of the features tied to this widget on the | 162 // render widget and the consumer of the features tied to this widget on the |
| 149 // client, which is the BlimpCompositor. | 163 // client, which is the BlimpCompositor. |
| 150 base::AtomicSequenceNumber next_widget_id_; | 164 base::AtomicSequenceNumber next_widget_id_; |
| 151 | 165 |
| 152 InputMessageConverter input_message_converter_; | 166 InputMessageConverter input_message_converter_; |
| 153 | 167 |
| 154 // Outgoing message processors for RENDER_WIDGET, COMPOSITOR and INPUT types. | 168 // Outgoing message processors for RENDER_WIDGET, COMPOSITOR and INPUT types. |
| 155 scoped_ptr<BlimpMessageProcessor> render_widget_message_sender_; | 169 scoped_ptr<BlimpMessageProcessor> render_widget_message_sender_; |
| 156 scoped_ptr<BlimpMessageProcessor> compositor_message_sender_; | 170 scoped_ptr<BlimpMessageProcessor> compositor_message_sender_; |
| 157 scoped_ptr<BlimpMessageProcessor> input_message_sender_; | 171 scoped_ptr<BlimpMessageProcessor> input_message_sender_; |
| 172 scoped_ptr<BlimpMessageProcessor> ime_message_sender_; | |
| 158 | 173 |
| 159 DISALLOW_COPY_AND_ASSIGN(EngineRenderWidgetFeature); | 174 DISALLOW_COPY_AND_ASSIGN(EngineRenderWidgetFeature); |
| 160 }; | 175 }; |
| 161 | 176 |
| 162 } // namespace blimp | 177 } // namespace blimp |
| 163 | 178 |
| 164 #endif // BLIMP_ENGINE_FEATURE_ENGINE_RENDER_WIDGET_FEATURE_H_ | 179 #endif // BLIMP_ENGINE_FEATURE_ENGINE_RENDER_WIDGET_FEATURE_H_ |
| OLD | NEW |