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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 // Invokes OnSetFocus and marks the widget as active depending on the value | 326 // Invokes OnSetFocus and marks the widget as active depending on the value |
327 // of |enable|. This is used for layout tests that need to control the focus | 327 // of |enable|. This is used for layout tests that need to control the focus |
328 // synchronously from the renderer. | 328 // synchronously from the renderer. |
329 void SetFocusAndActivateForTesting(bool enable); | 329 void SetFocusAndActivateForTesting(bool enable); |
330 | 330 |
331 // Change the device scale factor and force the compositor to resize. | 331 // Change the device scale factor and force the compositor to resize. |
332 void SetDeviceScaleFactorForTesting(float factor); | 332 void SetDeviceScaleFactorForTesting(float factor); |
333 | 333 |
334 // Change the device ICC color profile while running a layout test. | 334 // Change the device ICC color profile while running a layout test. |
335 void SetDeviceColorProfileForTesting(const std::vector<char>& color_profile); | 335 void SetDeviceColorProfileForTesting(const std::vector<char>& color_profile); |
336 virtual void ResetDeviceColorProfileForTesting() OVERRIDE; | 336 virtual void ResetDeviceColorProfileForTesting() override; |
337 | 337 |
338 // Used to force the size of a window when running layout tests. | 338 // Used to force the size of a window when running layout tests. |
339 void ForceResizeForTesting(const gfx::Size& new_size); | 339 void ForceResizeForTesting(const gfx::Size& new_size); |
340 | 340 |
341 void UseSynchronousResizeModeForTesting(bool enable); | 341 void UseSynchronousResizeModeForTesting(bool enable); |
342 | 342 |
343 // Control autoresize mode. | 343 // Control autoresize mode. |
344 void EnableAutoResizeForTesting(const gfx::Size& min_size, | 344 void EnableAutoResizeForTesting(const gfx::Size& min_size, |
345 const gfx::Size& max_size); | 345 const gfx::Size& max_size); |
346 void DisableAutoResizeForTesting(const gfx::Size& new_size); | 346 void DisableAutoResizeForTesting(const gfx::Size& new_size); |
347 | 347 |
348 // IPC::Listener implementation ---------------------------------------------- | 348 // IPC::Listener implementation ---------------------------------------------- |
349 | 349 |
350 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 350 virtual bool OnMessageReceived(const IPC::Message& msg) override; |
351 | 351 |
352 // blink::WebWidgetClient implementation ------------------------------------ | 352 // blink::WebWidgetClient implementation ------------------------------------ |
353 | 353 |
354 // Most methods are handled by RenderWidget. | 354 // Most methods are handled by RenderWidget. |
355 virtual void didFocus(); | 355 virtual void didFocus(); |
356 virtual void didBlur(); | 356 virtual void didBlur(); |
357 virtual void show(blink::WebNavigationPolicy policy); | 357 virtual void show(blink::WebNavigationPolicy policy); |
358 virtual void runModal(); | 358 virtual void runModal(); |
359 virtual bool enterFullScreen(); | 359 virtual bool enterFullScreen(); |
360 virtual void exitFullScreen(); | 360 virtual void exitFullScreen(); |
361 virtual bool requestPointerLock(); | 361 virtual bool requestPointerLock(); |
362 virtual void requestPointerUnlock(); | 362 virtual void requestPointerUnlock(); |
363 virtual bool isPointerLocked(); | 363 virtual bool isPointerLocked(); |
364 virtual void didHandleGestureEvent(const blink::WebGestureEvent& event, | 364 virtual void didHandleGestureEvent(const blink::WebGestureEvent& event, |
365 bool event_cancelled) OVERRIDE; | 365 bool event_cancelled) override; |
366 virtual void initializeLayerTreeView() OVERRIDE; | 366 virtual void initializeLayerTreeView() override; |
367 | 367 |
368 // blink::WebViewClient implementation -------------------------------------- | 368 // blink::WebViewClient implementation -------------------------------------- |
369 | 369 |
370 virtual blink::WebView* createView(blink::WebLocalFrame* creator, | 370 virtual blink::WebView* createView(blink::WebLocalFrame* creator, |
371 const blink::WebURLRequest& request, | 371 const blink::WebURLRequest& request, |
372 const blink::WebWindowFeatures& features, | 372 const blink::WebWindowFeatures& features, |
373 const blink::WebString& frame_name, | 373 const blink::WebString& frame_name, |
374 blink::WebNavigationPolicy policy, | 374 blink::WebNavigationPolicy policy, |
375 bool suppress_opener); | 375 bool suppress_opener); |
376 virtual blink::WebWidget* createPopupMenu(blink::WebPopupType popup_type); | 376 virtual blink::WebWidget* createPopupMenu(blink::WebPopupType popup_type); |
377 virtual blink::WebStorageNamespace* createSessionStorageNamespace(); | 377 virtual blink::WebStorageNamespace* createSessionStorageNamespace(); |
378 virtual void printPage(blink::WebLocalFrame* frame); | 378 virtual void printPage(blink::WebLocalFrame* frame); |
379 virtual bool enumerateChosenDirectory( | 379 virtual bool enumerateChosenDirectory( |
380 const blink::WebString& path, | 380 const blink::WebString& path, |
381 blink::WebFileChooserCompletion* chooser_completion); | 381 blink::WebFileChooserCompletion* chooser_completion); |
382 virtual void saveImageFromDataURL(const blink::WebString& data_url); | 382 virtual void saveImageFromDataURL(const blink::WebString& data_url); |
383 virtual void didCancelCompositionOnSelectionChange(); | 383 virtual void didCancelCompositionOnSelectionChange(); |
384 virtual bool handleCurrentKeyboardEvent(); | 384 virtual bool handleCurrentKeyboardEvent(); |
385 virtual bool runFileChooser( | 385 virtual bool runFileChooser( |
386 const blink::WebFileChooserParams& params, | 386 const blink::WebFileChooserParams& params, |
387 blink::WebFileChooserCompletion* chooser_completion); | 387 blink::WebFileChooserCompletion* chooser_completion); |
388 void SetValidationMessageDirection(base::string16* main_text, | 388 void SetValidationMessageDirection(base::string16* main_text, |
389 blink::WebTextDirection main_text_hint, | 389 blink::WebTextDirection main_text_hint, |
390 base::string16* sub_text, | 390 base::string16* sub_text, |
391 blink::WebTextDirection sub_text_hint); | 391 blink::WebTextDirection sub_text_hint); |
392 virtual void showValidationMessage(const blink::WebRect& anchor_in_root_view, | 392 virtual void showValidationMessage(const blink::WebRect& anchor_in_root_view, |
393 const blink::WebString& main_text, | 393 const blink::WebString& main_text, |
394 blink::WebTextDirection main_text_hint, | 394 blink::WebTextDirection main_text_hint, |
395 const blink::WebString& sub_text, | 395 const blink::WebString& sub_text, |
396 blink::WebTextDirection hint) OVERRIDE; | 396 blink::WebTextDirection hint) override; |
397 virtual void hideValidationMessage() OVERRIDE; | 397 virtual void hideValidationMessage() override; |
398 virtual void moveValidationMessage( | 398 virtual void moveValidationMessage( |
399 const blink::WebRect& anchor_in_root_view) OVERRIDE; | 399 const blink::WebRect& anchor_in_root_view) override; |
400 virtual void setStatusText(const blink::WebString& text); | 400 virtual void setStatusText(const blink::WebString& text); |
401 virtual void setMouseOverURL(const blink::WebURL& url); | 401 virtual void setMouseOverURL(const blink::WebURL& url); |
402 virtual void setKeyboardFocusURL(const blink::WebURL& url); | 402 virtual void setKeyboardFocusURL(const blink::WebURL& url); |
403 virtual void startDragging(blink::WebLocalFrame* frame, | 403 virtual void startDragging(blink::WebLocalFrame* frame, |
404 const blink::WebDragData& data, | 404 const blink::WebDragData& data, |
405 blink::WebDragOperationsMask mask, | 405 blink::WebDragOperationsMask mask, |
406 const blink::WebImage& image, | 406 const blink::WebImage& image, |
407 const blink::WebPoint& imageOffset); | 407 const blink::WebPoint& imageOffset); |
408 virtual bool acceptsLoadDrops(); | 408 virtual bool acceptsLoadDrops(); |
409 virtual void focusNext(); | 409 virtual void focusNext(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 virtual bool openDateTimeChooser(const blink::WebDateTimeChooserParams&, | 445 virtual bool openDateTimeChooser(const blink::WebDateTimeChooserParams&, |
446 blink::WebDateTimeChooserCompletion*); | 446 blink::WebDateTimeChooserCompletion*); |
447 virtual void didScrollWithKeyboard(const blink::WebSize& delta); | 447 virtual void didScrollWithKeyboard(const blink::WebSize& delta); |
448 #endif | 448 #endif |
449 | 449 |
450 // blink::WebPageSerializerClient implementation ---------------------------- | 450 // blink::WebPageSerializerClient implementation ---------------------------- |
451 | 451 |
452 virtual void didSerializeDataForFrame( | 452 virtual void didSerializeDataForFrame( |
453 const blink::WebURL& frame_url, | 453 const blink::WebURL& frame_url, |
454 const blink::WebCString& data, | 454 const blink::WebCString& data, |
455 PageSerializationStatus status) OVERRIDE; | 455 PageSerializationStatus status) override; |
456 | 456 |
457 // RenderView implementation ------------------------------------------------- | 457 // RenderView implementation ------------------------------------------------- |
458 | 458 |
459 virtual bool Send(IPC::Message* message) OVERRIDE; | 459 virtual bool Send(IPC::Message* message) override; |
460 virtual RenderFrameImpl* GetMainRenderFrame() OVERRIDE; | 460 virtual RenderFrameImpl* GetMainRenderFrame() override; |
461 virtual int GetRoutingID() const OVERRIDE; | 461 virtual int GetRoutingID() const override; |
462 virtual gfx::Size GetSize() const OVERRIDE; | 462 virtual gfx::Size GetSize() const override; |
463 virtual WebPreferences& GetWebkitPreferences() OVERRIDE; | 463 virtual WebPreferences& GetWebkitPreferences() override; |
464 virtual void SetWebkitPreferences(const WebPreferences& preferences) OVERRIDE; | 464 virtual void SetWebkitPreferences(const WebPreferences& preferences) override; |
465 virtual blink::WebView* GetWebView() OVERRIDE; | 465 virtual blink::WebView* GetWebView() override; |
466 virtual blink::WebElement GetFocusedElement() const OVERRIDE; | 466 virtual blink::WebElement GetFocusedElement() const override; |
467 virtual bool IsEditableNode(const blink::WebNode& node) const OVERRIDE; | 467 virtual bool IsEditableNode(const blink::WebNode& node) const override; |
468 virtual bool NodeContainsPoint(const blink::WebNode& node, | 468 virtual bool NodeContainsPoint(const blink::WebNode& node, |
469 const gfx::Point& point) const OVERRIDE; | 469 const gfx::Point& point) const override; |
470 virtual bool ShouldDisplayScrollbars(int width, int height) const OVERRIDE; | 470 virtual bool ShouldDisplayScrollbars(int width, int height) const override; |
471 virtual int GetEnabledBindings() const OVERRIDE; | 471 virtual int GetEnabledBindings() const override; |
472 virtual bool GetContentStateImmediately() const OVERRIDE; | 472 virtual bool GetContentStateImmediately() const override; |
473 virtual blink::WebPageVisibilityState GetVisibilityState() const OVERRIDE; | 473 virtual blink::WebPageVisibilityState GetVisibilityState() const override; |
474 virtual void DidStartLoading() OVERRIDE; | 474 virtual void DidStartLoading() override; |
475 virtual void DidStopLoading() OVERRIDE; | 475 virtual void DidStopLoading() override; |
476 virtual void Repaint(const gfx::Size& size) OVERRIDE; | 476 virtual void Repaint(const gfx::Size& size) override; |
477 virtual void SetEditCommandForNextKeyEvent(const std::string& name, | 477 virtual void SetEditCommandForNextKeyEvent(const std::string& name, |
478 const std::string& value) OVERRIDE; | 478 const std::string& value) override; |
479 virtual void ClearEditCommands() OVERRIDE; | 479 virtual void ClearEditCommands() override; |
480 virtual SSLStatus GetSSLStatusOfFrame(blink::WebFrame* frame) const OVERRIDE; | 480 virtual SSLStatus GetSSLStatusOfFrame(blink::WebFrame* frame) const override; |
481 virtual const std::string& GetAcceptLanguages() const OVERRIDE; | 481 virtual const std::string& GetAcceptLanguages() const override; |
482 #if defined(OS_ANDROID) | 482 #if defined(OS_ANDROID) |
483 virtual void UpdateTopControlsState(TopControlsState constraints, | 483 virtual void UpdateTopControlsState(TopControlsState constraints, |
484 TopControlsState current, | 484 TopControlsState current, |
485 bool animate) OVERRIDE; | 485 bool animate) override; |
486 #endif | 486 #endif |
487 bool uses_temporary_zoom_level() const { return uses_temporary_zoom_level_; } | 487 bool uses_temporary_zoom_level() const { return uses_temporary_zoom_level_; } |
488 | 488 |
489 // Please do not add your stuff randomly to the end here. If there is an | 489 // Please do not add your stuff randomly to the end here. If there is an |
490 // appropriate section, add it there. If not, there are some random functions | 490 // appropriate section, add it there. If not, there are some random functions |
491 // nearer to the top you can add it to. | 491 // nearer to the top you can add it to. |
492 | 492 |
493 // Cannot use std::set unfortunately since linked_ptr<> does not support | 493 // Cannot use std::set unfortunately since linked_ptr<> does not support |
494 // operator<. | 494 // operator<. |
495 typedef std::vector<linked_ptr<ImageResourceFetcher> > | 495 typedef std::vector<linked_ptr<ImageResourceFetcher> > |
496 ImageResourceFetcherList; | 496 ImageResourceFetcherList; |
497 | 497 |
498 protected: | 498 protected: |
499 // RenderWidget overrides: | 499 // RenderWidget overrides: |
500 virtual void OnClose() OVERRIDE; | 500 virtual void OnClose() override; |
501 virtual void Close() OVERRIDE; | 501 virtual void Close() override; |
502 virtual void OnResize(const ViewMsg_Resize_Params& params) OVERRIDE; | 502 virtual void OnResize(const ViewMsg_Resize_Params& params) override; |
503 virtual void DidInitiatePaint() OVERRIDE; | 503 virtual void DidInitiatePaint() override; |
504 virtual void DidFlushPaint() OVERRIDE; | 504 virtual void DidFlushPaint() override; |
505 virtual gfx::Vector2d GetScrollOffset() OVERRIDE; | 505 virtual gfx::Vector2d GetScrollOffset() override; |
506 virtual void DidHandleKeyEvent() OVERRIDE; | 506 virtual void DidHandleKeyEvent() override; |
507 virtual bool WillHandleMouseEvent( | 507 virtual bool WillHandleMouseEvent( |
508 const blink::WebMouseEvent& event) OVERRIDE; | 508 const blink::WebMouseEvent& event) override; |
509 virtual bool WillHandleGestureEvent( | 509 virtual bool WillHandleGestureEvent( |
510 const blink::WebGestureEvent& event) OVERRIDE; | 510 const blink::WebGestureEvent& event) override; |
511 virtual void DidHandleMouseEvent(const blink::WebMouseEvent& event) OVERRIDE; | 511 virtual void DidHandleMouseEvent(const blink::WebMouseEvent& event) override; |
512 virtual void DidHandleTouchEvent(const blink::WebTouchEvent& event) OVERRIDE; | 512 virtual void DidHandleTouchEvent(const blink::WebTouchEvent& event) override; |
513 virtual bool HasTouchEventHandlersAt(const gfx::Point& point) const OVERRIDE; | 513 virtual bool HasTouchEventHandlersAt(const gfx::Point& point) const override; |
514 virtual void OnSetFocus(bool enable) OVERRIDE; | 514 virtual void OnSetFocus(bool enable) override; |
515 virtual void OnWasHidden() OVERRIDE; | 515 virtual void OnWasHidden() override; |
516 virtual void OnWasShown(bool needs_repainting, | 516 virtual void OnWasShown(bool needs_repainting, |
517 const ui::LatencyInfo& latency_info) OVERRIDE; | 517 const ui::LatencyInfo& latency_info) override; |
518 virtual GURL GetURLForGraphicsContext3D() OVERRIDE; | 518 virtual GURL GetURLForGraphicsContext3D() override; |
519 virtual void OnImeSetComposition( | 519 virtual void OnImeSetComposition( |
520 const base::string16& text, | 520 const base::string16& text, |
521 const std::vector<blink::WebCompositionUnderline>& underlines, | 521 const std::vector<blink::WebCompositionUnderline>& underlines, |
522 int selection_start, | 522 int selection_start, |
523 int selection_end) OVERRIDE; | 523 int selection_end) override; |
524 virtual void OnImeConfirmComposition(const base::string16& text, | 524 virtual void OnImeConfirmComposition(const base::string16& text, |
525 const gfx::Range& replacement_range, | 525 const gfx::Range& replacement_range, |
526 bool keep_selection) OVERRIDE; | 526 bool keep_selection) override; |
527 virtual void SetDeviceScaleFactor(float device_scale_factor) OVERRIDE; | 527 virtual void SetDeviceScaleFactor(float device_scale_factor) override; |
528 virtual bool SetDeviceColorProfile( | 528 virtual bool SetDeviceColorProfile( |
529 const std::vector<char>& color_profile) OVERRIDE; | 529 const std::vector<char>& color_profile) override; |
530 virtual void OnOrientationChange() OVERRIDE; | 530 virtual void OnOrientationChange() override; |
531 virtual ui::TextInputType GetTextInputType() OVERRIDE; | 531 virtual ui::TextInputType GetTextInputType() override; |
532 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) OVERRIDE; | 532 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) override; |
533 #if defined(OS_MACOSX) || defined(USE_AURA) | 533 #if defined(OS_MACOSX) || defined(USE_AURA) |
534 virtual void GetCompositionCharacterBounds( | 534 virtual void GetCompositionCharacterBounds( |
535 std::vector<gfx::Rect>* character_bounds) OVERRIDE; | 535 std::vector<gfx::Rect>* character_bounds) override; |
536 virtual void GetCompositionRange(gfx::Range* range) OVERRIDE; | 536 virtual void GetCompositionRange(gfx::Range* range) override; |
537 #endif | 537 #endif |
538 virtual bool CanComposeInline() OVERRIDE; | 538 virtual bool CanComposeInline() override; |
539 virtual void DidCommitCompositorFrame() OVERRIDE; | 539 virtual void DidCommitCompositorFrame() override; |
540 virtual void InstrumentWillBeginFrame(int frame_id) OVERRIDE; | 540 virtual void InstrumentWillBeginFrame(int frame_id) override; |
541 virtual void InstrumentDidBeginFrame() OVERRIDE; | 541 virtual void InstrumentDidBeginFrame() override; |
542 virtual void InstrumentDidCancelFrame() OVERRIDE; | 542 virtual void InstrumentDidCancelFrame() override; |
543 virtual void InstrumentWillComposite() OVERRIDE; | 543 virtual void InstrumentWillComposite() override; |
544 | 544 |
545 protected: | 545 protected: |
546 explicit RenderViewImpl(RenderViewImplParams* params); | 546 explicit RenderViewImpl(RenderViewImplParams* params); |
547 | 547 |
548 void Initialize(RenderViewImplParams* params); | 548 void Initialize(RenderViewImplParams* params); |
549 virtual void SetScreenMetricsEmulationParameters( | 549 virtual void SetScreenMetricsEmulationParameters( |
550 float device_scale_factor, | 550 float device_scale_factor, |
551 const gfx::Point& root_layer_offset, | 551 const gfx::Point& root_layer_offset, |
552 float root_layer_scale) OVERRIDE; | 552 float root_layer_scale) override; |
553 | 553 |
554 // Do not delete directly. This class is reference counted. | 554 // Do not delete directly. This class is reference counted. |
555 virtual ~RenderViewImpl(); | 555 virtual ~RenderViewImpl(); |
556 | 556 |
557 private: | 557 private: |
558 // For unit tests. | 558 // For unit tests. |
559 friend class PepperDeviceTest; | 559 friend class PepperDeviceTest; |
560 friend class RenderViewImplTest; | 560 friend class RenderViewImplTest; |
561 friend class RenderViewTest; | 561 friend class RenderViewTest; |
562 friend class RendererAccessibilityTest; | 562 friend class RendererAccessibilityTest; |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 // use the Observer interface to filter IPC messages and receive frame change | 1113 // use the Observer interface to filter IPC messages and receive frame change |
1114 // notifications. | 1114 // notifications. |
1115 // --------------------------------------------------------------------------- | 1115 // --------------------------------------------------------------------------- |
1116 | 1116 |
1117 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl); | 1117 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl); |
1118 }; | 1118 }; |
1119 | 1119 |
1120 } // namespace content | 1120 } // namespace content |
1121 | 1121 |
1122 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ | 1122 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ |
OLD | NEW |