Home | History | Annotate | Download | only in renderer
      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.
      4 
      5 #ifndef CONTENT_RENDERER_RENDER_VIEW_IMPL_H_
      6 #define CONTENT_RENDERER_RENDER_VIEW_IMPL_H_
      7 
      8 #include <deque>
      9 #include <map>
     10 #include <set>
     11 #include <string>
     12 #include <vector>
     13 
     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/timer/timer.h"
     22 #include "build/build_config.h"
     23 #include "cc/input/top_controls_state.h"
     24 #include "content/common/content_export.h"
     25 #include "content/common/drag_event_source_info.h"
     26 #include "content/common/edit_command.h"
     27 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
     28 #include "content/common/navigation_gesture.h"
     29 #include "content/common/view_message_enums.h"
     30 #include "content/public/common/javascript_message_type.h"
     31 #include "content/public/common/page_zoom.h"
     32 #include "content/public/common/referrer.h"
     33 #include "content/public/common/renderer_preferences.h"
     34 #include "content/public/common/stop_find_action.h"
     35 #include "content/public/common/top_controls_state.h"
     36 #include "content/public/renderer/render_view.h"
     37 #include "content/renderer/media/webmediaplayer_delegate.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_webcookiejar_impl.h"
     42 #include "content/renderer/stats_collection_observer.h"
     43 #include "ipc/ipc_platform_file.h"
     44 #include "third_party/WebKit/public/platform/WebFileSystem.h"
     45 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.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/WebFrameClient.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/ui_base_types.h"
     59 #include "ui/surface/transport_dib.h"
     60 #include "webkit/common/webpreferences.h"
     61 
     62 #if defined(OS_ANDROID)
     63 #include "content/renderer/android/content_detector.h"
     64 #include "third_party/WebKit/public/web/WebContentDetectionResult.h"
     65 #endif
     66 
     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)
     72 #endif
     73 
     74 class CommandLine;
     75 class PepperDeviceTest;
     76 class SkBitmap;
     77 struct PP_NetAddress_Private;
     78 struct ViewMsg_Navigate_Params;
     79 struct ViewMsg_PostMessage_Params;
     80 struct ViewMsg_StopFinding_Params;
     81 
     82 namespace ui {
     83 struct SelectedFileInfo;
     84 }  // namespace ui
     85 
     86 namespace WebKit {
     87 class WebApplicationCacheHost;
     88 class WebApplicationCacheHostClient;
     89 class WebDOMMessageEvent;
     90 class WebDataSource;
     91 class WebDateTimeChooserCompletion;
     92 class WebDragData;
     93 class WebGeolocationClient;
     94 class WebGestureEvent;
     95 class WebIconURL;
     96 class WebImage;
     97 class WebPeerConnection00Handler;
     98 class WebPeerConnection00HandlerClient;
     99 class WebMediaPlayer;
    100 class WebMediaPlayerClient;
    101 class WebMouseEvent;
    102 class WebPeerConnectionHandler;
    103 class WebPeerConnectionHandlerClient;
    104 class WebSocketStreamHandle;
    105 class WebSpeechInputController;
    106 class WebSpeechInputListener;
    107 class WebSpeechRecognizer;
    108 class WebStorageNamespace;
    109 class WebTouchEvent;
    110 class WebURLRequest;
    111 class WebUserMediaClient;
    112 struct WebActiveWheelFlingParameters;
    113 struct WebCursorInfo;
    114 struct WebDateTimeChooserParams;
    115 struct WebFileChooserParams;
    116 struct WebFindOptions;
    117 struct WebMediaPlayerAction;
    118 struct WebPluginAction;
    119 struct WebPoint;
    120 struct WebWindowFeatures;
    121 
    122 #if defined(OS_ANDROID)
    123 class WebHitTestResult;
    124 #endif
    125 }
    126 
    127 namespace webkit_glue {
    128 class WebURLResponseExtraDataImpl;
    129 }
    130 
    131 namespace content {
    132 class BrowserPluginManager;
    133 class DeviceOrientationDispatcher;
    134 class DevToolsAgent;
    135 class DocumentState;
    136 class DomAutomationController;
    137 class ExternalPopupMenu;
    138 class FaviconHelper;
    139 class GeolocationDispatcher;
    140 class ImageResourceFetcher;
    141 class InputTagSpeechDispatcher;
    142 class JavaBridgeDispatcher;
    143 class LoadProgressTracker;
    144 class MIDIDispatcher;
    145 class MediaStreamClient;
    146 class MediaStreamDispatcher;
    147 class MouseLockDispatcher;
    148 class NavigationState;
    149 class NotificationProvider;
    150 class PepperPluginInstanceImpl;
    151 class RenderViewObserver;
    152 class RenderViewTest;
    153 class RendererAccessibility;
    154 class RendererDateTimePicker;
    155 class RendererPpapiHost;
    156 class RendererWebColorChooserImpl;
    157 class RenderWidgetFullscreenPepper;
    158 class SpeechRecognitionDispatcher;
    159 class StatsCollectionController;
    160 class WebPluginDelegateProxy;
    161 struct CustomContextMenuContext;
    162 struct DropData;
    163 struct FaviconURL;
    164 struct FileChooserParams;
    165 struct RenderViewImplParams;
    166 
    167 #if defined(OS_ANDROID)
    168 class RendererMediaPlayerManager;
    169 class WebMediaPlayerProxyAndroid;
    170 #endif
    171 
    172 // We need to prevent a page from trying to create infinite popups. It is not
    173 // as simple as keeping a count of the number of immediate children
    174 // popups. Having an html file that window.open()s itself would create
    175 // an unlimited chain of RenderViews who only have one RenderView child.
    176 //
    177 // Therefore, each new top level RenderView creates a new counter and shares it
    178 // with all its children and grandchildren popup RenderViewImpls created with
    179 // createView() to have a sort of global limit for the page so no more than
    180 // kMaximumNumberOfPopups popups are created.
    181 //
    182 // This is a RefCounted holder of an int because I can't say
    183 // scoped_refptr<int>.
    184 typedef base::RefCountedData<int> SharedRenderViewCounter;
    185 
    186 //
    187 // RenderView is an object that manages a WebView object, and provides a
    188 // communication interface with an embedding application process
    189 //
    190 class CONTENT_EXPORT RenderViewImpl
    191     : public RenderWidget,
    192       NON_EXPORTED_BASE(public WebKit::WebViewClient),
    193       NON_EXPORTED_BASE(public WebKit::WebFrameClient),
    194       NON_EXPORTED_BASE(public WebKit::WebPageSerializerClient),
    195       public RenderView,
    196       NON_EXPORTED_BASE(public WebMediaPlayerDelegate),
    197       public base::SupportsWeakPtr<RenderViewImpl> {
    198  public:
    199   // Creates a new RenderView. If this is a blocked popup or as a new tab,
    200   // opener_id is the routing ID of the RenderView responsible for creating this
    201   // RenderView. |counter| is either a currently initialized counter, or NULL
    202   // (in which case we treat this RenderView as a top level window).
    203   static RenderViewImpl* Create(
    204       int32 opener_id,
    205       const RendererPreferences& renderer_prefs,
    206       const WebPreferences& webkit_prefs,
    207       SharedRenderViewCounter* counter,
    208       int32 routing_id,
    209       int32 main_frame_routing_id,
    210       int32 surface_id,
    211       int64 session_storage_namespace_id,
    212       const string16& frame_name,
    213       bool is_renderer_created,
    214       bool swapped_out,
    215       int32 next_page_id,
    216       const WebKit::WebScreenInfo& screen_info,
    217       AccessibilityMode accessibility_mode,
    218       bool allow_partial_swap);
    219 
    220   // Used by content_layouttest_support to hook into the creation of
    221   // RenderViewImpls.
    222   static void InstallCreateHook(
    223       RenderViewImpl* (*create_render_view_impl)(RenderViewImplParams*));
    224 
    225   // Returns the RenderViewImpl containing the given WebView.
    226   static RenderViewImpl* FromWebView(WebKit::WebView* webview);
    227 
    228   // Returns the RenderViewImpl for the given routing ID.
    229   static RenderViewImpl* FromRoutingID(int routing_id);
    230 
    231   // May return NULL when the view is closing.
    232   WebKit::WebView* webview() const;
    233 
    234   int history_list_offset() const { return history_list_offset_; }
    235 
    236   const WebPreferences& webkit_preferences() const {
    237     return webkit_preferences_;
    238   }
    239 
    240   void set_send_content_state_immediately(bool value) {
    241     send_content_state_immediately_ = value;
    242   }
    243 
    244   MediaStreamDispatcher* media_stream_dispatcher() {
    245     return media_stream_dispatcher_;
    246   }
    247 
    248   MouseLockDispatcher* mouse_lock_dispatcher() {
    249     return mouse_lock_dispatcher_;
    250   }
    251 
    252   RendererWebCookieJarImpl* cookie_jar() { return &cookie_jar_; }
    253 
    254 #if defined(OS_ANDROID)
    255   RendererMediaPlayerManager* media_player_manager() {
    256     return media_player_manager_.get();
    257   }
    258 #endif
    259 
    260   // Lazily initialize this view's BrowserPluginManager and return it.
    261   BrowserPluginManager* GetBrowserPluginManager();
    262 
    263   // Functions to add and remove observers for this object.
    264   void AddObserver(RenderViewObserver* observer);
    265   void RemoveObserver(RenderViewObserver* observer);
    266 
    267   // Returns the StatsCollectionObserver associated with this view, or NULL
    268   // if one wasn't created;
    269   StatsCollectionObserver* GetStatsCollectionObserver() {
    270     return stats_collection_observer_.get();
    271   }
    272 
    273   // Adds the given file chooser request to the file_chooser_completion_ queue
    274   // (see that var for more) and requests the chooser be displayed if there are
    275   // no other waiting items in the queue.
    276   //
    277   // Returns true if the chooser was successfully scheduled. False means we
    278   // didn't schedule anything.
    279   bool ScheduleFileChooser(const FileChooserParams& params,
    280                            WebKit::WebFileChooserCompletion* completion);
    281 
    282   void LoadNavigationErrorPage(
    283       WebKit::WebFrame* frame,
    284       const WebKit::WebURLRequest& failed_request,
    285       const WebKit::WebURLError& error,
    286       const std::string& html,
    287       bool replace);
    288 
    289   // Plugin-related functions --------------------------------------------------
    290 
    291 #if defined(ENABLE_PLUGINS)
    292   // Indicates that the given instance has been created.
    293   void PepperInstanceCreated(PepperPluginInstanceImpl* instance);
    294 
    295   // Indicates that the given instance is being destroyed. This is called from
    296   // the destructor, so it's important that the instance is not dereferenced
    297   // from this call.
    298   void PepperInstanceDeleted(PepperPluginInstanceImpl* instance);
    299 
    300   // Notifies that |instance| has changed the cursor.
    301   // This will update the cursor appearance if it is currently over the plugin
    302   // instance.
    303   void PepperDidChangeCursor(PepperPluginInstanceImpl* instance,
    304                              const WebKit::WebCursorInfo& cursor);
    305 
    306   // Notifies that |instance| has received a mouse event.
    307   void PepperDidReceiveMouseEvent(PepperPluginInstanceImpl* instance);
    308 
    309   // Notification that the given plugin is focused or unfocused.
    310   void PepperFocusChanged(PepperPluginInstanceImpl* instance, bool focused);
    311 
    312   // Informs the render view that a PPAPI plugin has changed text input status.
    313   void PepperTextInputTypeChanged(PepperPluginInstanceImpl* instance);
    314   void PepperCaretPositionChanged(PepperPluginInstanceImpl* instance);
    315 
    316   // Cancels current composition.
    317   void PepperCancelComposition(PepperPluginInstanceImpl* instance);
    318 
    319   // Informs the render view that a PPAPI plugin has changed selection.
    320   void PepperSelectionChanged(PepperPluginInstanceImpl* instance);
    321 
    322   // Creates a fullscreen container for a pepper plugin instance.
    323   RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer(
    324       PepperPluginInstanceImpl* plugin);
    325 
    326   // Notification that a PPAPI plugin has been created.
    327   void PepperPluginCreated(RendererPpapiHost* host);
    328 
    329   // Retrieves the current caret position if a PPAPI plugin has focus.
    330   bool GetPepperCaretBounds(gfx::Rect* rect);
    331 
    332   bool IsPepperAcceptingCompositionEvents() const;
    333 
    334   // Notification that the given plugin has crashed.
    335   void PluginCrashed(const base::FilePath& plugin_path,
    336                      base::ProcessId plugin_pid);
    337 
    338   // Simulates IME events for testing purpose.
    339   void SimulateImeSetComposition(
    340       const string16& text,
    341       const std::vector<WebKit::WebCompositionUnderline>& underlines,
    342       int selection_start,
    343       int selection_end);
    344   void SimulateImeConfirmComposition(const string16& text,
    345                                      const ui::Range& replacement_range);
    346 
    347 #if defined(OS_MACOSX) || defined(OS_WIN)
    348   // Informs the render view that the given plugin has gained or lost focus.
    349   void PluginFocusChanged(bool focused, int plugin_id);
    350 #endif
    351 
    352 #if defined(OS_MACOSX)
    353   // Starts plugin IME.
    354   void StartPluginIme();
    355 #endif
    356 
    357   void RegisterPluginDelegate(WebPluginDelegateProxy* delegate);
    358   void UnregisterPluginDelegate(WebPluginDelegateProxy* delegate);
    359 
    360   // Helper function to retrieve information about a plugin for a URL and mime
    361   // type. Returns false if no plugin was found.
    362   // |actual_mime_type| is the actual mime type supported by the
    363   // plugin found that match the URL given (one for each item in
    364   // |info|).
    365   bool GetPluginInfo(const GURL& url,
    366                      const GURL& page_url,
    367                      const std::string& mime_type,
    368                      WebPluginInfo* plugin_info,
    369                      std::string* actual_mime_type);
    370 
    371 #endif  // ENABLE_PLUGINS
    372 
    373   void TransferActiveWheelFlingAnimation(
    374       const WebKit::WebActiveWheelFlingParameters& params);
    375 
    376   // Returns true if the focused element is editable text from the perspective
    377   // of IME support (also used for on-screen keyboard). Works correctly inside
    378   // supported PPAPI plug-ins.
    379   bool HasIMETextFocus();
    380 
    381   // Callback for use with GetWindowSnapshot.
    382   typedef base::Callback<void(
    383       const gfx::Size&, const std::vector<unsigned char>&)>
    384       WindowSnapshotCallback;
    385 
    386   void GetWindowSnapshot(const WindowSnapshotCallback& callback);
    387 
    388   // Dispatches the current navigation state to the browser. Called on a
    389   // periodic timer so we don't send too many messages.
    390   void SyncNavigationState();
    391 
    392   // Returns the length of the session history of this RenderView. Note that
    393   // this only coincides with the actual length of the session history if this
    394   // RenderView is the currently active RenderView of a WebContents.
    395   unsigned GetLocalSessionHistoryLengthForTesting() const;
    396 
    397   // Invokes OnSetFocus and marks the widget as active depending on the value
    398   // of |enable|. This is used for layout tests that need to control the focus
    399   // synchronously from the renderer.
    400   void SetFocusAndActivateForTesting(bool enable);
    401 
    402   // Change the device scale factor and force the compositor to resize.
    403   void SetDeviceScaleFactorForTesting(float factor);
    404 
    405   // Control autoresize mode.
    406   void EnableAutoResizeForTesting(const gfx::Size& min_size,
    407                                   const gfx::Size& max_size);
    408   void DisableAutoResizeForTesting(const gfx::Size& new_size);
    409 
    410   // Overrides the MediaStreamClient used when creating MediaStream players.
    411   // Must be called before any players are created.
    412   void SetMediaStreamClientForTesting(MediaStreamClient* media_stream_client);
    413 
    414   // IPC::Listener implementation ----------------------------------------------
    415 
    416   virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
    417 
    418   // WebKit::WebWidgetClient implementation ------------------------------------
    419 
    420   // Most methods are handled by RenderWidget.
    421   virtual void didFocus();
    422   virtual void didBlur();
    423   virtual void show(WebKit::WebNavigationPolicy policy);
    424   virtual void runModal();
    425   virtual bool enterFullScreen();
    426   virtual void exitFullScreen();
    427   virtual bool requestPointerLock();
    428   virtual void requestPointerUnlock();
    429   virtual bool isPointerLocked();
    430   virtual void didActivateCompositor(int input_handler_identifier);
    431   virtual void didHandleGestureEvent(const WebKit::WebGestureEvent& event,
    432                                      bool event_cancelled) OVERRIDE;
    433   virtual void initializeLayerTreeView() OVERRIDE;
    434 
    435   // WebKit::WebViewClient implementation --------------------------------------
    436 
    437   virtual WebKit::WebView* createView(
    438       WebKit::WebFrame* creator,
    439       const WebKit::WebURLRequest& request,
    440       const WebKit::WebWindowFeatures& features,
    441       const WebKit::WebString& frame_name,
    442       WebKit::WebNavigationPolicy policy);
    443   virtual WebKit::WebWidget* createPopupMenu(WebKit::WebPopupType popup_type);
    444   virtual WebKit::WebExternalPopupMenu* createExternalPopupMenu(
    445       const WebKit::WebPopupMenuInfo& popup_menu_info,
    446       WebKit::WebExternalPopupMenuClient* popup_menu_client);
    447   virtual WebKit::WebStorageNamespace* createSessionStorageNamespace();
    448   virtual void didAddMessageToConsole(
    449       const WebKit::WebConsoleMessage& message,
    450       const WebKit::WebString& source_name,
    451       unsigned source_line);
    452   virtual void printPage(WebKit::WebFrame* frame);
    453   virtual WebKit::WebNotificationPresenter* notificationPresenter();
    454   virtual bool enumerateChosenDirectory(
    455       const WebKit::WebString& path,
    456       WebKit::WebFileChooserCompletion* chooser_completion);
    457   virtual void initializeHelperPluginWebFrame(WebKit::WebHelperPlugin*);
    458   virtual void didStartLoading();
    459   virtual void didStopLoading();
    460   virtual void didChangeLoadProgress(WebKit::WebFrame* frame,
    461                                      double load_progress);
    462   virtual void didCancelCompositionOnSelectionChange();
    463   virtual void didChangeSelection(bool is_selection_empty);
    464   virtual void didExecuteCommand(const WebKit::WebString& command_name);
    465   virtual bool handleCurrentKeyboardEvent();
    466   virtual WebKit::WebColorChooser* createColorChooser(
    467       WebKit::WebColorChooserClient*, const WebKit::WebColor& initial_color);
    468   virtual bool runFileChooser(
    469       const WebKit::WebFileChooserParams& params,
    470       WebKit::WebFileChooserCompletion* chooser_completion);
    471   virtual void runModalAlertDialog(WebKit::WebFrame* frame,
    472                                    const WebKit::WebString& message);
    473   virtual bool runModalConfirmDialog(WebKit::WebFrame* frame,
    474                                      const WebKit::WebString& message);
    475   virtual bool runModalPromptDialog(WebKit::WebFrame* frame,
    476                                     const WebKit::WebString& message,
    477                                     const WebKit::WebString& default_value,
    478                                     WebKit::WebString* actual_value);
    479   virtual bool runModalBeforeUnloadDialog(WebKit::WebFrame* frame,
    480                                           bool is_reload,
    481                                           const WebKit::WebString& message);
    482   // DEPRECATED
    483   virtual bool runModalBeforeUnloadDialog(WebKit::WebFrame* frame,
    484                                           const WebKit::WebString& message);
    485   virtual void showContextMenu(WebKit::WebFrame* frame,
    486                                const WebKit::WebContextMenuData& data);
    487   virtual void setStatusText(const WebKit::WebString& text);
    488   virtual void setMouseOverURL(const WebKit::WebURL& url);
    489   virtual void setKeyboardFocusURL(const WebKit::WebURL& url);
    490   virtual void startDragging(WebKit::WebFrame* frame,
    491                              const WebKit::WebDragData& data,
    492                              WebKit::WebDragOperationsMask mask,
    493                              const WebKit::WebImage& image,
    494                              const WebKit::WebPoint& imageOffset);
    495   virtual bool acceptsLoadDrops();
    496   virtual void focusNext();
    497   virtual void focusPrevious();
    498   virtual void focusedNodeChanged(const WebKit::WebNode& node);
    499   virtual void numberOfWheelEventHandlersChanged(unsigned num_handlers);
    500   virtual void didUpdateLayout();
    501 #if defined(OS_ANDROID)
    502   virtual bool didTapMultipleTargets(
    503       const WebKit::WebGestureEvent& event,
    504       const WebKit::WebVector<WebKit::WebRect>& target_rects);
    505 #endif
    506   virtual void navigateBackForwardSoon(int offset);
    507   virtual int historyBackListCount();
    508   virtual int historyForwardListCount();
    509   virtual void postAccessibilityNotification(
    510       const WebKit::WebAccessibilityObject& obj,
    511       WebKit::WebAccessibilityNotification notification);
    512   virtual void didUpdateInspectorSetting(const WebKit::WebString& key,
    513                                          const WebKit::WebString& value);
    514   virtual WebKit::WebGeolocationClient* geolocationClient();
    515   virtual WebKit::WebSpeechInputController* speechInputController(
    516       WebKit::WebSpeechInputListener* listener);
    517   virtual WebKit::WebSpeechRecognizer* speechRecognizer();
    518   virtual WebKit::WebDeviceOrientationClient* deviceOrientationClient();
    519   virtual void zoomLimitsChanged(double minimum_level, double maximum_level);
    520   virtual void zoomLevelChanged();
    521   virtual double zoomLevelToZoomFactor(double zoom_level) const;
    522   virtual double zoomFactorToZoomLevel(double factor) const;
    523   virtual void registerProtocolHandler(const WebKit::WebString& scheme,
    524                                        const WebKit::WebString& base_url,
    525                                        const WebKit::WebString& url,
    526                                        const WebKit::WebString& title);
    527   virtual WebKit::WebPageVisibilityState visibilityState() const;
    528   virtual WebKit::WebUserMediaClient* userMediaClient();
    529   virtual WebKit::WebMIDIClient* webMIDIClient();
    530   virtual void draggableRegionsChanged();
    531 
    532 #if defined(OS_ANDROID)
    533   virtual void scheduleContentIntent(const WebKit::WebURL& intent);
    534   virtual void cancelScheduledContentIntents();
    535   virtual WebKit::WebContentDetectionResult detectContentAround(
    536       const WebKit::WebHitTestResult& touch_hit);
    537 
    538   // Only used on Android since all other platforms implement
    539   // date and time input fields using MULTIPLE_FIELDS_UI
    540   virtual bool openDateTimeChooser(const WebKit::WebDateTimeChooserParams&,
    541                                    WebKit::WebDateTimeChooserCompletion*);
    542   virtual void didScrollWithKeyboard(const WebKit::WebSize& delta);
    543 #endif
    544 
    545   // WebKit::WebFrameClient implementation -------------------------------------
    546 
    547   virtual WebKit::WebPlugin* createPlugin(
    548       WebKit::WebFrame* frame,
    549       const WebKit::WebPluginParams& params);
    550   virtual WebKit::WebSharedWorker* createSharedWorker(
    551       WebKit::WebFrame* frame, const WebKit::WebURL& url,
    552       const WebKit::WebString& name, unsigned long long documentId);
    553   virtual WebKit::WebMediaPlayer* createMediaPlayer(
    554       WebKit::WebFrame* frame,
    555       const WebKit::WebURL& url,
    556       WebKit::WebMediaPlayerClient* client);
    557   virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost(
    558       WebKit::WebFrame* frame,
    559       WebKit::WebApplicationCacheHostClient* client);
    560   virtual WebKit::WebCookieJar* cookieJar(WebKit::WebFrame* frame);
    561   virtual void didAccessInitialDocument(WebKit::WebFrame* frame);
    562   virtual void didCreateFrame(WebKit::WebFrame* parent,
    563                               WebKit::WebFrame* child);
    564   virtual void didDisownOpener(WebKit::WebFrame* frame);
    565   virtual void frameDetached(WebKit::WebFrame* frame);
    566   virtual void willClose(WebKit::WebFrame* frame);
    567   virtual void didChangeName(WebKit::WebFrame* frame,
    568                              const WebKit::WebString& name);
    569   virtual void loadURLExternally(WebKit::WebFrame* frame,
    570                                  const WebKit::WebURLRequest& request,
    571                                  WebKit::WebNavigationPolicy policy);
    572   virtual void loadURLExternally(WebKit::WebFrame* frame,
    573                                  const WebKit::WebURLRequest& request,
    574                                  WebKit::WebNavigationPolicy policy,
    575                                  const WebKit::WebString& suggested_name);
    576 
    577   // The WebDataSource::ExtraData* is assumed to be a DocumentState* subclass.
    578   virtual WebKit::WebNavigationPolicy decidePolicyForNavigation(
    579       WebKit::WebFrame* frame,
    580       WebKit::WebDataSource::ExtraData* extraData,
    581       const WebKit::WebURLRequest& request,
    582       WebKit::WebNavigationType type,
    583       WebKit::WebNavigationPolicy default_policy,
    584       bool is_redirect);
    585   // DEPRECATED.
    586   virtual WebKit::WebNavigationPolicy decidePolicyForNavigation(
    587       WebKit::WebFrame* frame,
    588       const WebKit::WebURLRequest& request,
    589       WebKit::WebNavigationType type,
    590       WebKit::WebNavigationPolicy default_policy,
    591       bool is_redirect);
    592   virtual bool shouldAbortNavigationAfterUrlResolve(const WebKit::WebURL& base,
    593                                         const WebKit::WebString& fragment,
    594                                         const WebKit::WebURL& result) OVERRIDE;
    595   virtual void willSendSubmitEvent(WebKit::WebFrame* frame,
    596                                    const WebKit::WebFormElement& form);
    597   virtual void willSubmitForm(WebKit::WebFrame* frame,
    598                               const WebKit::WebFormElement& form);
    599   virtual void didCreateDataSource(WebKit::WebFrame* frame,
    600                                    WebKit::WebDataSource* datasource);
    601   virtual void didStartProvisionalLoad(WebKit::WebFrame* frame);
    602   virtual void didReceiveServerRedirectForProvisionalLoad(
    603       WebKit::WebFrame* frame);
    604   virtual void didFailProvisionalLoad(WebKit::WebFrame* frame,
    605                                       const WebKit::WebURLError& error);
    606   virtual void didCommitProvisionalLoad(WebKit::WebFrame* frame,
    607                                         bool is_new_navigation);
    608   virtual void didClearWindowObject(WebKit::WebFrame* frame);
    609   virtual void didCreateDocumentElement(WebKit::WebFrame* frame);
    610   virtual void didReceiveTitle(WebKit::WebFrame* frame,
    611                                const WebKit::WebString& title,
    612                                WebKit::WebTextDirection direction);
    613   virtual void didChangeIcon(WebKit::WebFrame*,
    614                              WebKit::WebIconURL::Type);
    615   virtual void didFinishDocumentLoad(WebKit::WebFrame* frame);
    616   virtual void didHandleOnloadEvents(WebKit::WebFrame* frame);
    617   virtual void didFailLoad(WebKit::WebFrame* frame,
    618                            const WebKit::WebURLError& error);
    619   virtual void didFinishLoad(WebKit::WebFrame* frame);
    620   virtual void didNavigateWithinPage(WebKit::WebFrame* frame,
    621                                      bool is_new_navigation);
    622   virtual void didUpdateCurrentHistoryItem(WebKit::WebFrame* frame);
    623   virtual void willSendRequest(WebKit::WebFrame* frame,
    624                                unsigned identifier,
    625                                WebKit::WebURLRequest& request,
    626                                const WebKit::WebURLResponse& redirect_response);
    627   virtual void didReceiveResponse(WebKit::WebFrame* frame,
    628                                   unsigned identifier,
    629                                   const WebKit::WebURLResponse& response);
    630   virtual void didFinishResourceLoad(WebKit::WebFrame* frame,
    631                                      unsigned identifier);
    632   virtual void didLoadResourceFromMemoryCache(
    633       WebKit::WebFrame* frame,
    634       const WebKit::WebURLRequest& request,
    635       const WebKit::WebURLResponse&);
    636   virtual void didDisplayInsecureContent(WebKit::WebFrame* frame);
    637   virtual void didRunInsecureContent(
    638       WebKit::WebFrame* frame,
    639       const WebKit::WebSecurityOrigin& origin,
    640       const WebKit::WebURL& target);
    641   virtual void didExhaustMemoryAvailableForScript(WebKit::WebFrame* frame);
    642   virtual void didCreateScriptContext(WebKit::WebFrame* frame,
    643                                       v8::Handle<v8::Context>,
    644                                       int extension_group,
    645                                       int world_id);
    646   virtual void willReleaseScriptContext(WebKit::WebFrame* frame,
    647                                         v8::Handle<v8::Context>,
    648                                         int world_id);
    649   virtual void didChangeScrollOffset(WebKit::WebFrame* frame);
    650   virtual void willInsertBody(WebKit::WebFrame* frame);
    651   virtual void didFirstVisuallyNonEmptyLayout(WebKit::WebFrame*);
    652   virtual void didChangeContentsSize(WebKit::WebFrame* frame,
    653                                      const WebKit::WebSize& size);
    654   virtual void reportFindInPageMatchCount(int request_id,
    655                                           int count,
    656                                           bool final_update);
    657   virtual void reportFindInPageSelection(int request_id,
    658                                          int active_match_ordinal,
    659                                          const WebKit::WebRect& sel);
    660   virtual void openFileSystem(WebKit::WebFrame* frame,
    661                               WebKit::WebFileSystemType type,
    662                               long long size,
    663                               bool create,
    664                               WebKit::WebFileSystemCallbacks* callbacks);
    665   virtual void deleteFileSystem(WebKit::WebFrame* frame,
    666                                 WebKit::WebFileSystemType type,
    667                                 WebKit::WebFileSystemCallbacks* callbacks);
    668   virtual void requestStorageQuota(
    669       WebKit::WebFrame* frame,
    670       WebKit::WebStorageQuotaType type,
    671       unsigned long long requested_size,
    672       WebKit::WebStorageQuotaCallbacks* callbacks);
    673   virtual void willOpenSocketStream(
    674       WebKit::WebSocketStreamHandle* handle);
    675   virtual void willStartUsingPeerConnectionHandler(WebKit::WebFrame* frame,
    676       WebKit::WebRTCPeerConnectionHandler* handler);
    677   virtual bool willCheckAndDispatchMessageEvent(
    678       WebKit::WebFrame* sourceFrame,
    679       WebKit::WebFrame* targetFrame,
    680       WebKit::WebSecurityOrigin targetOrigin,
    681       WebKit::WebDOMMessageEvent event);
    682   virtual WebKit::WebString acceptLanguages();
    683   virtual WebKit::WebString userAgentOverride(
    684       WebKit::WebFrame* frame,
    685       const WebKit::WebURL& url);
    686   virtual WebKit::WebString doNotTrackValue(WebKit::WebFrame* frame);
    687   virtual bool allowWebGL(WebKit::WebFrame* frame, bool default_value);
    688   virtual void didLoseWebGLContext(
    689       WebKit::WebFrame* frame,
    690       int arb_robustness_status_code);
    691 
    692   // WebKit::WebPageSerializerClient implementation ----------------------------
    693 
    694   virtual void didSerializeDataForFrame(
    695       const WebKit::WebURL& frame_url,
    696       const WebKit::WebCString& data,
    697       PageSerializationStatus status) OVERRIDE;
    698 
    699   // RenderView implementation -------------------------------------------------
    700 
    701   virtual bool Send(IPC::Message* message) OVERRIDE;
    702   virtual int GetRoutingID() const OVERRIDE;
    703   virtual int GetPageId() const OVERRIDE;
    704   virtual gfx::Size GetSize() const OVERRIDE;
    705   virtual WebPreferences& GetWebkitPreferences() OVERRIDE;
    706   virtual void SetWebkitPreferences(const WebPreferences& preferences) OVERRIDE;
    707   virtual WebKit::WebView* GetWebView() OVERRIDE;
    708   virtual WebKit::WebNode GetFocusedNode() const OVERRIDE;
    709   virtual WebKit::WebNode GetContextMenuNode() const OVERRIDE;
    710   virtual bool IsEditableNode(const WebKit::WebNode& node) const OVERRIDE;
    711   virtual WebKit::WebPlugin* CreatePlugin(
    712       WebKit::WebFrame* frame,
    713       const WebPluginInfo& info,
    714       const WebKit::WebPluginParams& params) OVERRIDE;
    715   virtual void EvaluateScript(const string16& frame_xpath,
    716                               const string16& jscript,
    717                               int id,
    718                               bool notify_result) OVERRIDE;
    719   virtual bool ShouldDisplayScrollbars(int width, int height) const OVERRIDE;
    720   virtual int GetEnabledBindings() const OVERRIDE;
    721   virtual bool GetContentStateImmediately() const OVERRIDE;
    722   virtual float GetFilteredTimePerFrame() const OVERRIDE;
    723   virtual int ShowContextMenu(ContextMenuClient* client,
    724                               const ContextMenuParams& params) OVERRIDE;
    725   virtual void CancelContextMenu(int request_id) OVERRIDE;
    726   virtual WebKit::WebPageVisibilityState GetVisibilityState() const OVERRIDE;
    727   virtual void RunModalAlertDialog(WebKit::WebFrame* frame,
    728                                    const WebKit::WebString& message) OVERRIDE;
    729   virtual void LoadURLExternally(
    730       WebKit::WebFrame* frame,
    731       const WebKit::WebURLRequest& request,
    732       WebKit::WebNavigationPolicy policy) OVERRIDE;
    733   virtual void DidStartLoading() OVERRIDE;
    734   virtual void DidStopLoading() OVERRIDE;
    735   virtual void Repaint(const gfx::Size& size) OVERRIDE;
    736   virtual void SetEditCommandForNextKeyEvent(const std::string& name,
    737                                              const std::string& value) OVERRIDE;
    738   virtual void ClearEditCommands() OVERRIDE;
    739   virtual SSLStatus GetSSLStatusOfFrame(WebKit::WebFrame* frame) const OVERRIDE;
    740 #if defined(OS_ANDROID)
    741   virtual void UpdateTopControlsState(TopControlsState constraints,
    742                                       TopControlsState current,
    743                                       bool animate) OVERRIDE;
    744 #endif
    745 
    746   // WebMediaPlayerDelegate implementation -----------------------
    747 
    748   virtual void DidPlay(WebKit::WebMediaPlayer* player) OVERRIDE;
    749   virtual void DidPause(WebKit::WebMediaPlayer* player) OVERRIDE;
    750   virtual void PlayerGone(WebKit::WebMediaPlayer* player) OVERRIDE;
    751 
    752   // Please do not add your stuff randomly to the end here. If there is an
    753   // appropriate section, add it there. If not, there are some random functions
    754   // nearer to the top you can add it to.
    755 
    756   // Cannot use std::set unfortunately since linked_ptr<> does not support
    757   // operator<.
    758   typedef std::vector<linked_ptr<ImageResourceFetcher> >
    759       ImageResourceFetcherList;
    760 
    761  protected:
    762   // RenderWidget overrides:
    763   virtual void Close() OVERRIDE;
    764   virtual void OnResize(const ViewMsg_Resize_Params& params) OVERRIDE;
    765   virtual void WillInitiatePaint() OVERRIDE;
    766   virtual void DidInitiatePaint() OVERRIDE;
    767   virtual void DidFlushPaint() OVERRIDE;
    768   virtual PepperPluginInstanceImpl* GetBitmapForOptimizedPluginPaint(
    769       const gfx::Rect& paint_bounds,
    770       TransportDIB** dib,
    771       gfx::Rect* location,
    772       gfx::Rect* clip,
    773       float* scale_factor) OVERRIDE;
    774   virtual gfx::Vector2d GetScrollOffset() OVERRIDE;
    775   virtual void DidHandleKeyEvent() OVERRIDE;
    776   virtual bool WillHandleMouseEvent(
    777       const WebKit::WebMouseEvent& event) OVERRIDE;
    778   virtual bool WillHandleKeyEvent(
    779       const WebKit::WebKeyboardEvent& event) OVERRIDE;
    780   virtual bool WillHandleGestureEvent(
    781       const WebKit::WebGestureEvent& event) OVERRIDE;
    782   virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event) OVERRIDE;
    783   virtual void DidHandleTouchEvent(const WebKit::WebTouchEvent& event) OVERRIDE;
    784   virtual bool HasTouchEventHandlersAt(const gfx::Point& point) const OVERRIDE;
    785   virtual void OnSetFocus(bool enable) OVERRIDE;
    786   virtual void OnWasHidden() OVERRIDE;
    787   virtual void OnWasShown(bool needs_repainting) OVERRIDE;
    788   virtual GURL GetURLForGraphicsContext3D() OVERRIDE;
    789   virtual bool ForceCompositingModeEnabled() OVERRIDE;
    790   virtual void OnImeSetComposition(
    791       const string16& text,
    792       const std::vector<WebKit::WebCompositionUnderline>& underlines,
    793       int selection_start,
    794       int selection_end) OVERRIDE;
    795   virtual void OnImeConfirmComposition(const string16& text,
    796                                        const ui::Range& replacement_range,
    797                                        bool keep_selection) OVERRIDE;
    798   virtual void SetDeviceScaleFactor(float device_scale_factor) OVERRIDE;
    799   virtual ui::TextInputType GetTextInputType() OVERRIDE;
    800   virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) OVERRIDE;
    801 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(USE_AURA)
    802   virtual void GetCompositionCharacterBounds(
    803       std::vector<gfx::Rect>* character_bounds) OVERRIDE;
    804   virtual void GetCompositionRange(ui::Range* range) OVERRIDE;
    805 #endif
    806   virtual bool CanComposeInline() OVERRIDE;
    807   virtual void DidCommitCompositorFrame() OVERRIDE;
    808   virtual void InstrumentWillBeginFrame() OVERRIDE;
    809   virtual void InstrumentDidBeginFrame() OVERRIDE;
    810   virtual void InstrumentDidCancelFrame() OVERRIDE;
    811   virtual void InstrumentWillComposite() OVERRIDE;
    812   virtual bool AllowPartialSwap() const OVERRIDE;
    813 
    814  protected:
    815   explicit RenderViewImpl(RenderViewImplParams* params);
    816 
    817   void Initialize(RenderViewImplParams* params);
    818 
    819   // Do not delete directly.  This class is reference counted.
    820   virtual ~RenderViewImpl();
    821 
    822  private:
    823   // For unit tests.
    824   friend class ExternalPopupMenuTest;
    825   friend class PepperDeviceTest;
    826   friend class RendererAccessibilityTest;
    827   friend class RenderViewTest;
    828 
    829   // TODO(nasko): Temporarily friend RenderFrameImpl, so we don't duplicate
    830   // utility functions needed in both classes, while we move frame specific
    831   // code away from this class.
    832   friend class RenderFrameImpl;
    833 
    834   FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange);
    835   FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase);
    836   FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate);
    837   FRIEND_TEST_ALL_PREFIXES(RendererAccessibilityTest,
    838                            AccessibilityMessagesQueueWhileSwappedOut);
    839   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, DecideNavigationPolicyForWebUI);
    840   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
    841                            DidFailProvisionalLoadWithErrorForError);
    842   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
    843                            DidFailProvisionalLoadWithErrorForCancellation);
    844   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
    845                            DontIgnoreBackAfterNavEntryLimit);
    846   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ImeComposition);
    847   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, InsertCharacters);
    848   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, JSBlockSentAfterPageLoad);
    849   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, LastCommittedUpdateState);
    850   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnExtendSelectionAndDelete);
    851   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnHandleKeyboardEvent);
    852   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnImeTypeChanged);
    853   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnNavStateChanged);
    854   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnSetTextDirection);
    855   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnUpdateWebPreferences);
    856   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SendSwapOutACK);
    857   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ReloadWhileSwappedOut);
    858   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
    859                            SetEditableSelectionAndComposition);
    860   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, StaleNavigationsIgnored);
    861   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, UpdateTargetURLWithInvalidURL);
    862   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
    863                            GetCompositionCharacterBoundsTest);
    864   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnNavigationHttpPost);
    865 #if defined(OS_MACOSX)
    866   FRIEND_TEST_ALL_PREFIXES(RenderViewTest, MacTestCmdUp);
    867 #endif
    868   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SetHistoryLengthAndPrune);
    869   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ZoomLimit);
    870   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, NavigateFrame);
    871   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
    872                            ShouldUpdateSelectionTextFromContextMenuParams);
    873   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, BasicRenderFrame);
    874   FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, TextInputTypeWithPepper);
    875 
    876   typedef std::map<GURL, double> HostZoomLevels;
    877 
    878   enum ErrorPageType {
    879     DNS_ERROR,
    880     HTTP_404,
    881     CONNECTION_ERROR,
    882   };
    883 
    884   static WebKit::WebReferrerPolicy GetReferrerPolicyFromRequest(
    885       WebKit::WebFrame* frame,
    886       const WebKit::WebURLRequest& request);
    887 
    888   static Referrer GetReferrerFromRequest(
    889       WebKit::WebFrame* frame,
    890       const WebKit::WebURLRequest& request);
    891 
    892   static webkit_glue::WebURLResponseExtraDataImpl* GetExtraDataFromResponse(
    893       const WebKit::WebURLResponse& response);
    894 
    895   void UpdateURL(WebKit::WebFrame* frame);
    896   void UpdateTitle(WebKit::WebFrame* frame, const string16& title,
    897                    WebKit::WebTextDirection title_direction);
    898   void UpdateSessionHistory(WebKit::WebFrame* frame);
    899   void SendUpdateState(const WebKit::WebHistoryItem& item);
    900 
    901   // Update current main frame's encoding and send it to browser window.
    902   // Since we want to let users see the right encoding info from menu
    903   // before finishing loading, we call the UpdateEncoding in
    904   // a) function:DidCommitLoadForFrame. When this function is called,
    905   // that means we have got first data. In here we try to get encoding
    906   // of page if it has been specified in http header.
    907   // b) function:DidReceiveTitle. When this function is called,
    908   // that means we have got specified title. Because in most of webpages,
    909   // title tags will follow meta tags. In here we try to get encoding of
    910   // page if it has been specified in meta tag.
    911   // c) function:DidFinishDocumentLoadForFrame. When this function is
    912   // called, that means we have got whole html page. In here we should
    913   // finally get right encoding of page.
    914   void UpdateEncoding(WebKit::WebFrame* frame,
    915                       const std::string& encoding_name);
    916 
    917   void OpenURL(WebKit::WebFrame* frame,
    918                const GURL& url,
    919                const Referrer& referrer,
    920                WebKit::WebNavigationPolicy policy);
    921 
    922   bool RunJavaScriptMessage(JavaScriptMessageType type,
    923                             const string16& message,
    924                             const string16& default_value,
    925                             const GURL& frame_url,
    926                             string16* result);
    927 
    928   // Sends a message and runs a nested message loop.
    929   bool SendAndRunNestedMessageLoop(IPC::SyncMessage* message);
    930 
    931   // Called when the "pinned to left/right edge" state needs to be updated.
    932   void UpdateScrollState(WebKit::WebFrame* frame);
    933 
    934   // IPC message handlers ------------------------------------------------------
    935   //
    936   // The documentation for these functions should be in
    937   // content/common/*_messages.h for the message that the function is handling.
    938 
    939   void OnCopy();
    940   void OnCut();
    941   void OnDelete();
    942   void OnExecuteEditCommand(const std::string& name, const std::string& value);
    943   void OnMoveCaret(const gfx::Point& point);
    944   void OnPaste();
    945   void OnPasteAndMatchStyle();
    946   void OnRedo();
    947   void OnReplace(const string16& text);
    948   void OnReplaceMisspelling(const string16& text);
    949   void OnScrollFocusedEditableNodeIntoRect(const gfx::Rect& rect);
    950   void OnSelectAll();
    951   void OnSelectRange(const gfx::Point& start, const gfx::Point& end);
    952   void OnSetEditCommandsForNextKeyEvent(const EditCommands& edit_commands);
    953   void OnUndo();
    954   void OnUnselect();
    955 
    956   void OnAllowBindings(int enabled_bindings_flags);
    957   void OnAllowScriptToClose(bool script_can_close);
    958   void OnCancelDownload(int32 download_id);
    959   void OnClearFocusedNode();
    960   void OnClosePage();
    961   void OnContextMenuClosed(const CustomContextMenuContext& custom_context);
    962   void OnShowContextMenu(const gfx::Point& location);
    963   void OnCopyImageAt(int x, int y);
    964   void OnCSSInsertRequest(const string16& frame_xpath,
    965                           const std::string& css);
    966   void OnCustomContextMenuAction(const CustomContextMenuContext& custom_context,
    967       unsigned action);
    968   void OnSetName(const std::string& name);
    969   void OnDeterminePageLanguage();
    970   void OnDisableScrollbarsForSmallWindows(
    971       const gfx::Size& disable_scrollbars_size_limit);
    972   void OnDisassociateFromPopupCount();
    973   void OnDragSourceEndedOrMoved(const gfx::Point& client_point,
    974                                 const gfx::Point& screen_point,
    975                                 bool ended,
    976                                 WebKit::WebDragOperation drag_operation);
    977   void OnDragSourceSystemDragEnded();
    978   void OnDragTargetDrop(const gfx::Point& client_pt,
    979                         const gfx::Point& screen_pt,
    980                         int key_modifiers);
    981   void OnDragTargetDragEnter(const DropData& drop_data,
    982                              const gfx::Point& client_pt,
    983                              const gfx::Point& screen_pt,
    984                              WebKit::WebDragOperationsMask operations_allowed,
    985                              int key_modifiers);
    986   void OnDragTargetDragLeave();
    987   void OnDragTargetDragOver(const gfx::Point& client_pt,
    988                             const gfx::Point& screen_pt,
    989                             WebKit::WebDragOperationsMask operations_allowed,
    990                             int key_modifiers);
    991   void OnEnablePreferredSizeChangedMode();
    992   void OnEnableAutoResize(const gfx::Size& min_size, const gfx::Size& max_size);
    993   void OnDisableAutoResize(const gfx::Size& new_size);
    994   void OnEnumerateDirectoryResponse(int id,
    995                                     const std::vector<base::FilePath>& paths);
    996   void OnExtendSelectionAndDelete(int before, int after);
    997   void OnFileChooserResponse(
    998       const std::vector<ui::SelectedFileInfo>& files);
    999   void OnFind(int request_id, const string16&, const WebKit::WebFindOptions&);
   1000   void OnGetAllSavableResourceLinksForCurrentPage(const GURL& page_url);
   1001   void OnGetSerializedHtmlDataForCurrentPageWithLocalLinks(
   1002       const std::vector<GURL>& links,
   1003       const std::vector<base::FilePath>& local_paths,
   1004       const base::FilePath& local_directory_name);
   1005   void OnMediaPlayerActionAt(const gfx::Point& location,
   1006                              const WebKit::WebMediaPlayerAction& action);
   1007 
   1008   // Screen has rotated. 0 = default (portrait), 90 = one turn right, and so on.
   1009   void OnOrientationChangeEvent(int orientation);
   1010 
   1011   void OnPluginActionAt(const gfx::Point& location,
   1012                         const WebKit::WebPluginAction& action);
   1013   void OnMoveOrResizeStarted();
   1014   void OnNavigate(const ViewMsg_Navigate_Params& params);
   1015   void OnPostMessageEvent(const ViewMsg_PostMessage_Params& params);
   1016   void OnReleaseDisambiguationPopupDIB(TransportDIB::Handle dib_handle);
   1017   void OnReloadFrame();
   1018   void OnResetPageEncodingToDefault();
   1019   void OnScriptEvalRequest(const string16& frame_xpath,
   1020                            const string16& jscript,
   1021                            int id,
   1022                            bool notify_result);
   1023   void OnSetAccessibilityMode(AccessibilityMode new_mode);
   1024   void OnSetActive(bool active);
   1025   void OnSetAltErrorPageURL(const GURL& gurl);
   1026   void OnSetBackground(const SkBitmap& background);
   1027   void OnSetCompositionFromExistingText(
   1028       int start, int end,
   1029       const std::vector<WebKit::WebCompositionUnderline>& underlines);
   1030   void OnExitFullscreen();
   1031   void OnSetEditableSelectionOffsets(int start, int end);
   1032   void OnSetHistoryLengthAndPrune(int history_length, int32 minimum_page_id);
   1033   void OnSetInitialFocus(bool reverse);
   1034   void OnSetPageEncoding(const std::string& encoding_name);
   1035   void OnSetRendererPrefs(const RendererPreferences& renderer_prefs);
   1036   void OnSetWebUIProperty(const std::string& name, const std::string& value);
   1037   void OnSetZoomLevel(double zoom_level);
   1038   void OnSetZoomLevelForLoadingURL(const GURL& url, double zoom_level);
   1039   void OnShouldClose();
   1040   void OnStop();
   1041   void OnStopFinding(StopFindAction action);
   1042   void OnSwapOut();
   1043   void OnThemeChanged();
   1044   void OnUpdateTargetURLAck();
   1045   void OnUpdateTimezone();
   1046   void OnUpdateWebPreferences(const WebPreferences& prefs);
   1047 
   1048   void OnZoom(PageZoom zoom);
   1049   void OnZoomFactor(PageZoom zoom, int zoom_center_x, int zoom_center_y);
   1050 
   1051   void OnEnableViewSourceMode();
   1052 
   1053   void OnJavaBridgeInit();
   1054 
   1055   void OnDisownOpener();
   1056 
   1057 #if defined(OS_ANDROID)
   1058   void OnActivateNearestFindResult(int request_id, float x, float y);
   1059   void OnFindMatchRects(int current_version);
   1060   void OnSelectPopupMenuItems(bool canceled,
   1061                               const std::vector<int>& selected_indices);
   1062   void OnUndoScrollFocusedEditableNodeIntoRect();
   1063   void OnUpdateTopControlsState(bool enable_hiding,
   1064                                 bool enable_showing,
   1065                                 bool animate);
   1066   void OnPauseVideo();
   1067 
   1068 #elif defined(OS_MACOSX)
   1069   void OnCopyToFindPboard();
   1070   void OnPluginImeCompositionCompleted(const string16& text, int plugin_id);
   1071   void OnSelectPopupMenuItem(int selected_index);
   1072   void OnSetInLiveResize(bool in_live_resize);
   1073   void OnSetWindowVisibility(bool visible);
   1074   void OnWindowFrameChanged(const gfx::Rect& window_frame,
   1075                             const gfx::Rect& view_frame);
   1076 #endif
   1077 
   1078   void OnWindowSnapshotCompleted(const int snapshot_id,
   1079       const gfx::Size& size, const std::vector<unsigned char>& png);
   1080 
   1081 
   1082   // Adding a new message handler? Please add it in alphabetical order above
   1083   // and put it in the same position in the .cc file.
   1084 
   1085   // Misc private functions ----------------------------------------------------
   1086   void ZoomFactorHelper(PageZoom zoom, int zoom_center_x, int zoom_center_y,
   1087                         float scaling_increment);
   1088 
   1089   void AltErrorPageFinished(WebKit::WebFrame* frame,
   1090                             const WebKit::WebURLRequest& original_request,
   1091                             const WebKit::WebURLError& original_error,
   1092                             const std::string& html);
   1093 
   1094   // Check whether the preferred size has changed.
   1095   void CheckPreferredSize();
   1096 
   1097   // Initializes |media_stream_client_| if needed.
   1098   // TODO(qinmin): rename this function as it does not guarantee
   1099   // |media_stream_client_| will be created.
   1100   // http://crbug.com/278490.
   1101   void EnsureMediaStreamClient();
   1102 
   1103   // This callback is triggered when DownloadFavicon completes, either
   1104   // succesfully or with a failure. See DownloadFavicon for more
   1105   // details.
   1106   void DidDownloadFavicon(ImageResourceFetcher* fetcher,
   1107                           const SkBitmap& image);
   1108 
   1109   // Requests to download a favicon image. When done, the RenderView is notified
   1110   // by way of DidDownloadFavicon. Returns true if the request was successfully
   1111   // started, false otherwise. id is used to uniquely identify the request and
   1112   // passed back to the DidDownloadFavicon method. If the image has multiple
   1113   // frames, the frame whose size is image_size is returned. If the image
   1114   // doesn't have a frame at the specified size, the first is returned.
   1115   bool DownloadFavicon(int id, const GURL& image_url, int image_size);
   1116 
   1117   GURL GetAlternateErrorPageURL(const GURL& failed_url,
   1118                                 ErrorPageType error_type);
   1119 
   1120   // Locates a sub frame with given xpath
   1121   WebKit::WebFrame* GetChildFrame(const string16& frame_xpath) const;
   1122 
   1123   // Returns the URL being loaded by the given frame's request.
   1124   GURL GetLoadingUrl(WebKit::WebFrame* frame) const;
   1125 
   1126   // Should only be called if this object wraps a PluginDocument.
   1127   WebKit::WebPlugin* GetWebPluginFromPluginDocument();
   1128 
   1129   // Returns true if the |params| navigation is to an entry that has been
   1130   // cropped due to a recent navigation the browser did not know about.
   1131   bool IsBackForwardToStaleEntry(const ViewMsg_Navigate_Params& params,
   1132                                  bool is_reload);
   1133 
   1134   bool MaybeLoadAlternateErrorPage(WebKit::WebFrame* frame,
   1135                                    const WebKit::WebURLError& error,
   1136                                    bool replace);
   1137 
   1138   // Make this RenderView show an empty, unscriptable page.
   1139   void NavigateToSwappedOutURL(WebKit::WebFrame* frame);
   1140 
   1141   // If we initiated a navigation, this function will populate |document_state|
   1142   // with the navigation information saved in OnNavigate().
   1143   void PopulateDocumentStateFromPending(DocumentState* document_state);
   1144 
   1145   // Returns a new NavigationState populated with the navigation information
   1146   // saved in OnNavigate().
   1147   NavigationState* CreateNavigationStateFromPending();
   1148 
   1149   // Processes the command-line flags --enable-viewport,
   1150   // --enable-fixed-layout[=w,h] and --enable-pinch.
   1151   void ProcessViewLayoutFlags(const CommandLine& command_line);
   1152 
   1153 #if defined(OS_ANDROID)
   1154   // Launch an Android content intent with the given URL.
   1155   void LaunchAndroidContentIntent(const GURL& intent_url, size_t request_id);
   1156 #endif
   1157 
   1158   // Sends a reply to the current find operation handling if it was a
   1159   // synchronous find request.
   1160   void SendFindReply(int request_id,
   1161                      int match_count,
   1162                      int ordinal,
   1163                      const WebKit::WebRect& selection_rect,
   1164                      bool final_status_update);
   1165 
   1166   // Returns whether |params.selection_text| should be synchronized to the
   1167   // browser before bringing up the context menu. Static for testing.
   1168   static bool ShouldUpdateSelectionTextFromContextMenuParams(
   1169       const string16& selection_text,
   1170       size_t selection_text_offset,
   1171       const ui::Range& selection_range,
   1172       const ContextMenuParams& params);
   1173 
   1174   // Starts nav_state_sync_timer_ if it isn't already running.
   1175   void StartNavStateSyncTimerIfNecessary();
   1176 
   1177   // Dispatches the current state of selection on the webpage to the browser if
   1178   // it has changed.
   1179   // TODO(varunjain): delete this method once we figure out how to keep
   1180   // selection handles in sync with the webpage.
   1181   void SyncSelectionIfRequired();
   1182 
   1183 #if defined(OS_POSIX) && !defined(OS_MACOSX)
   1184   void UpdateFontRenderingFromRendererPrefs();
   1185 #else
   1186   void UpdateFontRenderingFromRendererPrefs() {}
   1187 #endif
   1188 
   1189   // Update the target url and tell the browser that the target URL has changed.
   1190   // If |url| is empty, show |fallback_url|.
   1191   void UpdateTargetURL(const GURL& url, const GURL& fallback_url);
   1192 
   1193   // Tells the browser what the new list of favicons for the webpage is.
   1194   void SendUpdateFaviconURL(const std::vector<FaviconURL>& urls);
   1195 
   1196   // Invoked from DidStopLoading(). Sends the current list of loaded favicons to
   1197   // the browser.
   1198   void DidStopLoadingIcons();
   1199 
   1200   // Coordinate conversion -----------------------------------------------------
   1201 
   1202   gfx::RectF ClientRectToPhysicalWindowRect(const gfx::RectF& rect) const;
   1203 
   1204   // ---------------------------------------------------------------------------
   1205   // ADDING NEW FUNCTIONS? Please keep private functions alphabetized and put
   1206   // it in the same order in the .cc file as it was in the header.
   1207   // ---------------------------------------------------------------------------
   1208 
   1209   // Settings ------------------------------------------------------------------
   1210 
   1211   WebPreferences webkit_preferences_;
   1212   RendererPreferences renderer_preferences_;
   1213 
   1214   HostZoomLevels host_zoom_levels_;
   1215 
   1216   // Whether content state (such as form state, scroll position and page
   1217   // contents) should be sent to the browser immediately. This is normally
   1218   // false, but set to true by some tests.
   1219   bool send_content_state_immediately_;
   1220 
   1221   // Bitwise-ORed set of extra bindings that have been enabled.  See
   1222   // BindingsPolicy for details.
   1223   int enabled_bindings_;
   1224 
   1225   // The alternate error page URL, if one exists.
   1226   GURL alternate_error_page_url_;
   1227 
   1228   // If true, we send IPC messages when |preferred_size_| changes.
   1229   bool send_preferred_size_changes_;
   1230 
   1231   // If non-empty, and |send_preferred_size_changes_| is true, disable drawing
   1232   // scroll bars on windows smaller than this size.  Used for windows that the
   1233   // browser resizes to the size of the content, such as browser action popups.
   1234   // If a render view is set to the minimum size of its content, webkit may add
   1235   // scroll bars.  This makes sense for fixed sized windows, but it does not
   1236   // make sense when the size of the view was chosen to fit the content.
   1237   // This setting ensures that no scroll bars are drawn.  The size limit exists
   1238   // because if the view grows beyond a size known to the browser, scroll bars
   1239   // should be drawn.
   1240   gfx::Size disable_scrollbars_size_limit_;
   1241 
   1242   // Loading state -------------------------------------------------------------
   1243 
   1244   // True if the top level frame is currently being loaded.
   1245   bool is_loading_;
   1246 
   1247   // The gesture that initiated the current navigation.
   1248   NavigationGesture navigation_gesture_;
   1249 
   1250   // Used for popups.
   1251   bool opened_by_user_gesture_;
   1252 
   1253   // Whether this RenderView was created by a frame that was suppressing its
   1254   // opener. If so, we may want to load pages in a separate process.  See
   1255   // decidePolicyForNavigation for details.
   1256   bool opener_suppressed_;
   1257 
   1258   // Holds state pertaining to a navigation that we initiated.  This is held by
   1259   // the WebDataSource::ExtraData attribute.  We use pending_navigation_state_
   1260   // as a temporary holder for the state until the WebDataSource corresponding
   1261   // to the new navigation is created.  See DidCreateDataSource.
   1262   scoped_ptr<ViewMsg_Navigate_Params> pending_navigation_params_;
   1263 
   1264   // Timer used to delay the updating of nav state (see SyncNavigationState).
   1265   base::OneShotTimer<RenderViewImpl> nav_state_sync_timer_;
   1266 
   1267   // Page IDs ------------------------------------------------------------------
   1268   // See documentation in RenderView.
   1269   int32 page_id_;
   1270 
   1271   // Indicates the ID of the last page that we sent a FrameNavigate to the
   1272   // browser for. This is used to determine if the most recent transition
   1273   // generated a history entry (less than page_id_), or not (equal to or
   1274   // greater than). Note that this will be greater than page_id_ if the user
   1275   // goes back.
   1276   int32 last_page_id_sent_to_browser_;
   1277 
   1278   // The next available page ID to use for this RenderView.  These IDs are
   1279   // specific to a given RenderView and the frames within it.
   1280   int32 next_page_id_;
   1281 
   1282   // The offset of the current item in the history list.
   1283   int history_list_offset_;
   1284 
   1285   // The RenderView's current impression of the history length.  This includes
   1286   // any items that have committed in this process, but because of cross-process
   1287   // navigations, the history may have some entries that were committed in other
   1288   // processes.  We won't know about them until the next navigation in this
   1289   // process.
   1290   int history_list_length_;
   1291 
   1292   // The list of page IDs for each history item this RenderView knows about.
   1293   // Some entries may be -1 if they were rendered by other processes or were
   1294   // restored from a previous session.  This lets us detect attempts to
   1295   // navigate to stale entries that have been cropped from our history.
   1296   std::vector<int32> history_page_ids_;
   1297 
   1298   // Page info -----------------------------------------------------------------
   1299 
   1300   // The last gotten main frame's encoding.
   1301   std::string last_encoding_name_;
   1302 
   1303   // UI state ------------------------------------------------------------------
   1304 
   1305   // The state of our target_url transmissions. When we receive a request to
   1306   // send a URL to the browser, we set this to TARGET_INFLIGHT until an ACK
   1307   // comes back - if a new request comes in before the ACK, we store the new
   1308   // URL in pending_target_url_ and set the status to TARGET_PENDING. If an
   1309   // ACK comes back and we are in TARGET_PENDING, we send the stored URL and
   1310   // revert to TARGET_INFLIGHT.
   1311   //
   1312   // We don't need a queue of URLs to send, as only the latest is useful.
   1313   enum {
   1314     TARGET_NONE,
   1315     TARGET_INFLIGHT,  // We have a request in-flight, waiting for an ACK
   1316     TARGET_PENDING    // INFLIGHT + we have a URL waiting to be sent
   1317   } target_url_status_;
   1318 
   1319   // The URL we show the user in the status bar. We use this to determine if we
   1320   // want to send a new one (we do not need to send duplicates). It will be
   1321   // equal to either |mouse_over_url_| or |focus_url_|, depending on which was
   1322   // updated last.
   1323   GURL target_url_;
   1324 
   1325   // The URL the user's mouse is hovering over.
   1326   GURL mouse_over_url_;
   1327 
   1328   // The URL that has keyboard focus.
   1329   GURL focus_url_;
   1330 
   1331   // The next target URL we want to send to the browser.
   1332   GURL pending_target_url_;
   1333 
   1334   // The text selection the last time DidChangeSelection got called. May contain
   1335   // additional characters before and after the selected text, for IMEs. The
   1336   // portion of this string that is the actual selected text starts at index
   1337   // |selection_range_.GetMin() - selection_text_offset_| and has length
   1338   // |selection_range_.length()|.
   1339   string16 selection_text_;
   1340   // The offset corresponding to the start of |selection_text_| in the document.
   1341   size_t selection_text_offset_;
   1342   // Range over the document corresponding to the actual selected text (which
   1343   // could correspond to a substring of |selection_text_|; see above).
   1344   ui::Range selection_range_;
   1345 
   1346   // External context menu requests we're waiting for. "Internal"
   1347   // (WebKit-originated) context menu events will have an ID of 0 and will not
   1348   // be in this map.
   1349   //
   1350   // We don't want to add internal ones since some of the "special" page
   1351   // handlers in the browser process just ignore the context menu requests so
   1352   // avoid showing context menus, and so this will cause right clicks to leak
   1353   // entries in this map. Most users of the custom context menu (e.g. Pepper
   1354   // plugins) are normally only on "regular" pages and the regular pages will
   1355   // always respond properly to the request, so we don't have to worry so
   1356   // much about leaks.
   1357   IDMap<ContextMenuClient, IDMapExternalPointer> pending_context_menus_;
   1358 
   1359 #if defined(OS_ANDROID)
   1360   // Cache the old top controls state constraints. Used when updating
   1361   // current value only without altering the constraints.
   1362   cc::TopControlsState top_controls_constraints_;
   1363 #endif
   1364 
   1365   // View ----------------------------------------------------------------------
   1366 
   1367   // Cache the preferred size of the page in order to prevent sending the IPC
   1368   // when layout() recomputes but doesn't actually change sizes.
   1369   gfx::Size preferred_size_;
   1370 
   1371   // Used to delay determining the preferred size (to avoid intermediate
   1372   // states for the sizes).
   1373   base::OneShotTimer<RenderViewImpl> check_preferred_size_timer_;
   1374 
   1375   // These store the "is main frame is scrolled all the way to the left
   1376   // or right" state that was last sent to the browser.
   1377   bool cached_is_main_frame_pinned_to_left_;
   1378   bool cached_is_main_frame_pinned_to_right_;
   1379 
   1380   // These store the "has scrollbars" state last sent to the browser.
   1381   bool cached_has_main_frame_horizontal_scrollbar_;
   1382   bool cached_has_main_frame_vertical_scrollbar_;
   1383 
   1384   // Helper objects ------------------------------------------------------------
   1385 
   1386   scoped_ptr<RenderFrameImpl> main_render_frame_;
   1387 
   1388   RendererWebCookieJarImpl cookie_jar_;
   1389 
   1390   // The next group of objects all implement RenderViewObserver, so are deleted
   1391   // along with the RenderView automatically.  This is why we just store
   1392   // weak references.
   1393 
   1394   // Holds a reference to the service which provides desktop notifications.
   1395   NotificationProvider* notification_provider_;
   1396 
   1397   // The geolocation dispatcher attached to this view, lazily initialized.
   1398   GeolocationDispatcher* geolocation_dispatcher_;
   1399 
   1400   // The speech dispatcher attached to this view, lazily initialized.
   1401   InputTagSpeechDispatcher* input_tag_speech_dispatcher_;
   1402 
   1403   // The speech recognition dispatcher attached to this view, lazily
   1404   // initialized.
   1405   SpeechRecognitionDispatcher* speech_recognition_dispatcher_;
   1406 
   1407   // Device orientation dispatcher attached to this view; lazily initialized.
   1408   DeviceOrientationDispatcher* device_orientation_dispatcher_;
   1409 
   1410   // MediaStream dispatcher attached to this view; lazily initialized.
   1411   MediaStreamDispatcher* media_stream_dispatcher_;
   1412 
   1413   // BrowserPluginManager attached to this view; lazily initialized.
   1414   scoped_refptr<BrowserPluginManager> browser_plugin_manager_;
   1415 
   1416   // MediaStreamClient attached to this view; lazily initialized.
   1417   MediaStreamClient* media_stream_client_;
   1418   WebKit::WebUserMediaClient* web_user_media_client_;
   1419 
   1420   // MIDIClient attached to this view; lazily initialized.
   1421   MIDIDispatcher* midi_dispatcher_;
   1422 
   1423   DevToolsAgent* devtools_agent_;
   1424 
   1425   // The current accessibility mode.
   1426   AccessibilityMode accessibility_mode_;
   1427 
   1428   // Only valid if |accessibility_mode_| is anything other than
   1429   // AccessibilityModeOff.
   1430   RendererAccessibility* renderer_accessibility_;
   1431 
   1432   // Java Bridge dispatcher attached to this view; lazily initialized.
   1433   JavaBridgeDispatcher* java_bridge_dispatcher_;
   1434 
   1435   // Mouse Lock dispatcher attached to this view.
   1436   MouseLockDispatcher* mouse_lock_dispatcher_;
   1437 
   1438 #if defined(OS_ANDROID)
   1439   // Android Specific ---------------------------------------------------------
   1440 
   1441   // The background color of the document body element. This is used as the
   1442   // default background color for filling the screen areas for which we don't
   1443   // have the actual content.
   1444   SkColor body_background_color_;
   1445 
   1446   // Expected id of the next content intent launched. Used to prevent scheduled
   1447   // intents to be launched if aborted.
   1448   size_t expected_content_intent_id_;
   1449 
   1450   // List of click-based content detectors.
   1451   typedef std::vector< linked_ptr<ContentDetector> > ContentDetectorList;
   1452   ContentDetectorList content_detectors_;
   1453 
   1454   // Proxy class for WebMediaPlayer to communicate with the real media player
   1455   // objects in browser process.
   1456   WebMediaPlayerProxyAndroid* media_player_proxy_;
   1457 
   1458   // The media player manager for managing all the media players on this view.
   1459   scoped_ptr<RendererMediaPlayerManager> media_player_manager_;
   1460 
   1461   // A date/time picker object for date and time related input elements.
   1462   scoped_ptr<RendererDateTimePicker> date_time_picker_client_;
   1463 #endif
   1464 
   1465   // Plugins -------------------------------------------------------------------
   1466 
   1467   // All the currently active plugin delegates for this RenderView; kept so
   1468   // that we can enumerate them to send updates about things like window
   1469   // location or tab focus and visibily. These are non-owning references.
   1470   std::set<WebPluginDelegateProxy*> plugin_delegates_;
   1471 
   1472 #if defined(OS_WIN)
   1473   // The ID of the focused NPAPI plug-in.
   1474   int focused_plugin_id_;
   1475 #endif
   1476 
   1477 #if defined(ENABLE_PLUGINS)
   1478   typedef std::set<PepperPluginInstanceImpl*> PepperPluginSet;
   1479   PepperPluginSet active_pepper_instances_;
   1480 
   1481   // Whether or not the focus is on a PPAPI plugin
   1482   PepperPluginInstanceImpl* focused_pepper_plugin_;
   1483 
   1484   // Current text input composition text. Empty if no composition is in
   1485   // progress.
   1486   string16 pepper_composition_text_;
   1487 
   1488   // The plugin instance that received the last mouse event. It is set to NULL
   1489   // if the last mouse event went to elements other than Pepper plugins.
   1490   // |pepper_last_mouse_event_target_| is not owned by this class. We can know
   1491   // about when it is destroyed via InstanceDeleted().
   1492   PepperPluginInstanceImpl* pepper_last_mouse_event_target_;
   1493 #endif
   1494 
   1495   // Misc ----------------------------------------------------------------------
   1496 
   1497   // The current and pending file chooser completion objects. If the queue is
   1498   // nonempty, the first item represents the currently running file chooser
   1499   // callback, and the remaining elements are the other file chooser completion
   1500   // still waiting to be run (in order).
   1501   struct PendingFileChooser;
   1502   std::deque< linked_ptr<PendingFileChooser> > file_chooser_completions_;
   1503 
   1504   // The current directory enumeration callback
   1505   std::map<int, WebKit::WebFileChooserCompletion*> enumeration_completions_;
   1506   int enumeration_completion_id_;
   1507 
   1508   // Reports load progress to the browser.
   1509   scoped_ptr<LoadProgressTracker> load_progress_tracker_;
   1510 
   1511   // The SessionStorage namespace that we're assigned to has an ID, and that ID
   1512   // is passed to us upon creation.  WebKit asks for this ID upon first use and
   1513   // uses it whenever asking the browser process to allocate new storage areas.
   1514   int64 session_storage_namespace_id_;
   1515 
   1516   // The total number of unrequested popups that exist and can be followed back
   1517   // to a common opener. This count is shared among all RenderViews created with
   1518   // createView(). All popups are treated as unrequested until specifically
   1519   // instructed otherwise by the Browser process.
   1520   scoped_refptr<SharedRenderViewCounter> shared_popup_counter_;
   1521 
   1522   // Whether this is a top level window (instead of a popup). Top level windows
   1523   // shouldn't count against their own |shared_popup_counter_|.
   1524   bool decrement_shared_popup_at_destruction_;
   1525 
   1526   // Stores edit commands associated to the next key event.
   1527   // Shall be cleared as soon as the next key event is processed.
   1528   EditCommands edit_commands_;
   1529 
   1530   // The external popup for the currently showing select popup.
   1531   scoped_ptr<ExternalPopupMenu> external_popup_menu_;
   1532 
   1533   // The node that the context menu was pressed over.
   1534   WebKit::WebNode context_menu_node_;
   1535 
   1536   // All the registered observers.  We expect this list to be small, so vector
   1537   // is fine.
   1538   ObserverList<RenderViewObserver> observers_;
   1539 
   1540   // Used to inform didChangeSelection() when it is called in the context
   1541   // of handling a InputMsg_SelectRange IPC.
   1542   bool handling_select_range_;
   1543 
   1544   // Wraps the |webwidget_| as a MouseLockDispatcher::LockTarget interface.
   1545   scoped_ptr<MouseLockDispatcher::LockTarget> webwidget_mouse_lock_target_;
   1546 
   1547   // State associated with the GetWindowSnapshot function.
   1548   int next_snapshot_id_;
   1549   typedef std::map<int, WindowSnapshotCallback> PendingSnapshotMap;
   1550   PendingSnapshotMap pending_snapshots_;
   1551 
   1552   // Allows to selectively disable partial buffer swap for this renderer's
   1553   // compositor.
   1554   bool allow_partial_swap_;
   1555 
   1556   // Allows JS to access DOM automation. The JS object is only exposed when the
   1557   // DOM automation bindings are enabled.
   1558   scoped_ptr<DomAutomationController> dom_automation_controller_;
   1559 
   1560   // Allows JS to read out a variety of internal various metrics. The JS object
   1561   // is only exposed when the stats collection bindings are enabled.
   1562   scoped_ptr<StatsCollectionController> stats_collection_controller_;
   1563 
   1564   // This field stores drag/drop related info for the event that is currently
   1565   // being handled. If the current event results in starting a drag/drop
   1566   // session, this info is sent to the browser along with other drag/drop info.
   1567   DragEventSourceInfo possible_drag_event_info_;
   1568 
   1569   // NOTE: stats_collection_observer_ should be the last members because their
   1570   // constructors call the AddObservers method of RenderViewImpl.
   1571   scoped_ptr<StatsCollectionObserver> stats_collection_observer_;
   1572 
   1573   ui::MenuSourceType context_menu_source_type_;
   1574   gfx::Point touch_editing_context_menu_location_;
   1575 
   1576   // ---------------------------------------------------------------------------
   1577   // ADDING NEW DATA? Please see if it fits appropriately in one of the above
   1578   // sections rather than throwing it randomly at the end. If you're adding a
   1579   // bunch of stuff, you should probably create a helper class and put your
   1580   // data and methods on that to avoid bloating RenderView more.  You can
   1581   // use the Observer interface to filter IPC messages and receive frame change
   1582   // notifications.
   1583   // ---------------------------------------------------------------------------
   1584 
   1585   DISALLOW_COPY_AND_ASSIGN(RenderViewImpl);
   1586 };
   1587 
   1588 }  // namespace content
   1589 
   1590 #endif  // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_
   1591