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 CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/process/kill.h" | 16 #include "base/process/kill.h" |
17 #include "content/browser/renderer_host/render_widget_host_impl.h" | 17 #include "content/browser/renderer_host/render_widget_host_impl.h" |
18 #include "content/browser/site_instance_impl.h" | 18 #include "content/browser/site_instance_impl.h" |
19 #include "content/common/drag_event_source_info.h" | 19 #include "content/common/drag_event_source_info.h" |
20 #include "content/public/browser/notification_observer.h" | 20 #include "content/public/browser/notification_observer.h" |
21 #include "content/public/browser/render_view_host.h" | 21 #include "content/public/browser/render_view_host.h" |
22 #include "content/public/common/window_container_type.h" | 22 #include "content/public/common/window_container_type.h" |
23 #include "net/base/load_states.h" | 23 #include "net/base/load_states.h" |
24 #include "third_party/WebKit/public/web/WebAXEnums.h" | 24 #include "third_party/WebKit/public/web/WebAXEnums.h" |
25 #include "third_party/WebKit/public/web/WebConsoleMessage.h" | 25 #include "third_party/WebKit/public/web/WebConsoleMessage.h" |
26 #include "third_party/WebKit/public/web/WebPopupType.h" | 26 #include "third_party/WebKit/public/web/WebPopupType.h" |
27 #include "third_party/skia/include/core/SkColor.h" | 27 #include "third_party/skia/include/core/SkColor.h" |
28 #include "ui/accessibility/ax_node_data.h" | |
29 #include "ui/base/window_open_disposition.h" | 28 #include "ui/base/window_open_disposition.h" |
30 | 29 |
31 class SkBitmap; | 30 class SkBitmap; |
32 class FrameMsg_Navigate; | 31 class FrameMsg_Navigate; |
33 struct AccessibilityHostMsg_EventParams; | |
34 struct AccessibilityHostMsg_LocationChangeParams; | |
35 struct MediaPlayerAction; | 32 struct MediaPlayerAction; |
36 struct ViewHostMsg_CreateWindow_Params; | 33 struct ViewHostMsg_CreateWindow_Params; |
37 struct ViewHostMsg_ShowPopup_Params; | 34 struct ViewHostMsg_ShowPopup_Params; |
38 struct FrameMsg_Navigate_Params; | 35 struct FrameMsg_Navigate_Params; |
39 struct ViewMsg_PostMessage_Params; | 36 struct ViewMsg_PostMessage_Params; |
40 | 37 |
41 namespace base { | 38 namespace base { |
42 class ListValue; | 39 class ListValue; |
43 } | 40 } |
44 | 41 |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 void DidCancelPopupMenu(); | 399 void DidCancelPopupMenu(); |
403 #endif | 400 #endif |
404 | 401 |
405 int main_frame_routing_id() const { | 402 int main_frame_routing_id() const { |
406 return main_frame_routing_id_; | 403 return main_frame_routing_id_; |
407 } | 404 } |
408 | 405 |
409 // Set the opener to null in the renderer process. | 406 // Set the opener to null in the renderer process. |
410 void DisownOpener(); | 407 void DisownOpener(); |
411 | 408 |
412 // Turn on accessibility testing. The given callback will be run | |
413 // every time an accessibility notification is received from the | |
414 // renderer process, and the accessibility tree it sent can be | |
415 // retrieved using accessibility_tree_for_testing(). | |
416 void SetAccessibilityCallbackForTesting( | |
417 const base::Callback<void(ui::AXEvent, int)>& callback); | |
418 | |
419 // Only valid if SetAccessibilityCallbackForTesting was called and | |
420 // the callback was run at least once. Returns a snapshot of the | |
421 // accessibility tree received from the renderer as of the last time | |
422 // an accessibility notification was received. | |
423 const ui::AXTree& ax_tree_for_testing() { | |
424 CHECK(ax_tree_.get()); | |
425 return *ax_tree_.get(); | |
426 } | |
427 | |
428 // Set accessibility callbacks. | |
429 void SetAccessibilityLayoutCompleteCallbackForTesting( | |
430 const base::Closure& callback); | |
431 void SetAccessibilityLoadCompleteCallbackForTesting( | |
432 const base::Closure& callback); | |
433 void SetAccessibilityOtherCallbackForTesting( | |
434 const base::Closure& callback); | |
435 | |
436 bool is_waiting_for_beforeunload_ack() { | 409 bool is_waiting_for_beforeunload_ack() { |
437 return is_waiting_for_beforeunload_ack_; | 410 return is_waiting_for_beforeunload_ack_; |
438 } | 411 } |
439 | 412 |
440 // Whether the RVH is waiting for the unload ack from the renderer. | 413 // Whether the RVH is waiting for the unload ack from the renderer. |
441 bool IsWaitingForUnloadACK() const; | 414 bool IsWaitingForUnloadACK() const; |
442 | 415 |
443 void OnTextSurroundingSelectionResponse(const base::string16& content, | 416 void OnTextSurroundingSelectionResponse(const base::string16& content, |
444 size_t start_offset, | 417 size_t start_offset, |
445 size_t end_offset); | 418 size_t end_offset); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 const SkBitmap& bitmap, | 479 const SkBitmap& bitmap, |
507 const gfx::Vector2d& bitmap_offset_in_dip, | 480 const gfx::Vector2d& bitmap_offset_in_dip, |
508 const DragEventSourceInfo& event_info); | 481 const DragEventSourceInfo& event_info); |
509 void OnUpdateDragCursor(blink::WebDragOperation drag_operation); | 482 void OnUpdateDragCursor(blink::WebDragOperation drag_operation); |
510 void OnTargetDropACK(); | 483 void OnTargetDropACK(); |
511 void OnTakeFocus(bool reverse); | 484 void OnTakeFocus(bool reverse); |
512 void OnFocusedNodeChanged(bool is_editable_node); | 485 void OnFocusedNodeChanged(bool is_editable_node); |
513 void OnUpdateInspectorSetting(const std::string& key, | 486 void OnUpdateInspectorSetting(const std::string& key, |
514 const std::string& value); | 487 const std::string& value); |
515 void OnClosePageACK(); | 488 void OnClosePageACK(); |
516 void OnAccessibilityEvents( | |
517 const std::vector<AccessibilityHostMsg_EventParams>& params); | |
518 void OnAccessibilityLocationChanges( | |
519 const std::vector<AccessibilityHostMsg_LocationChangeParams>& params); | |
520 void OnDidZoomURL(double zoom_level, const GURL& url); | 489 void OnDidZoomURL(double zoom_level, const GURL& url); |
521 void OnRunFileChooser(const FileChooserParams& params); | 490 void OnRunFileChooser(const FileChooserParams& params); |
522 void OnFocusedNodeTouched(bool editable); | 491 void OnFocusedNodeTouched(bool editable); |
523 | 492 |
524 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 493 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
525 void OnShowPopup(const ViewHostMsg_ShowPopup_Params& params); | 494 void OnShowPopup(const ViewHostMsg_ShowPopup_Params& params); |
526 void OnHidePopup(); | 495 void OnHidePopup(); |
527 #endif | 496 #endif |
528 | 497 |
529 private: | 498 private: |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state. | 571 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state. |
603 bool is_waiting_for_beforeunload_ack_; | 572 bool is_waiting_for_beforeunload_ack_; |
604 | 573 |
605 // Valid only when is_waiting_for_beforeunload_ack_ or | 574 // Valid only when is_waiting_for_beforeunload_ack_ or |
606 // IsWaitingForUnloadACK is true. This tells us if the unload request | 575 // IsWaitingForUnloadACK is true. This tells us if the unload request |
607 // is for closing the entire tab ( = false), or only this RenderViewHost in | 576 // is for closing the entire tab ( = false), or only this RenderViewHost in |
608 // the case of a cross-site transition ( = true). | 577 // the case of a cross-site transition ( = true). |
609 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state. | 578 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state. |
610 bool unload_ack_is_for_cross_site_transition_; | 579 bool unload_ack_is_for_cross_site_transition_; |
611 | 580 |
612 // Accessibility callback for testing. | |
613 base::Callback<void(ui::AXEvent, int)> accessibility_testing_callback_; | |
614 | |
615 // The most recently received accessibility tree - for testing only. | |
616 scoped_ptr<ui::AXTree> ax_tree_; | |
617 | |
618 // True if the render view can be shut down suddenly. | 581 // True if the render view can be shut down suddenly. |
619 bool sudden_termination_allowed_; | 582 bool sudden_termination_allowed_; |
620 | 583 |
621 // The termination status of the last render view that terminated. | 584 // The termination status of the last render view that terminated. |
622 base::TerminationStatus render_view_termination_status_; | 585 base::TerminationStatus render_view_termination_status_; |
623 | 586 |
624 // Set to true if we requested the on screen keyboard to be displayed. | 587 // Set to true if we requested the on screen keyboard to be displayed. |
625 bool virtual_keyboard_requested_; | 588 bool virtual_keyboard_requested_; |
626 | 589 |
627 #if defined(ENABLE_BROWSER_CDMS) | 590 #if defined(ENABLE_BROWSER_CDMS) |
(...skipping 25 matching lines...) Expand all Loading... |
653 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImpl); | 616 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImpl); |
654 }; | 617 }; |
655 | 618 |
656 #if defined(COMPILER_MSVC) | 619 #if defined(COMPILER_MSVC) |
657 #pragma warning(pop) | 620 #pragma warning(pop) |
658 #endif | 621 #endif |
659 | 622 |
660 } // namespace content | 623 } // namespace content |
661 | 624 |
662 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_ | 625 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_ |
OLD | NEW |