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_RENDERER_RENDER_VIEW_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ |
6 #define CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ | 6 #define CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 // Invokes OnSetFocus and marks the widget as active depending on the value | 323 // Invokes OnSetFocus and marks the widget as active depending on the value |
324 // of |enable|. This is used for layout tests that need to control the focus | 324 // of |enable|. This is used for layout tests that need to control the focus |
325 // synchronously from the renderer. | 325 // synchronously from the renderer. |
326 void SetFocusAndActivateForTesting(bool enable); | 326 void SetFocusAndActivateForTesting(bool enable); |
327 | 327 |
328 // Change the device scale factor and force the compositor to resize. | 328 // Change the device scale factor and force the compositor to resize. |
329 void SetDeviceScaleFactorForTesting(float factor); | 329 void SetDeviceScaleFactorForTesting(float factor); |
330 | 330 |
331 // Change the device ICC color profile while running a layout test. | 331 // Change the device ICC color profile while running a layout test. |
332 void SetDeviceColorProfileForTesting(const std::vector<char>& color_profile); | 332 void SetDeviceColorProfileForTesting(const std::vector<char>& color_profile); |
333 virtual void ResetDeviceColorProfileForTesting() override; | 333 void ResetDeviceColorProfileForTesting() override; |
334 | 334 |
335 // Used to force the size of a window when running layout tests. | 335 // Used to force the size of a window when running layout tests. |
336 void ForceResizeForTesting(const gfx::Size& new_size); | 336 void ForceResizeForTesting(const gfx::Size& new_size); |
337 | 337 |
338 void UseSynchronousResizeModeForTesting(bool enable); | 338 void UseSynchronousResizeModeForTesting(bool enable); |
339 | 339 |
340 // Control autoresize mode. | 340 // Control autoresize mode. |
341 void EnableAutoResizeForTesting(const gfx::Size& min_size, | 341 void EnableAutoResizeForTesting(const gfx::Size& min_size, |
342 const gfx::Size& max_size); | 342 const gfx::Size& max_size); |
343 void DisableAutoResizeForTesting(const gfx::Size& new_size); | 343 void DisableAutoResizeForTesting(const gfx::Size& new_size); |
344 | 344 |
345 // IPC::Listener implementation ---------------------------------------------- | 345 // IPC::Listener implementation ---------------------------------------------- |
346 | 346 |
347 virtual bool OnMessageReceived(const IPC::Message& msg) override; | 347 bool OnMessageReceived(const IPC::Message& msg) override; |
348 | 348 |
349 // blink::WebWidgetClient implementation ------------------------------------ | 349 // blink::WebWidgetClient implementation ------------------------------------ |
350 | 350 |
351 // Most methods are handled by RenderWidget. | 351 // Most methods are handled by RenderWidget. |
352 virtual void didFocus(); | 352 virtual void didFocus(); |
353 virtual void didBlur(); | 353 virtual void didBlur(); |
354 virtual void show(blink::WebNavigationPolicy policy); | 354 virtual void show(blink::WebNavigationPolicy policy); |
355 virtual void runModal(); | 355 virtual void runModal(); |
356 virtual bool enterFullScreen(); | 356 virtual bool enterFullScreen(); |
357 virtual void exitFullScreen(); | 357 virtual void exitFullScreen(); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 | 446 |
447 // blink::WebPageSerializerClient implementation ---------------------------- | 447 // blink::WebPageSerializerClient implementation ---------------------------- |
448 | 448 |
449 virtual void didSerializeDataForFrame( | 449 virtual void didSerializeDataForFrame( |
450 const blink::WebURL& frame_url, | 450 const blink::WebURL& frame_url, |
451 const blink::WebCString& data, | 451 const blink::WebCString& data, |
452 PageSerializationStatus status) override; | 452 PageSerializationStatus status) override; |
453 | 453 |
454 // RenderView implementation ------------------------------------------------- | 454 // RenderView implementation ------------------------------------------------- |
455 | 455 |
456 virtual bool Send(IPC::Message* message) override; | 456 bool Send(IPC::Message* message) override; |
457 virtual RenderFrameImpl* GetMainRenderFrame() override; | 457 RenderFrameImpl* GetMainRenderFrame() override; |
458 virtual int GetRoutingID() const override; | 458 int GetRoutingID() const override; |
459 virtual gfx::Size GetSize() const override; | 459 gfx::Size GetSize() const override; |
460 virtual WebPreferences& GetWebkitPreferences() override; | 460 WebPreferences& GetWebkitPreferences() override; |
461 virtual void SetWebkitPreferences(const WebPreferences& preferences) override; | 461 void SetWebkitPreferences(const WebPreferences& preferences) override; |
462 virtual blink::WebView* GetWebView() override; | 462 blink::WebView* GetWebView() override; |
463 virtual blink::WebElement GetFocusedElement() const override; | 463 blink::WebElement GetFocusedElement() const override; |
464 virtual bool IsEditableNode(const blink::WebNode& node) const override; | 464 bool IsEditableNode(const blink::WebNode& node) const override; |
465 virtual bool NodeContainsPoint(const blink::WebNode& node, | 465 bool NodeContainsPoint(const blink::WebNode& node, |
466 const gfx::Point& point) const override; | 466 const gfx::Point& point) const override; |
467 virtual bool ShouldDisplayScrollbars(int width, int height) const override; | 467 bool ShouldDisplayScrollbars(int width, int height) const override; |
468 virtual int GetEnabledBindings() const override; | 468 int GetEnabledBindings() const override; |
469 virtual bool GetContentStateImmediately() const override; | 469 bool GetContentStateImmediately() const override; |
470 virtual blink::WebPageVisibilityState GetVisibilityState() const override; | 470 blink::WebPageVisibilityState GetVisibilityState() const override; |
471 virtual void DidStartLoading() override; | 471 void DidStartLoading() override; |
472 virtual void DidStopLoading() override; | 472 void DidStopLoading() override; |
473 virtual void Repaint(const gfx::Size& size) override; | 473 void Repaint(const gfx::Size& size) override; |
474 virtual void SetEditCommandForNextKeyEvent(const std::string& name, | 474 void SetEditCommandForNextKeyEvent(const std::string& name, |
475 const std::string& value) override; | 475 const std::string& value) override; |
476 virtual void ClearEditCommands() override; | 476 void ClearEditCommands() override; |
477 virtual SSLStatus GetSSLStatusOfFrame(blink::WebFrame* frame) const override; | 477 SSLStatus GetSSLStatusOfFrame(blink::WebFrame* frame) const override; |
478 virtual const std::string& GetAcceptLanguages() const override; | 478 const std::string& GetAcceptLanguages() const override; |
479 #if defined(OS_ANDROID) | 479 #if defined(OS_ANDROID) |
480 virtual void UpdateTopControlsState(TopControlsState constraints, | 480 virtual void UpdateTopControlsState(TopControlsState constraints, |
481 TopControlsState current, | 481 TopControlsState current, |
482 bool animate) override; | 482 bool animate) override; |
483 #endif | 483 #endif |
484 bool uses_temporary_zoom_level() const { return uses_temporary_zoom_level_; } | 484 bool uses_temporary_zoom_level() const { return uses_temporary_zoom_level_; } |
485 | 485 |
486 // Please do not add your stuff randomly to the end here. If there is an | 486 // Please do not add your stuff randomly to the end here. If there is an |
487 // appropriate section, add it there. If not, there are some random functions | 487 // appropriate section, add it there. If not, there are some random functions |
488 // nearer to the top you can add it to. | 488 // nearer to the top you can add it to. |
489 | 489 |
490 // Cannot use std::set unfortunately since linked_ptr<> does not support | 490 // Cannot use std::set unfortunately since linked_ptr<> does not support |
491 // operator<. | 491 // operator<. |
492 typedef std::vector<linked_ptr<ImageResourceFetcher> > | 492 typedef std::vector<linked_ptr<ImageResourceFetcher> > |
493 ImageResourceFetcherList; | 493 ImageResourceFetcherList; |
494 | 494 |
495 protected: | 495 protected: |
496 // RenderWidget overrides: | 496 // RenderWidget overrides: |
497 virtual void OnClose() override; | 497 void OnClose() override; |
498 virtual void Close() override; | 498 void Close() override; |
499 virtual void OnResize(const ViewMsg_Resize_Params& params) override; | 499 void OnResize(const ViewMsg_Resize_Params& params) override; |
500 virtual void DidInitiatePaint() override; | 500 void DidInitiatePaint() override; |
501 virtual void DidFlushPaint() override; | 501 void DidFlushPaint() override; |
502 virtual gfx::Vector2d GetScrollOffset() override; | 502 gfx::Vector2d GetScrollOffset() override; |
503 virtual void DidHandleKeyEvent() override; | 503 void DidHandleKeyEvent() override; |
504 virtual bool WillHandleMouseEvent( | 504 bool WillHandleMouseEvent(const blink::WebMouseEvent& event) override; |
505 const blink::WebMouseEvent& event) override; | 505 bool WillHandleGestureEvent(const blink::WebGestureEvent& event) override; |
506 virtual bool WillHandleGestureEvent( | 506 void DidHandleMouseEvent(const blink::WebMouseEvent& event) override; |
507 const blink::WebGestureEvent& event) override; | 507 void DidHandleTouchEvent(const blink::WebTouchEvent& event) override; |
508 virtual void DidHandleMouseEvent(const blink::WebMouseEvent& event) override; | 508 bool HasTouchEventHandlersAt(const gfx::Point& point) const override; |
509 virtual void DidHandleTouchEvent(const blink::WebTouchEvent& event) override; | 509 void OnSetFocus(bool enable) override; |
510 virtual bool HasTouchEventHandlersAt(const gfx::Point& point) const override; | 510 void OnWasHidden() override; |
511 virtual void OnSetFocus(bool enable) override; | 511 void OnWasShown(bool needs_repainting, |
512 virtual void OnWasHidden() override; | 512 const ui::LatencyInfo& latency_info) override; |
513 virtual void OnWasShown(bool needs_repainting, | 513 GURL GetURLForGraphicsContext3D() override; |
514 const ui::LatencyInfo& latency_info) override; | 514 void OnImeSetComposition( |
515 virtual GURL GetURLForGraphicsContext3D() override; | |
516 virtual void OnImeSetComposition( | |
517 const base::string16& text, | 515 const base::string16& text, |
518 const std::vector<blink::WebCompositionUnderline>& underlines, | 516 const std::vector<blink::WebCompositionUnderline>& underlines, |
519 int selection_start, | 517 int selection_start, |
520 int selection_end) override; | 518 int selection_end) override; |
521 virtual void OnImeConfirmComposition(const base::string16& text, | 519 void OnImeConfirmComposition(const base::string16& text, |
522 const gfx::Range& replacement_range, | 520 const gfx::Range& replacement_range, |
523 bool keep_selection) override; | 521 bool keep_selection) override; |
524 virtual void SetDeviceScaleFactor(float device_scale_factor) override; | 522 void SetDeviceScaleFactor(float device_scale_factor) override; |
525 virtual bool SetDeviceColorProfile( | 523 bool SetDeviceColorProfile(const std::vector<char>& color_profile) override; |
526 const std::vector<char>& color_profile) override; | 524 void OnOrientationChange() override; |
527 virtual void OnOrientationChange() override; | 525 ui::TextInputType GetTextInputType() override; |
528 virtual ui::TextInputType GetTextInputType() override; | 526 void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) override; |
529 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) override; | |
530 #if defined(OS_MACOSX) || defined(USE_AURA) | 527 #if defined(OS_MACOSX) || defined(USE_AURA) |
531 virtual void GetCompositionCharacterBounds( | 528 void GetCompositionCharacterBounds( |
532 std::vector<gfx::Rect>* character_bounds) override; | 529 std::vector<gfx::Rect>* character_bounds) override; |
533 virtual void GetCompositionRange(gfx::Range* range) override; | 530 void GetCompositionRange(gfx::Range* range) override; |
534 #endif | 531 #endif |
535 virtual bool CanComposeInline() override; | 532 bool CanComposeInline() override; |
536 virtual void DidCommitCompositorFrame() override; | 533 void DidCommitCompositorFrame() override; |
537 virtual void InstrumentWillBeginFrame(int frame_id) override; | 534 void InstrumentWillBeginFrame(int frame_id) override; |
538 virtual void InstrumentDidBeginFrame() override; | 535 void InstrumentDidBeginFrame() override; |
539 virtual void InstrumentDidCancelFrame() override; | 536 void InstrumentDidCancelFrame() override; |
540 virtual void InstrumentWillComposite() override; | 537 void InstrumentWillComposite() override; |
541 | 538 |
542 protected: | 539 protected: |
543 explicit RenderViewImpl(RenderViewImplParams* params); | 540 explicit RenderViewImpl(RenderViewImplParams* params); |
544 | 541 |
545 void Initialize(RenderViewImplParams* params); | 542 void Initialize(RenderViewImplParams* params); |
546 virtual void SetScreenMetricsEmulationParameters( | 543 void SetScreenMetricsEmulationParameters(float device_scale_factor, |
547 float device_scale_factor, | 544 const gfx::Point& root_layer_offset, |
548 const gfx::Point& root_layer_offset, | 545 float root_layer_scale) override; |
549 float root_layer_scale) override; | |
550 | 546 |
551 // Do not delete directly. This class is reference counted. | 547 // Do not delete directly. This class is reference counted. |
552 virtual ~RenderViewImpl(); | 548 virtual ~RenderViewImpl(); |
553 | 549 |
554 private: | 550 private: |
555 // For unit tests. | 551 // For unit tests. |
556 friend class PepperDeviceTest; | 552 friend class PepperDeviceTest; |
557 friend class RenderViewImplTest; | 553 friend class RenderViewImplTest; |
558 friend class RenderViewTest; | 554 friend class RenderViewTest; |
559 friend class RendererAccessibilityTest; | 555 friend class RendererAccessibilityTest; |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 // use the Observer interface to filter IPC messages and receive frame change | 1106 // use the Observer interface to filter IPC messages and receive frame change |
1111 // notifications. | 1107 // notifications. |
1112 // --------------------------------------------------------------------------- | 1108 // --------------------------------------------------------------------------- |
1113 | 1109 |
1114 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl); | 1110 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl); |
1115 }; | 1111 }; |
1116 | 1112 |
1117 } // namespace content | 1113 } // namespace content |
1118 | 1114 |
1119 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ | 1115 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ |
OLD | NEW |