Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: chrome/renderer/render_view.h

Issue 16482: Refactor the render widget unittest so it can be reused to create a render vi... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/render_thread.cc ('k') | chrome/renderer/render_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_RENDERER_RENDER_VIEW_H_ 5 #ifndef CHROME_RENDERER_RENDER_VIEW_H_
6 #define CHROME_RENDERER_RENDER_VIEW_H_ 6 #define CHROME_RENDERER_RENDER_VIEW_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/scoped_handle.h" 12 #include "base/scoped_handle.h"
13 #include "base/gfx/point.h" 13 #include "base/gfx/point.h"
14 #include "base/gfx/rect.h" 14 #include "base/gfx/rect.h"
15 #include "base/timer.h" 15 #include "base/timer.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "chrome/common/page_zoom.h" 17 #include "chrome/common/page_zoom.h"
18 #include "chrome/common/resource_dispatcher.h" 18 #include "chrome/common/resource_dispatcher.h"
19 #ifdef CHROME_PERSONALIZATION 19 #ifdef CHROME_PERSONALIZATION
20 #include "chrome/personalization/personalization.h" 20 #include "chrome/personalization/personalization.h"
21 #endif 21 #endif
22 #include "chrome/renderer/automation/dom_automation_controller.h" 22 #include "chrome/renderer/automation/dom_automation_controller.h"
23 #include "chrome/renderer/dom_ui_bindings.h" 23 #include "chrome/renderer/dom_ui_bindings.h"
24 #include "chrome/renderer/external_host_bindings.h" 24 #include "chrome/renderer/external_host_bindings.h"
25 #include "chrome/renderer/external_js_object.h" 25 #include "chrome/renderer/external_js_object.h"
26 #include "chrome/renderer/render_process.h" 26 #include "chrome/renderer/render_process.h"
27 #include "chrome/renderer/render_widget.h" 27 #include "chrome/renderer/render_widget.h"
28 #include "testing/gtest/include/gtest/gtest_prod.h"
28 #include "webkit/glue/console_message_level.h" 29 #include "webkit/glue/console_message_level.h"
29 #include "webkit/glue/dom_serializer_delegate.h" 30 #include "webkit/glue/dom_serializer_delegate.h"
30 #include "webkit/glue/glue_accessibility.h" 31 #include "webkit/glue/glue_accessibility.h"
31 #include "webkit/glue/webview_delegate.h" 32 #include "webkit/glue/webview_delegate.h"
32 #include "webkit/glue/webview.h" 33 #include "webkit/glue/webview.h"
33 34
34 // RenderView is a diamond-shaped hierarchy, with WebWidgetDelegate at the root. 35 // RenderView is a diamond-shaped hierarchy, with WebWidgetDelegate at the root.
35 // VS warns when we inherit the WebWidgetDelegate method implementations from 36 // VS warns when we inherit the WebWidgetDelegate method implementations from
36 // RenderWidget. It's safe to ignore that warning. 37 // RenderWidget. It's safe to ignore that warning.
37 #pragma warning(disable: 4250) 38 #pragma warning(disable: 4250)
38 39
39 class DebugMessageHandler; 40 class DebugMessageHandler;
40 class GURL; 41 class GURL;
42 class RenderThread;
41 class SkBitmap; 43 class SkBitmap;
42 struct ThumbnailScore; 44 struct ThumbnailScore;
43 class WebError; 45 class WebError;
44 class WebFrame; 46 class WebFrame;
45 class WebPluginDelegate; 47 class WebPluginDelegate;
46 class WebPluginDelegateProxy; 48 class WebPluginDelegateProxy;
47 enum WebRequestCachePolicy; 49 enum WebRequestCachePolicy;
48 50
49 namespace webkit_glue { 51 namespace webkit_glue {
50 struct FileUploadData; 52 struct FileUploadData;
(...skipping 10 matching lines...) Expand all
61 // kMaximumNumberOfPopups popups are created. 63 // kMaximumNumberOfPopups popups are created.
62 // 64 //
63 // This is a RefCounted holder of an int because I can't say 65 // This is a RefCounted holder of an int because I can't say
64 // scoped_refptr<int>. 66 // scoped_refptr<int>.
65 typedef base::RefCountedData<int> SharedRenderViewCounter; 67 typedef base::RefCountedData<int> SharedRenderViewCounter;
66 68
67 // 69 //
68 // RenderView is an object that manages a WebView object, and provides a 70 // RenderView is an object that manages a WebView object, and provides a
69 // communication interface with an embedding application process 71 // communication interface with an embedding application process
70 // 72 //
71 class RenderView : public RenderWidget, public WebViewDelegate, 73 class RenderView : public RenderWidget,
74 public WebViewDelegate,
72 public webkit_glue::DomSerializerDelegate { 75 public webkit_glue::DomSerializerDelegate {
73 public: 76 public:
74 // Creates a new RenderView. The parent_hwnd specifies a HWND to use as the 77 // Creates a new RenderView. The parent_hwnd specifies a HWND to use as the
75 // parent of the WebView HWND that will be created. The modal_dialog_event 78 // parent of the WebView HWND that will be created. The modal_dialog_event
76 // is set by the RenderView whenever a modal dialog alert is shown, so that 79 // is set by the RenderView whenever a modal dialog alert is shown, so that
77 // the renderer and plugin processes know to pump window messages. If this 80 // the renderer and plugin processes know to pump window messages. If this
78 // is a constrained popup or as a new tab, opener_id is the routing ID of the 81 // is a constrained popup or as a new tab, opener_id is the routing ID of the
79 // RenderView responsible for creating this RenderView (corresponding to the 82 // RenderView responsible for creating this RenderView (corresponding to the
80 // parent_hwnd). |counter| is either a currently initialized counter, or NULL 83 // parent_hwnd). |counter| is either a currently initialized counter, or NULL
81 // (in which case we treat this RenderView as a top level window). 84 // (in which case we treat this RenderView as a top level window).
82 static RenderView* Create( 85 static RenderView* Create(
86 RenderThreadBase* render_thread,
83 HWND parent_hwnd, 87 HWND parent_hwnd,
84 HANDLE modal_dialog_event, 88 HANDLE modal_dialog_event,
85 int32 opener_id, 89 int32 opener_id,
86 const WebPreferences& webkit_prefs, 90 const WebPreferences& webkit_prefs,
87 SharedRenderViewCounter* counter, 91 SharedRenderViewCounter* counter,
88 int32 routing_id); 92 int32 routing_id);
89 93
90 // Sets the "next page id" counter. 94 // Sets the "next page id" counter.
91 static void SetNextPageID(int32 next_page_id); 95 static void SetNextPageID(int32 next_page_id);
92 96
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 void SyncNavigationState(); 302 void SyncNavigationState();
299 303
300 // Evaluates a string of JavaScript in a particular frame. 304 // Evaluates a string of JavaScript in a particular frame.
301 void EvaluateScript(const std::wstring& frame_xpath, 305 void EvaluateScript(const std::wstring& frame_xpath,
302 const std::wstring& jscript); 306 const std::wstring& jscript);
303 307
304 // Called when the Javascript debugger is no longer attached. 308 // Called when the Javascript debugger is no longer attached.
305 // This is called from within the renderer, not via an IPC message. 309 // This is called from within the renderer, not via an IPC message.
306 void OnDebugDetach(); 310 void OnDebugDetach();
307 311
312 int delay_seconds_for_form_state_sync() const {
313 return delay_seconds_for_form_state_sync_;
314 }
315 void set_delay_seconds_for_form_state_sync(int delay_in_seconds) {
316 delay_seconds_for_form_state_sync_ = delay_in_seconds;
317 }
318
308 private: 319 private:
309 RenderView(); 320 FRIEND_TEST(RenderViewTest, OnLoadAlternateHTMLText);
321 FRIEND_TEST(RenderViewTest, OnNavStateChanged);
310 322
311 // When we are created from window.open from an already existing view, this 323 explicit RenderView(RenderThreadBase* render_thread);
312 // constructor stores that view ID.
313 explicit RenderView(int32 opener_id);
314 324
315 // Initializes this view with the given parent and ID. The |routing_id| can be 325 // Initializes this view with the given parent and ID. The |routing_id| can be
316 // set to 'MSG_ROUTING_NONE' if the true ID is not yet known. In this case, 326 // set to 'MSG_ROUTING_NONE' if the true ID is not yet known. In this case,
317 // CompleteInit must be called later with the true ID. 327 // CompleteInit must be called later with the true ID.
318 void Init(HWND parent, 328 void Init(HWND parent,
319 HANDLE modal_dialog_event, 329 HANDLE modal_dialog_event,
320 int32 opener_id, 330 int32 opener_id,
321 const WebPreferences& webkit_prefs, 331 const WebPreferences& webkit_prefs,
322 SharedRenderViewCounter* counter, 332 SharedRenderViewCounter* counter,
323 int32 routing_id); 333 int32 routing_id);
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 714
705 // We need to prevent windows from closing themselves with a window.close() 715 // We need to prevent windows from closing themselves with a window.close()
706 // call while a blocked popup notification is being displayed. We cannot 716 // call while a blocked popup notification is being displayed. We cannot
707 // synchronously querry the Browser process. We cannot wait for the Browser 717 // synchronously querry the Browser process. We cannot wait for the Browser
708 // process to send a message to us saying that a blocked popup notification 718 // process to send a message to us saying that a blocked popup notification
709 // is being displayed. We instead assume that when we create a window off 719 // is being displayed. We instead assume that when we create a window off
710 // this RenderView, that it is going to be blocked until we get a message 720 // this RenderView, that it is going to be blocked until we get a message
711 // from the Browser process telling us otherwise. 721 // from the Browser process telling us otherwise.
712 bool popup_notification_visible_; 722 bool popup_notification_visible_;
713 723
724 // Time in seconds of the delay between syncing page state such as form
725 // elements and scroll position. This timeout allows us to avoid spamming the
726 // browser process with every little thing that changes. This normally doesn't
727 // change but is overridden by tests.
728 int delay_seconds_for_form_state_sync_;
729
714 DISALLOW_COPY_AND_ASSIGN(RenderView); 730 DISALLOW_COPY_AND_ASSIGN(RenderView);
715 }; 731 };
716 732
717 #endif // CHROME_RENDERER_RENDER_VIEW_H_ 733 #endif // CHROME_RENDERER_RENDER_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/renderer/render_thread.cc ('k') | chrome/renderer/render_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698