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

Side by Side Diff: content/browser/web_contents/touch_editable_impl_aura.cc

Issue 183923030: Almost finish moving context_menu_node_ from RenderViewImpl to RenderFrameImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/browser/web_contents/touch_editable_impl_aura.h" 5 #include "content/browser/web_contents/touch_editable_impl_aura.h"
6 6
7 #include "content/browser/frame_host/render_frame_host_impl.h"
7 #include "content/browser/renderer_host/render_widget_host_impl.h" 8 #include "content/browser/renderer_host/render_widget_host_impl.h"
8 #include "content/browser/renderer_host/render_widget_host_view_aura.h" 9 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
9 #include "content/common/view_messages.h" 10 #include "content/common/view_messages.h"
10 #include "content/public/browser/render_widget_host.h" 11 #include "content/public/browser/render_widget_host.h"
11 #include "grit/ui_strings.h" 12 #include "grit/ui_strings.h"
12 #include "ui/aura/client/activation_client.h" 13 #include "ui/aura/client/activation_client.h"
13 #include "ui/aura/client/screen_position_client.h" 14 #include "ui/aura/client/screen_position_client.h"
14 #include "ui/aura/window.h" 15 #include "ui/aura/window.h"
15 #include "ui/aura/window_event_dispatcher.h" 16 #include "ui/aura/window_event_dispatcher.h"
16 #include "ui/base/clipboard/clipboard.h" 17 #include "ui/base/clipboard/clipboard.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 if (tap_gesture_tap_count_queue_.front() > 1) 215 if (tap_gesture_tap_count_queue_.front() > 1)
215 selection_gesture_in_process_ = false; 216 selection_gesture_in_process_ = false;
216 tap_gesture_tap_count_queue_.pop(); 217 tap_gesture_tap_count_queue_.pop();
217 } 218 }
218 } 219 }
219 220
220 void TouchEditableImplAura::OnViewDestroyed() { 221 void TouchEditableImplAura::OnViewDestroyed() {
221 Cleanup(); 222 Cleanup();
222 } 223 }
223 224
225 void TouchEditableImplAura::SetContextMenuRenderFrameID(
226 int render_process_id, int render_frame_id) {
nasko 2014/03/05 21:50:47 style: params should be on separate lines.
jam 2014/03/06 00:59:37 Done.
227 menu_render_process_id_ = render_process_id;
228 menu_render_frame_id_ = render_frame_id;
229 }
230
224 //////////////////////////////////////////////////////////////////////////////// 231 ////////////////////////////////////////////////////////////////////////////////
225 // TouchEditableImplAura, ui::TouchEditable implementation: 232 // TouchEditableImplAura, ui::TouchEditable implementation:
226 233
227 void TouchEditableImplAura::SelectRect(const gfx::Point& start, 234 void TouchEditableImplAura::SelectRect(const gfx::Point& start,
228 const gfx::Point& end) { 235 const gfx::Point& end) {
229 if (!rwhva_) 236 if (!rwhva_)
230 return; 237 return;
231 238
232 RenderWidgetHostImpl* host = RenderWidgetHostImpl::From( 239 RenderWidgetHostImpl* host = RenderWidgetHostImpl::From(
233 rwhva_->GetRenderWidgetHost()); 240 rwhva_->GetRenderWidgetHost());
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 } 290 }
284 291
285 void TouchEditableImplAura::OpenContextMenu(const gfx::Point& anchor) { 292 void TouchEditableImplAura::OpenContextMenu(const gfx::Point& anchor) {
286 if (!rwhva_) 293 if (!rwhva_)
287 return; 294 return;
288 gfx::Point point = anchor; 295 gfx::Point point = anchor;
289 ConvertPointFromScreen(&point); 296 ConvertPointFromScreen(&point);
290 RenderWidgetHost* host = rwhva_->GetRenderWidgetHost(); 297 RenderWidgetHost* host = rwhva_->GetRenderWidgetHost();
291 host->Send(new ViewMsg_ShowContextMenu(host->GetRoutingID(), point)); 298 host->Send(new ViewMsg_ShowContextMenu(host->GetRoutingID(), point));
292 EndTouchEditing(false); 299 EndTouchEditing(false);
300 menu_render_process_id_ = MSG_ROUTING_NONE;
301 menu_render_frame_id_ = MSG_ROUTING_NONE;
293 } 302 }
294 303
295 bool TouchEditableImplAura::IsCommandIdChecked(int command_id) const { 304 bool TouchEditableImplAura::IsCommandIdChecked(int command_id) const {
296 NOTREACHED(); 305 NOTREACHED();
297 return false; 306 return false;
298 } 307 }
299 308
300 bool TouchEditableImplAura::IsCommandIdEnabled(int command_id) const { 309 bool TouchEditableImplAura::IsCommandIdEnabled(int command_id) const {
301 if (!rwhva_) 310 if (!rwhva_)
302 return false; 311 return false;
(...skipping 24 matching lines...) Expand all
327 bool TouchEditableImplAura::GetAcceleratorForCommandId( 336 bool TouchEditableImplAura::GetAcceleratorForCommandId(
328 int command_id, 337 int command_id,
329 ui::Accelerator* accelerator) { 338 ui::Accelerator* accelerator) {
330 return false; 339 return false;
331 } 340 }
332 341
333 void TouchEditableImplAura::ExecuteCommand(int command_id, int event_flags) { 342 void TouchEditableImplAura::ExecuteCommand(int command_id, int event_flags) {
334 if (!rwhva_) 343 if (!rwhva_)
335 return; 344 return;
336 RenderWidgetHost* host = rwhva_->GetRenderWidgetHost(); 345 RenderWidgetHost* host = rwhva_->GetRenderWidgetHost();
346
347 DCHECK_NE(menu_render_process_id_ , MSG_ROUTING_NONE);
348 DCHECK_NE(menu_render_frame_id_, MSG_ROUTING_NONE);
349 RenderFrameHostImpl* frame = RenderFrameHostImpl::FromID(
350 menu_render_process_id_, menu_render_frame_id_);
337 switch (command_id) { 351 switch (command_id) {
338 case IDS_APP_CUT: 352 case IDS_APP_CUT:
339 host->Cut(); 353 if (frame)
354 frame->Cut();
340 break; 355 break;
341 case IDS_APP_COPY: 356 case IDS_APP_COPY:
342 host->Copy(); 357 if (frame)
358 frame->Copy();
343 break; 359 break;
344 case IDS_APP_PASTE: 360 case IDS_APP_PASTE:
345 host->Paste(); 361 if (frame)
362 frame->Paste();
346 break; 363 break;
347 case IDS_APP_DELETE: 364 case IDS_APP_DELETE:
348 host->Delete(); 365 host->Delete();
349 break; 366 break;
350 case IDS_APP_SELECT_ALL: 367 case IDS_APP_SELECT_ALL:
351 host->SelectAll(); 368 host->SelectAll();
352 break; 369 break;
353 default: 370 default:
354 NOTREACHED(); 371 NOTREACHED();
355 break; 372 break;
356 } 373 }
357 EndTouchEditing(false); 374 EndTouchEditing(false);
358 } 375 }
359 376
360 //////////////////////////////////////////////////////////////////////////////// 377 ////////////////////////////////////////////////////////////////////////////////
361 // TouchEditableImplAura, private: 378 // TouchEditableImplAura, private:
362 379
363 TouchEditableImplAura::TouchEditableImplAura() 380 TouchEditableImplAura::TouchEditableImplAura()
364 : text_input_type_(ui::TEXT_INPUT_TYPE_NONE), 381 : text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
365 rwhva_(NULL), 382 rwhva_(NULL),
383 menu_render_process_id_(MSG_ROUTING_NONE),
384 menu_render_frame_id_(MSG_ROUTING_NONE),
366 selection_gesture_in_process_(false), 385 selection_gesture_in_process_(false),
367 handles_hidden_due_to_scroll_(false), 386 handles_hidden_due_to_scroll_(false),
368 scroll_in_progress_(false), 387 scroll_in_progress_(false),
369 overscroll_in_progress_(false), 388 overscroll_in_progress_(false),
370 is_tap_on_focused_textfield_(false) { 389 is_tap_on_focused_textfield_(false) {
371 } 390 }
372 391
373 void TouchEditableImplAura::Cleanup() { 392 void TouchEditableImplAura::Cleanup() {
374 if (rwhva_) { 393 if (rwhva_) {
375 rwhva_->set_touch_editing_client(NULL); 394 rwhva_->set_touch_editing_client(NULL);
376 rwhva_ = NULL; 395 rwhva_ = NULL;
377 } 396 }
378 text_input_type_ = ui::TEXT_INPUT_TYPE_NONE; 397 text_input_type_ = ui::TEXT_INPUT_TYPE_NONE;
379 EndTouchEditing(true); 398 EndTouchEditing(true);
380 handles_hidden_due_to_scroll_ = false; 399 handles_hidden_due_to_scroll_ = false;
381 scroll_in_progress_ = false; 400 scroll_in_progress_ = false;
382 overscroll_in_progress_ = false; 401 overscroll_in_progress_ = false;
383 } 402 }
384 403
385 } // namespace content 404 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698