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 #include "content/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 }; | 173 }; |
174 | 174 |
175 bool IsDateTimeInput(ui::TextInputType type) { | 175 bool IsDateTimeInput(ui::TextInputType type) { |
176 return type == ui::TEXT_INPUT_TYPE_DATE || | 176 return type == ui::TEXT_INPUT_TYPE_DATE || |
177 type == ui::TEXT_INPUT_TYPE_DATE_TIME || | 177 type == ui::TEXT_INPUT_TYPE_DATE_TIME || |
178 type == ui::TEXT_INPUT_TYPE_DATE_TIME_LOCAL || | 178 type == ui::TEXT_INPUT_TYPE_DATE_TIME_LOCAL || |
179 type == ui::TEXT_INPUT_TYPE_MONTH || | 179 type == ui::TEXT_INPUT_TYPE_MONTH || |
180 type == ui::TEXT_INPUT_TYPE_TIME || type == ui::TEXT_INPUT_TYPE_WEEK; | 180 type == ui::TEXT_INPUT_TYPE_TIME || type == ui::TEXT_INPUT_TYPE_WEEK; |
181 } | 181 } |
182 | 182 |
183 content::RenderWidgetInputHandlerDelegate* GetRenderWidgetInputHandlerDelegate( | |
184 content::RenderWidget* widget) { | |
185 #if defined(USE_AURA) | |
186 const base::CommandLine& cmdline = *base::CommandLine::ForCurrentProcess(); | |
187 if (content::ServiceManagerConnection::GetForProcess() && | |
188 cmdline.HasSwitch(switches::kUseMusInRenderer)) { | |
189 return content::RenderWidgetMusConnection::GetOrCreate( | |
190 widget->routing_id()); | |
191 } | |
192 #endif | |
193 // If we don't have a connection to the Service Manager, then we want to route | |
194 // IPCs back to the browser process rather than Mus so we use the |widget| as | |
195 // the RenderWidgetInputHandlerDelegate. | |
196 return widget; | |
197 } | |
198 | |
199 WebDragData DropMetaDataToWebDragData( | 183 WebDragData DropMetaDataToWebDragData( |
200 const std::vector<DropData::Metadata>& drop_meta_data) { | 184 const std::vector<DropData::Metadata>& drop_meta_data) { |
201 std::vector<WebDragData::Item> item_list; | 185 std::vector<WebDragData::Item> item_list; |
202 for (const auto& meta_data_item : drop_meta_data) { | 186 for (const auto& meta_data_item : drop_meta_data) { |
203 if (meta_data_item.kind == DropData::Kind::STRING) { | 187 if (meta_data_item.kind == DropData::Kind::STRING) { |
204 WebDragData::Item item; | 188 WebDragData::Item item; |
205 item.storageType = WebDragData::Item::StorageTypeString; | 189 item.storageType = WebDragData::Item::StorageTypeString; |
206 item.stringType = meta_data_item.mime_type; | 190 item.stringType = meta_data_item.mime_type; |
207 // Have to pass a dummy URL here instead of an empty URL because the | 191 // Have to pass a dummy URL here instead of an empty URL because the |
208 // DropData received by browser_plugins goes through a round trip: | 192 // DropData received by browser_plugins goes through a round trip: |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 // exiting. | 501 // exiting. |
518 if (!is_swapped_out_) | 502 if (!is_swapped_out_) |
519 RenderProcess::current()->AddRefProcess(); | 503 RenderProcess::current()->AddRefProcess(); |
520 } | 504 } |
521 | 505 |
522 void RenderWidget::Init(const ShowCallback& show_callback, | 506 void RenderWidget::Init(const ShowCallback& show_callback, |
523 WebWidget* web_widget) { | 507 WebWidget* web_widget) { |
524 DCHECK(!webwidget_internal_); | 508 DCHECK(!webwidget_internal_); |
525 DCHECK_NE(routing_id_, MSG_ROUTING_NONE); | 509 DCHECK_NE(routing_id_, MSG_ROUTING_NONE); |
526 | 510 |
527 input_handler_.reset(new RenderWidgetInputHandler( | 511 input_handler_ = base::MakeUnique<RenderWidgetInputHandler>(this, this); |
528 GetRenderWidgetInputHandlerDelegate(this), this)); | |
529 | 512 |
530 show_callback_ = show_callback; | 513 show_callback_ = show_callback; |
531 | 514 |
532 webwidget_internal_ = web_widget; | 515 webwidget_internal_ = web_widget; |
533 webwidget_mouse_lock_target_.reset( | 516 webwidget_mouse_lock_target_.reset( |
534 new WebWidgetLockTarget(webwidget_internal_)); | 517 new WebWidgetLockTarget(webwidget_internal_)); |
535 mouse_lock_dispatcher_.reset(new RenderWidgetMouseLockDispatcher(this)); | 518 mouse_lock_dispatcher_.reset(new RenderWidgetMouseLockDispatcher(this)); |
536 | 519 |
537 RenderThread::Get()->AddRoute(routing_id_, this); | 520 RenderThread::Get()->AddRoute(routing_id_, this); |
538 // Take a reference on behalf of the RenderThread. This will be balanced | 521 // Take a reference on behalf of the RenderThread. This will be balanced |
(...skipping 1732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2271 // browser side (https://crbug.com/669219). | 2254 // browser side (https://crbug.com/669219). |
2272 // If there is no WebFrameWidget, then there will be no | 2255 // If there is no WebFrameWidget, then there will be no |
2273 // InputMethodControllers for a WebLocalFrame. | 2256 // InputMethodControllers for a WebLocalFrame. |
2274 return nullptr; | 2257 return nullptr; |
2275 } | 2258 } |
2276 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) | 2259 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) |
2277 ->getActiveWebInputMethodController(); | 2260 ->getActiveWebInputMethodController(); |
2278 } | 2261 } |
2279 | 2262 |
2280 } // namespace content | 2263 } // namespace content |
OLD | NEW |