| 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   // Notifies the client to show/hide IME. | 
|  | 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 | 
| 86   // Sends a CompositorMessage for |tab_id| to the client. | 97   // Sends a CompositorMessage for |tab_id| to the client. | 
| 87   void SendCompositorMessage(const int tab_id, | 98   void SendCompositorMessage(const int tab_id, | 
| 88                              content::RenderWidgetHost* render_widget_host, | 99                              content::RenderWidgetHost* render_widget_host, | 
| 89                              const std::vector<uint8_t>& message); | 100                              const std::vector<uint8_t>& message); | 
| 90 | 101 | 
| 91   // Sets a RenderWidgetMessageDelegate to be notified of all incoming | 102   // Sets a RenderWidgetMessageDelegate to be notified of all incoming | 
| 92   // RenderWidget related messages for |tab_id| from the client.  There can only | 103   // RenderWidget related messages for |tab_id| from the client.  There can only | 
| 93   // be one RenderWidgetMessageDelegate per tab. | 104   // be one RenderWidgetMessageDelegate per tab. | 
| 94   void SetDelegate(const int tab_id, RenderWidgetMessageDelegate* delegate); | 105   void SetDelegate(const int tab_id, RenderWidgetMessageDelegate* delegate); | 
| 95   void RemoveDelegate(const int tab_id); | 106   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 | 138   // Returns the render_widget_id for the RenderWidgetHost. Will return 0U if | 
| 128   // the host is not found. | 139   // the host is not found. | 
| 129   int GetRenderWidgetId(const int tab_id, | 140   int GetRenderWidgetId(const int tab_id, | 
| 130                         content::RenderWidgetHost* render_widget_host); | 141                         content::RenderWidgetHost* render_widget_host); | 
| 131 | 142 | 
| 132   // Returns the RenderWidgetHost for the given render_widget_id. Will return | 143   // Returns the RenderWidgetHost for the given render_widget_id. Will return | 
| 133   // nullptr if no host is found. | 144   // nullptr if no host is found. | 
| 134   content::RenderWidgetHost* GetRenderWidgetHost(const int tab_id, | 145   content::RenderWidgetHost* GetRenderWidgetHost(const int tab_id, | 
| 135                                                  const int render_widget_id); | 146                                                  const int render_widget_id); | 
| 136 | 147 | 
|  | 148   // Inserts the text entered by the user into the |client|. | 
|  | 149   // The existing text in the box gets replaced by the new text from IME. | 
|  | 150   void SetTextFromIME(ui::TextInputClient* client, std::string text); | 
|  | 151 | 
| 137   DelegateMap delegates_; | 152   DelegateMap delegates_; | 
| 138   TabMap tabs_; | 153   TabMap tabs_; | 
| 139 | 154 | 
| 140   // A RenderWidgetHost can also be uniquely identified by the | 155   // A RenderWidgetHost can also be uniquely identified by the | 
| 141   // <process_id, routing_id> where the process_id is the id for the | 156   // <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 | 157   // RenderProcessHost for this widget and the routing_id is the id for the | 
| 143   // widget. | 158   // widget. | 
| 144   // But we generate our own ids to avoid having the render widget protocol tied | 159   // 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. | 160   // to always using a combination of these ids, generated by the content layer. | 
| 146   // By using an AtomicSequenceNumber for identifying render widgets across | 161   // 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 | 162   // 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 | 163   // render widget and the consumer of the features tied to this widget on the | 
| 149   // client, which is the BlimpCompositor. | 164   // client, which is the BlimpCompositor. | 
| 150   base::AtomicSequenceNumber next_widget_id_; | 165   base::AtomicSequenceNumber next_widget_id_; | 
| 151 | 166 | 
| 152   InputMessageConverter input_message_converter_; | 167   InputMessageConverter input_message_converter_; | 
| 153 | 168 | 
| 154   // Outgoing message processors for RENDER_WIDGET, COMPOSITOR and INPUT types. | 169   // Outgoing message processors for RENDER_WIDGET, COMPOSITOR and INPUT types. | 
| 155   scoped_ptr<BlimpMessageProcessor> render_widget_message_sender_; | 170   scoped_ptr<BlimpMessageProcessor> render_widget_message_sender_; | 
| 156   scoped_ptr<BlimpMessageProcessor> compositor_message_sender_; | 171   scoped_ptr<BlimpMessageProcessor> compositor_message_sender_; | 
| 157   scoped_ptr<BlimpMessageProcessor> input_message_sender_; | 172   scoped_ptr<BlimpMessageProcessor> input_message_sender_; | 
|  | 173   scoped_ptr<BlimpMessageProcessor> ime_message_sender_; | 
| 158 | 174 | 
| 159   DISALLOW_COPY_AND_ASSIGN(EngineRenderWidgetFeature); | 175   DISALLOW_COPY_AND_ASSIGN(EngineRenderWidgetFeature); | 
| 160 }; | 176 }; | 
| 161 | 177 | 
| 162 }  // namespace blimp | 178 }  // namespace blimp | 
| 163 | 179 | 
| 164 #endif  // BLIMP_ENGINE_FEATURE_ENGINE_RENDER_WIDGET_FEATURE_H_ | 180 #endif  // BLIMP_ENGINE_FEATURE_ENGINE_RENDER_WIDGET_FEATURE_H_ | 
| OLD | NEW | 
|---|