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
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_RENDER_VIEW_IMPL_H_
6 #define CONTENT_RENDERER_RENDER_VIEW_IMPL_H_
14 #include "base/basictypes.h"
15 #include "base/gtest_prod_util.h"
16 #include "base/id_map.h"
17 #include "base/memory/linked_ptr.h"
18 #include "base/memory/weak_ptr.h"
19 #include "base/observer_list.h"
20 #include "base/process/process.h"
21 #include "base/strings/string16.h"
22 #include "base/timer/timer.h"
23 #include "build/build_config.h"
24 #include "cc/input/top_controls_state.h"
25 #include "cc/resources/shared_bitmap.h"
26 #include "content/common/content_export.h"
27 #include "content/common/drag_event_source_info.h"
28 #include "content/common/edit_command.h"
29 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
30 #include "content/common/navigation_gesture.h"
31 #include "content/common/view_message_enums.h"
32 #include "content/public/common/page_zoom.h"
33 #include "content/public/common/referrer.h"
34 #include "content/public/common/renderer_preferences.h"
35 #include "content/public/common/stop_find_action.h"
36 #include "content/public/common/top_controls_state.h"
37 #include "content/public/renderer/render_view.h"
38 #include "content/renderer/mouse_lock_dispatcher.h"
39 #include "content/renderer/render_frame_impl.h"
40 #include "content/renderer/render_widget.h"
41 #include "content/renderer/renderer_date_time_picker.h"
42 #include "content/renderer/stats_collection_observer.h"
43 #include "ipc/ipc_platform_file.h"
44 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
45 #include "third_party/WebKit/public/web/WebAXObject.h"
46 #include "third_party/WebKit/public/web/WebConsoleMessage.h"
47 #include "third_party/WebKit/public/web/WebDataSource.h"
48 #include "third_party/WebKit/public/web/WebElement.h"
49 #include "third_party/WebKit/public/web/WebHistoryItem.h"
50 #include "third_party/WebKit/public/web/WebIconURL.h"
51 #include "third_party/WebKit/public/web/WebInputEvent.h"
52 #include "third_party/WebKit/public/web/WebNavigationType.h"
53 #include "third_party/WebKit/public/web/WebNode.h"
54 #include "third_party/WebKit/public/web/WebPageSerializerClient.h"
55 #include "third_party/WebKit/public/web/WebPageVisibilityState.h"
56 #include "third_party/WebKit/public/web/WebSecurityOrigin.h"
57 #include "third_party/WebKit/public/web/WebViewClient.h"
58 #include "ui/base/window_open_disposition.h"
59 #include "ui/surface/transport_dib.h"
60 #include "webkit/common/webpreferences.h"
62 #if defined(OS_ANDROID)
63 #include "content/renderer/android/content_detector.h"
64 #include "third_party/WebKit/public/web/WebContentDetectionResult.h"
67 #if defined(COMPILER_MSVC)
68 // RenderViewImpl is a diamond-shaped hierarchy, with WebWidgetClient at the
69 // root. VS warns when we inherit the WebWidgetClient method implementations
70 // from RenderWidget. It's safe to ignore that warning.
71 #pragma warning(disable: 4250)
74 class PepperDeviceTest;
76 struct PP_NetAddress_Private;
77 struct FrameMsg_Navigate_Params;
78 struct ViewMsg_PostMessage_Params;
79 struct ViewMsg_StopFinding_Params;
86 struct SelectedFileInfo;
90 class WebApplicationCacheHost;
91 class WebApplicationCacheHostClient;
92 class WebDOMMessageEvent;
94 class WebDateTimeChooserCompletion;
96 class WebGeolocationClient;
97 class WebGestureEvent;
100 class WebPeerConnection00Handler;
101 class WebPeerConnection00HandlerClient;
103 class WebPeerConnectionHandler;
104 class WebPeerConnectionHandlerClient;
105 class WebSocketStreamHandle;
106 class WebSpeechRecognizer;
107 class WebStorageNamespace;
110 struct WebActiveWheelFlingParameters;
111 struct WebDateTimeChooserParams;
112 struct WebFileChooserParams;
113 struct WebFindOptions;
114 struct WebMediaPlayerAction;
115 struct WebPluginAction;
117 struct WebWindowFeatures;
119 #if defined(OS_ANDROID)
120 class WebHitTestResult;
124 namespace webkit_glue {
125 class WebURLResponseExtraDataImpl;
129 class BrowserPluginManager;
130 class DeviceOrientationDispatcher;
133 class ExternalPopupMenu;
135 class GeolocationDispatcher;
136 class HistoryController;
138 class ImageResourceFetcher;
139 class LoadProgressTracker;
140 class MidiDispatcher;
141 class MediaStreamDispatcher;
142 class MouseLockDispatcher;
143 class NavigationState;
144 class PepperPluginInstanceImpl;
145 class PushMessagingDispatcher;
146 class RenderViewObserver;
147 class RenderViewTest;
148 class RendererAccessibility;
149 class RendererDateTimePicker;
150 class RendererWebColorChooserImpl;
151 class SpeechRecognitionDispatcher;
152 class WebPluginDelegateProxy;
155 struct FileChooserParams;
156 struct RenderViewImplParams;
158 #if defined(OS_ANDROID)
159 class RendererMediaPlayerManager;
160 class WebMediaPlayerProxyAndroid;
164 // RenderView is an object that manages a WebView object, and provides a
165 // communication interface with an embedding application process
167 class CONTENT_EXPORT RenderViewImpl
168 : public RenderWidget,
169 NON_EXPORTED_BASE(public blink::WebViewClient),
170 NON_EXPORTED_BASE(public blink::WebPageSerializerClient),
172 public base::SupportsWeakPtr<RenderViewImpl> {
174 // Creates a new RenderView. |opener_id| is the routing ID of the RenderView
175 // responsible for creating this RenderView. Note that if the original opener
176 // has been closed, |window_was_created_with_opener| will be true and
177 // |opener_id| will be MSG_ROUTING_NONE.
178 static RenderViewImpl* Create(int32 opener_id,
179 bool window_was_created_with_opener,
180 const RendererPreferences& renderer_prefs,
181 const WebPreferences& webkit_prefs,
183 int32 main_frame_routing_id,
185 int64 session_storage_namespace_id,
186 const base::string16& frame_name,
187 bool is_renderer_created,
192 const blink::WebScreenInfo& screen_info,
193 AccessibilityMode accessibility_mode);
195 // Used by content_layouttest_support to hook into the creation of
197 static void InstallCreateHook(
198 RenderViewImpl* (*create_render_view_impl)(RenderViewImplParams*));
200 // Returns the RenderViewImpl containing the given WebView.
201 static RenderViewImpl* FromWebView(blink::WebView* webview);
203 // Returns the RenderViewImpl for the given routing ID.
204 static RenderViewImpl* FromRoutingID(int routing_id);
206 // May return NULL when the view is closing.
207 blink::WebView* webview() const;
209 int history_list_offset() const { return history_list_offset_; }
211 const WebPreferences& webkit_preferences() const {
212 return webkit_preferences_;
215 const RendererPreferences& renderer_preferences() const {
216 return renderer_preferences_;
219 void set_send_content_state_immediately(bool value) {
220 send_content_state_immediately_ = value;
223 RenderFrameImpl* main_render_frame() { return main_render_frame_.get(); }
225 // TODO(jam): move to RenderFrameImpl
226 MediaStreamDispatcher* media_stream_dispatcher() {
227 return media_stream_dispatcher_;
230 AccessibilityMode accessibility_mode() {
231 return accessibility_mode_;
234 RendererAccessibility* renderer_accessibility() {
235 return renderer_accessibility_;
238 MouseLockDispatcher* mouse_lock_dispatcher() {
239 return mouse_lock_dispatcher_;
242 HistoryController* history_controller() {
243 return history_controller_.get();
246 // Lazily initialize this view's BrowserPluginManager and return it.
247 BrowserPluginManager* GetBrowserPluginManager();
249 // Functions to add and remove observers for this object.
250 void AddObserver(RenderViewObserver* observer);
251 void RemoveObserver(RenderViewObserver* observer);
253 // Returns the StatsCollectionObserver associated with this view, or NULL
254 // if one wasn't created;
255 StatsCollectionObserver* GetStatsCollectionObserver() {
256 return stats_collection_observer_.get();
259 // Adds the given file chooser request to the file_chooser_completion_ queue
260 // (see that var for more) and requests the chooser be displayed if there are
261 // no other waiting items in the queue.
263 // Returns true if the chooser was successfully scheduled. False means we
264 // didn't schedule anything.
265 bool ScheduleFileChooser(const FileChooserParams& params,
266 blink::WebFileChooserCompletion* completion);
268 #if defined(OS_ANDROID)
269 void DismissDateTimeDialog();
271 #if defined(OS_MACOSX) || defined(OS_ANDROID)
272 void DidHideExternalPopupMenu();
275 bool is_loading() const { return frames_in_progress_ != 0; }
277 void FrameDidStartLoading(blink::WebFrame* frame);
278 void FrameDidStopLoading(blink::WebFrame* frame);
280 void FrameDidChangeLoadProgress(blink::WebFrame* frame,
281 double load_progress);
282 void FrameDidCommitProvisionalLoad(blink::WebLocalFrame* frame,
283 bool is_new_navigation);
285 // Plugin-related functions --------------------------------------------------
287 #if defined(ENABLE_PLUGINS)
288 // Get/set the plugin which will be used as to handle document find requests.
289 void set_plugin_find_handler(PepperPluginInstanceImpl* plugin) {
290 plugin_find_handler_ = plugin;
292 PepperPluginInstanceImpl* plugin_find_handler() {
293 return plugin_find_handler_;
296 PepperPluginInstanceImpl* focused_pepper_plugin() {
297 return focused_pepper_plugin_;
299 PepperPluginInstanceImpl* pepper_last_mouse_event_target() {
300 return pepper_last_mouse_event_target_;
302 void set_pepper_last_mouse_event_target(PepperPluginInstanceImpl* plugin) {
303 pepper_last_mouse_event_target_ = plugin;
306 #if defined(OS_MACOSX) || defined(OS_WIN)
307 // Informs the render view that the given plugin has gained or lost focus.
308 void PluginFocusChanged(bool focused, int plugin_id);
311 #if defined(OS_MACOSX)
312 // Starts plugin IME.
313 void StartPluginIme();
316 // Indicates that the given instance has been created.
317 void PepperInstanceCreated(PepperPluginInstanceImpl* instance);
319 // Indicates that the given instance is being destroyed. This is called from
320 // the destructor, so it's important that the instance is not dereferenced
322 void PepperInstanceDeleted(PepperPluginInstanceImpl* instance);
324 // Notification that the given plugin is focused or unfocused.
325 void PepperFocusChanged(PepperPluginInstanceImpl* instance, bool focused);
327 void RegisterPluginDelegate(WebPluginDelegateProxy* delegate);
328 void UnregisterPluginDelegate(WebPluginDelegateProxy* delegate);
329 #endif // ENABLE_PLUGINS
331 void TransferActiveWheelFlingAnimation(
332 const blink::WebActiveWheelFlingParameters& params);
334 // Returns true if the focused element is editable text from the perspective
335 // of IME support (also used for on-screen keyboard). Works correctly inside
336 // supported PPAPI plug-ins.
337 bool HasIMETextFocus();
339 // Callback for use with GetWindowSnapshot.
340 typedef base::Callback<void(
341 const gfx::Size&, const std::vector<unsigned char>&)>
342 WindowSnapshotCallback;
344 void GetWindowSnapshot(const WindowSnapshotCallback& callback);
346 // Dispatches the current navigation state to the browser. Called on a
347 // periodic timer so we don't send too many messages.
348 void SyncNavigationState();
350 // Returns the length of the session history of this RenderView. Note that
351 // this only coincides with the actual length of the session history if this
352 // RenderView is the currently active RenderView of a WebContents.
353 unsigned GetLocalSessionHistoryLengthForTesting() const;
355 // Invokes OnSetFocus and marks the widget as active depending on the value
356 // of |enable|. This is used for layout tests that need to control the focus
357 // synchronously from the renderer.
358 void SetFocusAndActivateForTesting(bool enable);
360 // Change the device scale factor and force the compositor to resize.
361 void SetDeviceScaleFactorForTesting(float factor);
363 // Change the device ICC color profile while running a layout test.
364 void SetDeviceColorProfileForTesting(const std::vector<char>& color_profile);
366 // Used to force the size of a window when running layout tests.
367 void ForceResizeForTesting(const gfx::Size& new_size);
369 void UseSynchronousResizeModeForTesting(bool enable);
371 // Control autoresize mode.
372 void EnableAutoResizeForTesting(const gfx::Size& min_size,
373 const gfx::Size& max_size);
374 void DisableAutoResizeForTesting(const gfx::Size& new_size);
376 // IPC::Listener implementation ----------------------------------------------
378 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
380 // blink::WebWidgetClient implementation ------------------------------------
382 // Most methods are handled by RenderWidget.
383 virtual void didFocus();
384 virtual void didBlur();
385 virtual void show(blink::WebNavigationPolicy policy);
386 virtual void runModal();
387 virtual bool enterFullScreen();
388 virtual void exitFullScreen();
389 virtual bool requestPointerLock();
390 virtual void requestPointerUnlock();
391 virtual bool isPointerLocked();
392 virtual void didActivateCompositor() OVERRIDE;
393 virtual void didHandleGestureEvent(const blink::WebGestureEvent& event,
394 bool event_cancelled) OVERRIDE;
395 virtual void initializeLayerTreeView() OVERRIDE;
397 // blink::WebViewClient implementation --------------------------------------
399 virtual blink::WebView* createView(blink::WebLocalFrame* creator,
400 const blink::WebURLRequest& request,
401 const blink::WebWindowFeatures& features,
402 const blink::WebString& frame_name,
403 blink::WebNavigationPolicy policy,
404 bool suppress_opener);
405 virtual blink::WebWidget* createPopupMenu(blink::WebPopupType popup_type);
406 virtual blink::WebExternalPopupMenu* createExternalPopupMenu(
407 const blink::WebPopupMenuInfo& popup_menu_info,
408 blink::WebExternalPopupMenuClient* popup_menu_client);
409 virtual blink::WebStorageNamespace* createSessionStorageNamespace();
410 virtual void printPage(blink::WebLocalFrame* frame);
411 virtual bool enumerateChosenDirectory(
412 const blink::WebString& path,
413 blink::WebFileChooserCompletion* chooser_completion);
414 virtual void didCancelCompositionOnSelectionChange();
415 virtual void didExecuteCommand(const blink::WebString& command_name);
416 virtual bool handleCurrentKeyboardEvent();
417 virtual bool runFileChooser(
418 const blink::WebFileChooserParams& params,
419 blink::WebFileChooserCompletion* chooser_completion);
420 virtual void showValidationMessage(const blink::WebRect& anchor_in_root_view,
421 const blink::WebString& main_text,
422 const blink::WebString& sub_text,
423 blink::WebTextDirection hint) OVERRIDE;
424 virtual void hideValidationMessage() OVERRIDE;
425 virtual void moveValidationMessage(
426 const blink::WebRect& anchor_in_root_view) OVERRIDE;
427 virtual void setStatusText(const blink::WebString& text);
428 virtual void setMouseOverURL(const blink::WebURL& url);
429 virtual void setKeyboardFocusURL(const blink::WebURL& url);
430 virtual void startDragging(blink::WebLocalFrame* frame,
431 const blink::WebDragData& data,
432 blink::WebDragOperationsMask mask,
433 const blink::WebImage& image,
434 const blink::WebPoint& imageOffset);
435 virtual bool acceptsLoadDrops();
436 virtual void focusNext();
437 virtual void focusPrevious();
438 virtual void focusedNodeChanged(const blink::WebNode& node);
439 virtual void numberOfWheelEventHandlersChanged(unsigned num_handlers);
440 virtual void didUpdateLayout();
441 #if defined(OS_ANDROID)
442 virtual bool didTapMultipleTargets(
443 const blink::WebGestureEvent& event,
444 const blink::WebVector<blink::WebRect>& target_rects);
446 virtual blink::WebString acceptLanguages();
447 virtual void navigateBackForwardSoon(int offset);
448 virtual int historyBackListCount();
449 virtual int historyForwardListCount();
450 virtual void postAccessibilityEvent(
451 const blink::WebAXObject& obj, blink::WebAXEvent event);
452 virtual void didUpdateInspectorSetting(const blink::WebString& key,
453 const blink::WebString& value);
454 virtual blink::WebGeolocationClient* geolocationClient();
455 virtual blink::WebSpeechRecognizer* speechRecognizer();
456 virtual void zoomLimitsChanged(double minimum_level, double maximum_level);
457 virtual void zoomLevelChanged();
458 virtual double zoomLevelToZoomFactor(double zoom_level) const;
459 virtual double zoomFactorToZoomLevel(double factor) const;
460 virtual void registerProtocolHandler(const blink::WebString& scheme,
461 const blink::WebURL& base_url,
462 const blink::WebURL& url,
463 const blink::WebString& title);
464 virtual blink::WebPageVisibilityState visibilityState() const;
465 virtual blink::WebMIDIClient* webMIDIClient();
466 virtual blink::WebPushClient* webPushClient();
467 virtual void draggableRegionsChanged();
469 #if defined(OS_ANDROID)
470 virtual void scheduleContentIntent(const blink::WebURL& intent);
471 virtual void cancelScheduledContentIntents();
472 virtual blink::WebContentDetectionResult detectContentAround(
473 const blink::WebHitTestResult& touch_hit);
475 // Only used on Android since all other platforms implement
476 // date and time input fields using MULTIPLE_FIELDS_UI
477 virtual bool openDateTimeChooser(const blink::WebDateTimeChooserParams&,
478 blink::WebDateTimeChooserCompletion*);
479 virtual void didScrollWithKeyboard(const blink::WebSize& delta);
482 // blink::WebPageSerializerClient implementation ----------------------------
484 virtual void didSerializeDataForFrame(
485 const blink::WebURL& frame_url,
486 const blink::WebCString& data,
487 PageSerializationStatus status) OVERRIDE;
489 // RenderView implementation -------------------------------------------------
491 virtual bool Send(IPC::Message* message) OVERRIDE;
492 virtual RenderFrame* GetMainRenderFrame() OVERRIDE;
493 virtual int GetRoutingID() const OVERRIDE;
494 virtual int GetPageId() const OVERRIDE;
495 virtual gfx::Size GetSize() const OVERRIDE;
496 virtual WebPreferences& GetWebkitPreferences() OVERRIDE;
497 virtual void SetWebkitPreferences(const WebPreferences& preferences) OVERRIDE;
498 virtual blink::WebView* GetWebView() OVERRIDE;
499 virtual blink::WebElement GetFocusedElement() const OVERRIDE;
500 virtual bool IsEditableNode(const blink::WebNode& node) const OVERRIDE;
501 virtual bool ShouldDisplayScrollbars(int width, int height) const OVERRIDE;
502 virtual int GetEnabledBindings() const OVERRIDE;
503 virtual bool GetContentStateImmediately() const OVERRIDE;
504 virtual float GetFilteredTimePerFrame() const OVERRIDE;
505 virtual blink::WebPageVisibilityState GetVisibilityState() const OVERRIDE;
506 virtual void DidStartLoading() OVERRIDE;
507 virtual void DidStopLoading() OVERRIDE;
508 virtual void Repaint(const gfx::Size& size) OVERRIDE;
509 virtual void SetEditCommandForNextKeyEvent(const std::string& name,
510 const std::string& value) OVERRIDE;
511 virtual void ClearEditCommands() OVERRIDE;
512 virtual SSLStatus GetSSLStatusOfFrame(blink::WebFrame* frame) const OVERRIDE;
513 virtual const std::string& GetAcceptLanguages() const OVERRIDE;
514 #if defined(OS_ANDROID)
515 virtual void UpdateTopControlsState(TopControlsState constraints,
516 TopControlsState current,
517 bool animate) OVERRIDE;
520 // Please do not add your stuff randomly to the end here. If there is an
521 // appropriate section, add it there. If not, there are some random functions
522 // nearer to the top you can add it to.
524 // Cannot use std::set unfortunately since linked_ptr<> does not support
526 typedef std::vector<linked_ptr<ImageResourceFetcher> >
527 ImageResourceFetcherList;
530 // RenderWidget overrides:
531 virtual void Close() OVERRIDE;
532 virtual void OnResize(const ViewMsg_Resize_Params& params) OVERRIDE;
533 virtual void DidInitiatePaint() OVERRIDE;
534 virtual void DidFlushPaint() OVERRIDE;
535 virtual gfx::Vector2d GetScrollOffset() OVERRIDE;
536 virtual void DidHandleKeyEvent() OVERRIDE;
537 virtual bool WillHandleMouseEvent(
538 const blink::WebMouseEvent& event) OVERRIDE;
539 virtual bool WillHandleGestureEvent(
540 const blink::WebGestureEvent& event) OVERRIDE;
541 virtual void DidHandleMouseEvent(const blink::WebMouseEvent& event) OVERRIDE;
542 virtual void DidHandleTouchEvent(const blink::WebTouchEvent& event) OVERRIDE;
543 virtual bool HasTouchEventHandlersAt(const gfx::Point& point) const OVERRIDE;
544 virtual void OnSetFocus(bool enable) OVERRIDE;
545 virtual void OnWasHidden() OVERRIDE;
546 virtual void OnWasShown(bool needs_repainting) OVERRIDE;
547 virtual GURL GetURLForGraphicsContext3D() OVERRIDE;
548 virtual bool ForceCompositingModeEnabled() OVERRIDE;
549 virtual void OnImeSetComposition(
550 const base::string16& text,
551 const std::vector<blink::WebCompositionUnderline>& underlines,
553 int selection_end) OVERRIDE;
554 virtual void OnImeConfirmComposition(const base::string16& text,
555 const gfx::Range& replacement_range,
556 bool keep_selection) OVERRIDE;
557 virtual void SetDeviceScaleFactor(float device_scale_factor) OVERRIDE;
558 virtual void OnOrientationChange() OVERRIDE;
559 virtual ui::TextInputType GetTextInputType() OVERRIDE;
560 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) OVERRIDE;
561 #if defined(OS_MACOSX) || defined(USE_AURA)
562 virtual void GetCompositionCharacterBounds(
563 std::vector<gfx::Rect>* character_bounds) OVERRIDE;
564 virtual void GetCompositionRange(gfx::Range* range) OVERRIDE;
566 virtual bool CanComposeInline() OVERRIDE;
567 virtual void DidCommitCompositorFrame() OVERRIDE;
568 virtual void InstrumentWillBeginFrame(int frame_id) OVERRIDE;
569 virtual void InstrumentDidBeginFrame() OVERRIDE;
570 virtual void InstrumentDidCancelFrame() OVERRIDE;
571 virtual void InstrumentWillComposite() OVERRIDE;
572 #if defined(OS_ANDROID)
573 virtual void UpdateSelectionRootBounds() OVERRIDE;
577 explicit RenderViewImpl(RenderViewImplParams* params);
579 void Initialize(RenderViewImplParams* params);
580 virtual void SetScreenMetricsEmulationParameters(
581 float device_scale_factor,
582 const gfx::Point& root_layer_offset,
583 float root_layer_scale) OVERRIDE;
585 // Do not delete directly. This class is reference counted.
586 virtual ~RenderViewImpl();
590 friend class ExternalPopupMenuTest;
591 friend class PepperDeviceTest;
592 friend class RendererAccessibilityTest;
593 friend class RenderViewTest;
595 // TODO(nasko): Temporarily friend RenderFrameImpl, so we don't duplicate
596 // utility functions needed in both classes, while we move frame specific
597 // code away from this class.
598 friend class RenderFrameImpl;
600 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange);
601 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase);
602 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate);
603 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, DecideNavigationPolicyForWebUI);
604 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
605 DidFailProvisionalLoadWithErrorForError);
606 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
607 DidFailProvisionalLoadWithErrorForCancellation);
608 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
609 DontIgnoreBackAfterNavEntryLimit);
610 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ImeComposition);
611 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, InsertCharacters);
612 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, JSBlockSentAfterPageLoad);
613 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, LastCommittedUpdateState);
614 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnHandleKeyboardEvent);
615 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnImeTypeChanged);
616 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnNavStateChanged);
617 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnSetAccessibilityMode);
618 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnSetTextDirection);
619 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnUpdateWebPreferences);
620 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
621 SetEditableSelectionAndComposition);
622 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, StaleNavigationsIgnored);
623 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, UpdateTargetURLWithInvalidURL);
624 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
625 GetCompositionCharacterBoundsTest);
626 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnNavigationHttpPost);
627 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
628 DecideNavigationPolicyHandlesAllTopLevel);
629 #if defined(OS_MACOSX)
630 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, MacTestCmdUp);
632 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SetHistoryLengthAndPrune);
633 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ZoomLimit);
634 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, NavigateFrame);
635 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, BasicRenderFrame);
636 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, TextInputTypeWithPepper);
637 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
638 MessageOrderInDidChangeSelection);
639 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SendCandidateWindowEvents);
640 FRIEND_TEST_ALL_PREFIXES(SuppressErrorPageTest, Suppresses);
641 FRIEND_TEST_ALL_PREFIXES(SuppressErrorPageTest, DoesNotSuppress);
643 typedef std::map<GURL, double> HostZoomLevels;
651 // Old WebFrameClient implementations ----------------------------------------
653 // RenderViewImpl used to be a WebFrameClient, but now RenderFrameImpl is the
654 // WebFrameClient. However, many implementations of WebFrameClient methods
655 // still live here and are called from RenderFrameImpl. These implementations
656 // are to be moved to RenderFrameImpl <http://crbug.com/361761>.
658 void didCreateDataSource(blink::WebLocalFrame* frame,
659 blink::WebDataSource* datasource);
660 void didClearWindowObject(blink::WebLocalFrame* frame, int world_id);
661 void didReceiveTitle(blink::WebLocalFrame* frame,
662 const blink::WebString& title,
663 blink::WebTextDirection direction);
664 void didChangeIcon(blink::WebLocalFrame*, blink::WebIconURL::Type);
665 void didUpdateCurrentHistoryItem(blink::WebLocalFrame* frame);
666 void didChangeScrollOffset(blink::WebLocalFrame* frame);
668 static bool IsReload(const FrameMsg_Navigate_Params& params);
670 static Referrer GetReferrerFromRequest(
671 blink::WebFrame* frame,
672 const blink::WebURLRequest& request);
674 static WindowOpenDisposition NavigationPolicyToDisposition(
675 blink::WebNavigationPolicy policy);
677 void UpdateTitle(blink::WebFrame* frame, const base::string16& title,
678 blink::WebTextDirection title_direction);
679 void UpdateSessionHistory(blink::WebFrame* frame);
680 void SendUpdateState(HistoryEntry* entry);
682 // Update current main frame's encoding and send it to browser window.
683 // Since we want to let users see the right encoding info from menu
684 // before finishing loading, we call the UpdateEncoding in
685 // a) function:DidCommitLoadForFrame. When this function is called,
686 // that means we have got first data. In here we try to get encoding
687 // of page if it has been specified in http header.
688 // b) function:DidReceiveTitle. When this function is called,
689 // that means we have got specified title. Because in most of webpages,
690 // title tags will follow meta tags. In here we try to get encoding of
691 // page if it has been specified in meta tag.
692 // c) function:DidFinishDocumentLoadForFrame. When this function is
693 // called, that means we have got whole html page. In here we should
694 // finally get right encoding of page.
695 void UpdateEncoding(blink::WebFrame* frame,
696 const std::string& encoding_name);
698 // Sends a message and runs a nested message loop.
699 bool SendAndRunNestedMessageLoop(IPC::SyncMessage* message);
701 // Called when the "pinned to left/right edge" state needs to be updated.
702 void UpdateScrollState(blink::WebFrame* frame);
704 // IPC message handlers ------------------------------------------------------
706 // The documentation for these functions should be in
707 // content/common/*_messages.h for the message that the function is handling.
708 void OnExecuteEditCommand(const std::string& name, const std::string& value);
709 void OnMoveCaret(const gfx::Point& point);
710 void OnScrollFocusedEditableNodeIntoRect(const gfx::Rect& rect);
711 void OnSetEditCommandsForNextKeyEvent(const EditCommands& edit_commands);
712 void OnAllowBindings(int enabled_bindings_flags);
713 void OnAllowScriptToClose(bool script_can_close);
714 void OnCancelDownload(int32 download_id);
715 void OnClearFocusedElement();
717 void OnShowContextMenu(const gfx::Point& location);
718 void OnCopyImageAt(int x, int y);
719 void OnSaveImageAt(int x, int y);
720 void OnSetName(const std::string& name);
721 void OnDeterminePageLanguage();
722 void OnDisableScrollbarsForSmallWindows(
723 const gfx::Size& disable_scrollbars_size_limit);
724 void OnDragSourceEnded(const gfx::Point& client_point,
725 const gfx::Point& screen_point,
726 blink::WebDragOperation drag_operation);
727 void OnDragSourceSystemDragEnded();
728 void OnDragTargetDrop(const gfx::Point& client_pt,
729 const gfx::Point& screen_pt,
731 void OnDragTargetDragEnter(const DropData& drop_data,
732 const gfx::Point& client_pt,
733 const gfx::Point& screen_pt,
734 blink::WebDragOperationsMask operations_allowed,
736 void OnDragTargetDragLeave();
737 void OnDragTargetDragOver(const gfx::Point& client_pt,
738 const gfx::Point& screen_pt,
739 blink::WebDragOperationsMask operations_allowed,
741 void OnEnablePreferredSizeChangedMode();
742 void OnEnableAutoResize(const gfx::Size& min_size, const gfx::Size& max_size);
743 void OnDisableAutoResize(const gfx::Size& new_size);
744 void OnEnumerateDirectoryResponse(int id,
745 const std::vector<base::FilePath>& paths);
746 void OnFileChooserResponse(
747 const std::vector<ui::SelectedFileInfo>& files);
748 void OnFind(int request_id,
749 const base::string16&,
750 const blink::WebFindOptions&);
751 void OnGetAllSavableResourceLinksForCurrentPage(const GURL& page_url);
752 void OnGetSerializedHtmlDataForCurrentPageWithLocalLinks(
753 const std::vector<GURL>& links,
754 const std::vector<base::FilePath>& local_paths,
755 const base::FilePath& local_directory_name);
756 void OnMediaPlayerActionAt(const gfx::Point& location,
757 const blink::WebMediaPlayerAction& action);
758 void OnPluginActionAt(const gfx::Point& location,
759 const blink::WebPluginAction& action);
760 void OnMoveOrResizeStarted();
761 void OnPostMessageEvent(const ViewMsg_PostMessage_Params& params);
762 void OnReleaseDisambiguationPopupBitmap(const cc::SharedBitmapId& id);
763 void OnResetPageEncodingToDefault();
764 void OnSetAccessibilityMode(AccessibilityMode new_mode);
765 void OnSetActive(bool active);
766 void OnSetBackground(const SkBitmap& background);
767 void OnExitFullscreen();
768 void OnSetHistoryLengthAndPrune(int history_length, int32 minimum_page_id);
769 void OnSetInitialFocus(bool reverse);
770 void OnSetPageEncoding(const std::string& encoding_name);
771 void OnSetRendererPrefs(const RendererPreferences& renderer_prefs);
772 void OnSetWebUIProperty(const std::string& name, const std::string& value);
773 void OnSetZoomLevel(double zoom_level);
774 void OnSetZoomLevelForLoadingURL(const GURL& url, double zoom_level);
776 void OnStopFinding(StopFindAction action);
777 void OnSuppressDialogsUntilSwapOut();
778 void OnThemeChanged();
779 void OnUpdateTargetURLAck();
780 void OnUpdateWebPreferences(const WebPreferences& prefs);
781 void OnZoom(PageZoom zoom);
782 void OnEnableViewSourceMode();
783 void OnDisownOpener();
784 void OnWindowSnapshotCompleted(const int snapshot_id,
785 const gfx::Size& size, const std::vector<unsigned char>& png);
786 #if defined(OS_ANDROID)
787 void OnActivateNearestFindResult(int request_id, float x, float y);
788 void OnFindMatchRects(int current_version);
789 void OnSelectPopupMenuItems(bool canceled,
790 const std::vector<int>& selected_indices);
791 void OnUndoScrollFocusedEditableNodeIntoRect();
792 void OnUpdateTopControlsState(bool enable_hiding,
796 void OnExtractSmartClipData(const gfx::Rect& rect);
797 void GetSelectionRootBounds(gfx::Rect* bounds) const;
798 #elif defined(OS_MACOSX)
799 void OnPluginImeCompositionCompleted(const base::string16& text,
801 void OnSelectPopupMenuItem(int selected_index);
802 void OnSetInLiveResize(bool in_live_resize);
803 void OnSetWindowVisibility(bool visible);
804 void OnWindowFrameChanged(const gfx::Rect& window_frame,
805 const gfx::Rect& view_frame);
808 // Adding a new message handler? Please add it in alphabetical order above
809 // and put it in the same position in the .cc file.
811 // Misc private functions ----------------------------------------------------
812 // Check whether the preferred size has changed.
813 void CheckPreferredSize();
815 // This callback is triggered when DownloadFavicon completes, either
816 // succesfully or with a failure. See DownloadFavicon for more
818 void DidDownloadFavicon(ImageResourceFetcher* fetcher,
819 const SkBitmap& image);
821 // Requests to download a favicon image. When done, the RenderView is notified
822 // by way of DidDownloadFavicon. Returns true if the request was successfully
823 // started, false otherwise. id is used to uniquely identify the request and
824 // passed back to the DidDownloadFavicon method. If the image has multiple
825 // frames, the frame whose size is image_size is returned. If the image
826 // doesn't have a frame at the specified size, the first is returned.
827 bool DownloadFavicon(int id, const GURL& image_url, int image_size);
829 // Returns the URL being loaded by the given frame's request.
830 GURL GetLoadingUrl(blink::WebFrame* frame) const;
832 // Called to get the WebPlugin to handle find requests in the document.
833 // Returns NULL if there is no such WebPlugin.
834 blink::WebPlugin* GetWebPluginForFind();
836 // Returns true if the |params| navigation is to an entry that has been
837 // cropped due to a recent navigation the browser did not know about.
838 bool IsBackForwardToStaleEntry(const FrameMsg_Navigate_Params& params,
841 // TODO(nasko): Remove this method when code is migrated to use
842 // RenderFrameObserver.
843 void OnNavigate(const FrameMsg_Navigate_Params& params);
845 // Make the given |frame| show an empty, unscriptable page.
846 // TODO(creis): Move this to RenderFrame.
847 void NavigateToSwappedOutURL(blink::WebFrame* frame);
849 // If we initiated a navigation, this function will populate |document_state|
850 // with the navigation information saved in OnNavigate().
851 void PopulateDocumentStateFromPending(DocumentState* document_state);
853 // Returns a new NavigationState populated with the navigation information
854 // saved in OnNavigate().
855 NavigationState* CreateNavigationStateFromPending();
857 // Processes the command-line flags --enable-viewport,
858 // --enable-fixed-layout[=w,h] and --enable-pinch.
859 void ProcessViewLayoutFlags(const base::CommandLine& command_line);
861 #if defined(OS_ANDROID)
862 // Launch an Android content intent with the given URL.
863 void LaunchAndroidContentIntent(const GURL& intent_url, size_t request_id);
866 // Sends a reply to the current find operation handling if it was a
867 // synchronous find request.
868 void SendFindReply(int request_id,
871 const blink::WebRect& selection_rect,
872 bool final_status_update);
874 // Starts nav_state_sync_timer_ if it isn't already running.
875 void StartNavStateSyncTimerIfNecessary();
877 #if defined(OS_POSIX) && !defined(OS_MACOSX)
878 void UpdateFontRenderingFromRendererPrefs();
880 void UpdateFontRenderingFromRendererPrefs() {}
883 // Update the target url and tell the browser that the target URL has changed.
884 // If |url| is empty, show |fallback_url|.
885 void UpdateTargetURL(const GURL& url, const GURL& fallback_url);
887 // Tells the browser what the new list of favicons for the webpage is.
888 void SendUpdateFaviconURL(const std::vector<FaviconURL>& urls);
890 // Invoked from DidStopLoading(). Sends the current list of loaded favicons to
892 void DidStopLoadingIcons();
894 // Coordinate conversion -----------------------------------------------------
896 gfx::RectF ClientRectToPhysicalWindowRect(const gfx::RectF& rect) const;
898 // RenderFrameImpl accessible state ------------------------------------------
899 // The following section is the set of methods that RenderFrameImpl needs
900 // to access RenderViewImpl state. The set of state variables are page-level
901 // specific, so they don't belong in RenderFrameImpl and should remain in
903 ObserverList<RenderViewObserver>& observers() {
907 // TODO(nasko): Remove this method when we move to frame proxy objects, since
908 // the concept of swapped out will be eliminated.
909 void set_is_swapped_out(bool swapped_out) {
910 is_swapped_out_ = swapped_out;
913 NavigationGesture navigation_gesture() {
914 return navigation_gesture_;
916 void set_navigation_gesture(NavigationGesture gesture) {
917 navigation_gesture_ = gesture;
920 // ---------------------------------------------------------------------------
921 // ADDING NEW FUNCTIONS? Please keep private functions alphabetized and put
922 // it in the same order in the .cc file as it was in the header.
923 // ---------------------------------------------------------------------------
925 // Settings ------------------------------------------------------------------
927 WebPreferences webkit_preferences_;
928 RendererPreferences renderer_preferences_;
930 HostZoomLevels host_zoom_levels_;
932 // Whether content state (such as form state, scroll position and page
933 // contents) should be sent to the browser immediately. This is normally
934 // false, but set to true by some tests.
935 bool send_content_state_immediately_;
937 // Bitwise-ORed set of extra bindings that have been enabled. See
938 // BindingsPolicy for details.
939 int enabled_bindings_;
941 // If true, we send IPC messages when |preferred_size_| changes.
942 bool send_preferred_size_changes_;
944 // If non-empty, and |send_preferred_size_changes_| is true, disable drawing
945 // scroll bars on windows smaller than this size. Used for windows that the
946 // browser resizes to the size of the content, such as browser action popups.
947 // If a render view is set to the minimum size of its content, webkit may add
948 // scroll bars. This makes sense for fixed sized windows, but it does not
949 // make sense when the size of the view was chosen to fit the content.
950 // This setting ensures that no scroll bars are drawn. The size limit exists
951 // because if the view grows beyond a size known to the browser, scroll bars
953 gfx::Size disable_scrollbars_size_limit_;
955 // Loading state -------------------------------------------------------------
957 // The gesture that initiated the current navigation.
958 // TODO(nasko): Move to RenderFrame, as this is per-frame state.
959 NavigationGesture navigation_gesture_;
962 bool opened_by_user_gesture_;
964 // Whether this RenderView was created by a frame that was suppressing its
965 // opener. If so, we may want to load pages in a separate process. See
966 // decidePolicyForNavigation for details.
967 bool opener_suppressed_;
969 // Whether we must stop creating nested message loops for modal dialogs until
970 // OnSwapOut is called. This is necessary because modal dialogs have a
971 // PageGroupLoadDeferrer on the stack that interferes with swapping out.
972 bool suppress_dialogs_until_swap_out_;
974 // Holds state pertaining to a navigation that we initiated. This is held by
975 // the WebDataSource::ExtraData attribute. We use pending_navigation_state_
976 // as a temporary holder for the state until the WebDataSource corresponding
977 // to the new navigation is created. See DidCreateDataSource.
978 // TODO(nasko): Move to RenderFrame, as this is per-frame state.
979 scoped_ptr<FrameMsg_Navigate_Params> pending_navigation_params_;
981 // Timer used to delay the updating of nav state (see SyncNavigationState).
982 base::OneShotTimer<RenderViewImpl> nav_state_sync_timer_;
984 // Page IDs ------------------------------------------------------------------
985 // See documentation in RenderView.
988 // Indicates the ID of the last page that we sent a FrameNavigate to the
989 // browser for. This is used to determine if the most recent transition
990 // generated a history entry (less than page_id_), or not (equal to or
991 // greater than). Note that this will be greater than page_id_ if the user
993 int32 last_page_id_sent_to_browser_;
995 // The next available page ID to use for this RenderView. These IDs are
996 // specific to a given RenderView and the frames within it.
999 // The offset of the current item in the history list.
1000 int history_list_offset_;
1002 // The RenderView's current impression of the history length. This includes
1003 // any items that have committed in this process, but because of cross-process
1004 // navigations, the history may have some entries that were committed in other
1005 // processes. We won't know about them until the next navigation in this
1007 int history_list_length_;
1009 // Counter to track how many frames have sent start notifications but not
1010 // stop notifications.
1011 // TODO(japhet): This state will need to move to the browser process
1012 // (probably WebContents) for site isolation.
1013 int frames_in_progress_;
1015 // The list of page IDs for each history item this RenderView knows about.
1016 // Some entries may be -1 if they were rendered by other processes or were
1017 // restored from a previous session. This lets us detect attempts to
1018 // navigate to stale entries that have been cropped from our history.
1019 std::vector<int32> history_page_ids_;
1021 // Page info -----------------------------------------------------------------
1023 // The last gotten main frame's encoding.
1024 std::string last_encoding_name_;
1026 // UI state ------------------------------------------------------------------
1028 // The state of our target_url transmissions. When we receive a request to
1029 // send a URL to the browser, we set this to TARGET_INFLIGHT until an ACK
1030 // comes back - if a new request comes in before the ACK, we store the new
1031 // URL in pending_target_url_ and set the status to TARGET_PENDING. If an
1032 // ACK comes back and we are in TARGET_PENDING, we send the stored URL and
1033 // revert to TARGET_INFLIGHT.
1035 // We don't need a queue of URLs to send, as only the latest is useful.
1038 TARGET_INFLIGHT, // We have a request in-flight, waiting for an ACK
1039 TARGET_PENDING // INFLIGHT + we have a URL waiting to be sent
1040 } target_url_status_;
1042 // The URL we show the user in the status bar. We use this to determine if we
1043 // want to send a new one (we do not need to send duplicates). It will be
1044 // equal to either |mouse_over_url_| or |focus_url_|, depending on which was
1048 // The URL the user's mouse is hovering over.
1049 GURL mouse_over_url_;
1051 // The URL that has keyboard focus.
1054 // The next target URL we want to send to the browser.
1055 GURL pending_target_url_;
1057 #if defined(OS_ANDROID)
1058 // Cache the old top controls state constraints. Used when updating
1059 // current value only without altering the constraints.
1060 cc::TopControlsState top_controls_constraints_;
1063 // View ----------------------------------------------------------------------
1065 // Cache the preferred size of the page in order to prevent sending the IPC
1066 // when layout() recomputes but doesn't actually change sizes.
1067 gfx::Size preferred_size_;
1069 // Used to delay determining the preferred size (to avoid intermediate
1070 // states for the sizes).
1071 base::OneShotTimer<RenderViewImpl> check_preferred_size_timer_;
1073 // These store the "is main frame is scrolled all the way to the left
1074 // or right" state that was last sent to the browser.
1075 bool cached_is_main_frame_pinned_to_left_;
1076 bool cached_is_main_frame_pinned_to_right_;
1078 // Bookkeeping to suppress redundant scroll and focus requests for an already
1079 // scrolled and focused editable node.
1080 bool has_scrolled_focused_editable_node_into_rect_;
1081 gfx::Rect rect_for_scrolled_focused_editable_node_;
1083 // Helper objects ------------------------------------------------------------
1085 scoped_ptr<RenderFrameImpl> main_render_frame_;
1087 // The next group of objects all implement RenderViewObserver, so are deleted
1088 // along with the RenderView automatically. This is why we just store
1091 // The push messaging dispatcher attached to this view, lazily initialized.
1092 PushMessagingDispatcher* push_messaging_dispatcher_;
1094 // The geolocation dispatcher attached to this view, lazily initialized.
1095 GeolocationDispatcher* geolocation_dispatcher_;
1097 // The speech recognition dispatcher attached to this view, lazily
1099 SpeechRecognitionDispatcher* speech_recognition_dispatcher_;
1101 // Device orientation dispatcher attached to this view; lazily initialized.
1102 DeviceOrientationDispatcher* device_orientation_dispatcher_;
1104 // MediaStream dispatcher attached to this view; lazily initialized.
1105 MediaStreamDispatcher* media_stream_dispatcher_;
1107 // BrowserPluginManager attached to this view; lazily initialized.
1108 scoped_refptr<BrowserPluginManager> browser_plugin_manager_;
1110 // MidiClient attached to this view; lazily initialized.
1111 MidiDispatcher* midi_dispatcher_;
1113 DevToolsAgent* devtools_agent_;
1115 // The current accessibility mode.
1116 AccessibilityMode accessibility_mode_;
1118 // Only valid if |accessibility_mode_| is anything other than
1119 // AccessibilityModeOff.
1120 RendererAccessibility* renderer_accessibility_;
1122 // Mouse Lock dispatcher attached to this view.
1123 MouseLockDispatcher* mouse_lock_dispatcher_;
1125 scoped_ptr<HistoryController> history_controller_;
1127 #if defined(OS_ANDROID)
1128 // Android Specific ---------------------------------------------------------
1130 // Expected id of the next content intent launched. Used to prevent scheduled
1131 // intents to be launched if aborted.
1132 size_t expected_content_intent_id_;
1134 // List of click-based content detectors.
1135 typedef std::vector< linked_ptr<ContentDetector> > ContentDetectorList;
1136 ContentDetectorList content_detectors_;
1138 // The media player manager for managing all the media players on this view
1139 // for communicating with the real media player objects in browser process.
1140 RendererMediaPlayerManager* media_player_manager_;
1142 // A date/time picker object for date and time related input elements.
1143 scoped_ptr<RendererDateTimePicker> date_time_picker_client_;
1146 // Plugins -------------------------------------------------------------------
1148 // All the currently active plugin delegates for this RenderView; kept so
1149 // that we can enumerate them to send updates about things like window
1150 // location or tab focus and visibily. These are non-owning references.
1151 std::set<WebPluginDelegateProxy*> plugin_delegates_;
1154 // The ID of the focused NPAPI plug-in.
1155 int focused_plugin_id_;
1158 #if defined(ENABLE_PLUGINS)
1159 PepperPluginInstanceImpl* plugin_find_handler_;
1161 typedef std::set<PepperPluginInstanceImpl*> PepperPluginSet;
1162 PepperPluginSet active_pepper_instances_;
1164 // TODO(jam): these belong on RenderFrame, once the browser knows which frame
1165 // is focused and sends the IPCs which use these to the correct frame. Until
1166 // then, we must store these on RenderView as that's the one place that knows
1167 // about all the RenderFrames for a page.
1169 // Whether or not the focus is on a PPAPI plugin
1170 PepperPluginInstanceImpl* focused_pepper_plugin_;
1172 // The plugin instance that received the last mouse event. It is set to NULL
1173 // if the last mouse event went to elements other than Pepper plugins.
1174 // |pepper_last_mouse_event_target_| is not owned by this class. We depend on
1175 // the RenderFrameImpl to NULL it out when it destructs.
1176 PepperPluginInstanceImpl* pepper_last_mouse_event_target_;
1179 // Misc ----------------------------------------------------------------------
1181 // The current and pending file chooser completion objects. If the queue is
1182 // nonempty, the first item represents the currently running file chooser
1183 // callback, and the remaining elements are the other file chooser completion
1184 // still waiting to be run (in order).
1185 struct PendingFileChooser;
1186 std::deque< linked_ptr<PendingFileChooser> > file_chooser_completions_;
1188 // The current directory enumeration callback
1189 std::map<int, blink::WebFileChooserCompletion*> enumeration_completions_;
1190 int enumeration_completion_id_;
1192 // Reports load progress to the browser.
1193 scoped_ptr<LoadProgressTracker> load_progress_tracker_;
1195 // The SessionStorage namespace that we're assigned to has an ID, and that ID
1196 // is passed to us upon creation. WebKit asks for this ID upon first use and
1197 // uses it whenever asking the browser process to allocate new storage areas.
1198 int64 session_storage_namespace_id_;
1200 // Stores edit commands associated to the next key event.
1201 // Shall be cleared as soon as the next key event is processed.
1202 EditCommands edit_commands_;
1204 #if defined(OS_MACOSX) || defined(OS_ANDROID)
1205 // The external popup for the currently showing select popup.
1206 scoped_ptr<ExternalPopupMenu> external_popup_menu_;
1209 // All the registered observers. We expect this list to be small, so vector
1211 ObserverList<RenderViewObserver> observers_;
1213 // Wraps the |webwidget_| as a MouseLockDispatcher::LockTarget interface.
1214 scoped_ptr<MouseLockDispatcher::LockTarget> webwidget_mouse_lock_target_;
1216 // State associated with the GetWindowSnapshot function.
1217 int next_snapshot_id_;
1218 typedef std::map<int, WindowSnapshotCallback> PendingSnapshotMap;
1219 PendingSnapshotMap pending_snapshots_;
1221 // This field stores drag/drop related info for the event that is currently
1222 // being handled. If the current event results in starting a drag/drop
1223 // session, this info is sent to the browser along with other drag/drop info.
1224 DragEventSourceInfo possible_drag_event_info_;
1226 // NOTE: stats_collection_observer_ should be the last members because their
1227 // constructors call the AddObservers method of RenderViewImpl.
1228 scoped_ptr<StatsCollectionObserver> stats_collection_observer_;
1230 typedef std::map<cc::SharedBitmapId, cc::SharedBitmap*> BitmapMap;
1231 BitmapMap disambiguation_bitmaps_;
1233 // ---------------------------------------------------------------------------
1234 // ADDING NEW DATA? Please see if it fits appropriately in one of the above
1235 // sections rather than throwing it randomly at the end. If you're adding a
1236 // bunch of stuff, you should probably create a helper class and put your
1237 // data and methods on that to avoid bloating RenderView more. You can
1238 // use the Observer interface to filter IPC messages and receive frame change
1240 // ---------------------------------------------------------------------------
1242 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl);
1245 } // namespace content
1247 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_