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

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

Issue 7388: Remove throttling code from the Browser process and... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 2 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
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 class WebError; 44 class WebError;
45 class WebFrame; 45 class WebFrame;
46 class WebPluginDelegate; 46 class WebPluginDelegate;
47 class WebPluginDelegateProxy; 47 class WebPluginDelegateProxy;
48 enum WebRequestCachePolicy; 48 enum WebRequestCachePolicy;
49 49
50 namespace webkit_glue { 50 namespace webkit_glue {
51 struct FileUploadData; 51 struct FileUploadData;
52 } 52 }
53 53
54 // We need to prevent a page from trying to create infinite popups. It is not
55 // as simple as keeping a count of the number of immediate children
56 // popups. Having an html file that window.open()s itself would create
57 // an unlimited chain of RenderViews who only have one RenderView child.
58 //
59 // Therefore, each new top level RenderView creates a new counter and shares it
60 // with all its children and grandchildren popup RenderViews created with
61 // CreateWebView() to have a sort of global limit for the page so no more than
62 // kMaximumNumberOfPopups popups are created.
63 //
64 // This is a RefCounted holder of an int because I can't say
65 // scoped_refptr<int>.
66 typedef base::RefCountedData<int> SharedRenderViewCounter;
67
54 // 68 //
55 // RenderView is an object that manages a WebView object, and provides a 69 // RenderView is an object that manages a WebView object, and provides a
56 // communication interface with an embedding application process 70 // communication interface with an embedding application process
57 // 71 //
58 class RenderView : public RenderWidget, public WebViewDelegate, 72 class RenderView : public RenderWidget, public WebViewDelegate,
59 public webkit_glue::DomSerializerDelegate { 73 public webkit_glue::DomSerializerDelegate {
60 public: 74 public:
61 // Creates a new RenderView. The parent_hwnd specifies a HWND to use as the 75 // Creates a new RenderView. The parent_hwnd specifies a HWND to use as the
62 // parent of the WebView HWND that will be created. The modal_dialog_event 76 // parent of the WebView HWND that will be created. The modal_dialog_event
63 // is set by the RenderView whenever a modal dialog alert is shown, so that 77 // is set by the RenderView whenever a modal dialog alert is shown, so that
64 // the renderer and plugin processes know to pump window messages. If this 78 // the renderer and plugin processes know to pump window messages. If this
65 // is a constrained popup or as a new tab, opener_id is the routing ID of the 79 // is a constrained popup or as a new tab, opener_id is the routing ID of the
66 // RenderView responsible for creating this RenderView (corresponding to the 80 // RenderView responsible for creating this RenderView (corresponding to the
67 // parent_hwnd). 81 // parent_hwnd). |counter| is either a currently initialized counter, or NULL
68 static RenderView* Create(HWND parent_hwnd, 82 // (in which case we treat this RenderView as a top level window).
69 HANDLE modal_dialog_event, 83 static RenderView* Create(
70 int32 opener_id, 84 HWND parent_hwnd,
71 const WebPreferences& webkit_prefs, 85 HANDLE modal_dialog_event,
72 int32 routing_id); 86 int32 opener_id,
87 const WebPreferences& webkit_prefs,
88 SharedRenderViewCounter* counter,
89 int32 routing_id);
73 90
74 // Sets the "next page id" counter. 91 // Sets the "next page id" counter.
75 static void SetNextPageID(int32 next_page_id); 92 static void SetNextPageID(int32 next_page_id);
76 93
77 // The resource dispatcher used to fetch resources for this view. 94 // The resource dispatcher used to fetch resources for this view.
78 ResourceDispatcher* resource_dispatcher() { 95 ResourceDispatcher* resource_dispatcher() {
79 return resource_dispatcher_; 96 return resource_dispatcher_;
80 } 97 }
81 98
82 // May return NULL when the view is closing. 99 // May return NULL when the view is closing.
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 // constructor stores that view ID. 303 // constructor stores that view ID.
287 explicit RenderView(int32 opener_id); 304 explicit RenderView(int32 opener_id);
288 305
289 // Initializes this view with the given parent and ID. The |routing_id| can be 306 // Initializes this view with the given parent and ID. The |routing_id| can be
290 // set to 'MSG_ROUTING_NONE' if the true ID is not yet known. In this case, 307 // set to 'MSG_ROUTING_NONE' if the true ID is not yet known. In this case,
291 // CompleteInit must be called later with the true ID. 308 // CompleteInit must be called later with the true ID.
292 void Init(HWND parent, 309 void Init(HWND parent,
293 HANDLE modal_dialog_event, 310 HANDLE modal_dialog_event,
294 int32 opener_id, 311 int32 opener_id,
295 const WebPreferences& webkit_prefs, 312 const WebPreferences& webkit_prefs,
313 SharedRenderViewCounter* counter,
296 int32 routing_id); 314 int32 routing_id);
297 315
298 void UpdateURL(WebFrame* frame); 316 void UpdateURL(WebFrame* frame);
299 void UpdateTitle(WebFrame* frame, const std::wstring& title); 317 void UpdateTitle(WebFrame* frame, const std::wstring& title);
300 void UpdateSessionHistory(WebFrame* frame); 318 void UpdateSessionHistory(WebFrame* frame);
301 319
302 // Update current main frame's encoding and send it to browser window. 320 // Update current main frame's encoding and send it to browser window.
303 // Since we want to let users see the right encoding info from menu 321 // Since we want to let users see the right encoding info from menu
304 // before finishing loading, we call the UpdateEncoding in 322 // before finishing loading, we call the UpdateEncoding in
305 // a) function:DidCommitLoadForFrame. When this function is called, 323 // a) function:DidCommitLoadForFrame. When this function is called,
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 void OnThemeChanged(); 454 void OnThemeChanged();
437 455
438 #ifdef CHROME_PERSONALIZATION 456 #ifdef CHROME_PERSONALIZATION
439 void OnPersonalizationEvent(std::string event_name, std::string event_args); 457 void OnPersonalizationEvent(std::string event_name, std::string event_args);
440 #endif 458 #endif
441 459
442 // Handles messages posted from automation. 460 // Handles messages posted from automation.
443 void OnMessageFromExternalHost(const std::string& target, 461 void OnMessageFromExternalHost(const std::string& target,
444 const std::string& message); 462 const std::string& message);
445 463
464 // Message that we should no longer be part of the current popup window
465 // grouping, and should form our own grouping.
466 void OnDisassociateFromPopupCount();
467
446 // Switches the frame's CSS media type to "print" and calculate the number of 468 // Switches the frame's CSS media type to "print" and calculate the number of
447 // printed pages that are to be expected. |frame| will be used to calculate 469 // printed pages that are to be expected. |frame| will be used to calculate
448 // the number of expected pages for this frame only. 470 // the number of expected pages for this frame only.
449 int SwitchFrameToPrintMediaType(const ViewMsg_Print_Params& params, 471 int SwitchFrameToPrintMediaType(const ViewMsg_Print_Params& params,
450 WebFrame* frame); 472 WebFrame* frame);
451 473
452 // Switches the frame's CSS media type to "display". 474 // Switches the frame's CSS media type to "display".
453 void SwitchFrameToDisplayMediaType(WebFrame* frame); 475 void SwitchFrameToDisplayMediaType(WebFrame* frame);
454 476
455 // Prints the page listed in |params|. 477 // Prints the page listed in |params|.
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 632
611 int history_back_list_count_; 633 int history_back_list_count_;
612 int history_forward_list_count_; 634 int history_forward_list_count_;
613 635
614 // True if pop-up blocking is disabled. False by default. 636 // True if pop-up blocking is disabled. False by default.
615 bool disable_popup_blocking_; 637 bool disable_popup_blocking_;
616 638
617 // True if the page has any frame-level unload or beforeunload listeners. 639 // True if the page has any frame-level unload or beforeunload listeners.
618 bool has_unload_listener_; 640 bool has_unload_listener_;
619 641
642 // The total number of unrequested popups that exist and can be followed back
643 // to a common opener. This count is shared among all RenderViews created
644 // with CreateWebView(). All popups are treated as unrequested until
645 // specifically instructed otherwise by the Browser process.
646 scoped_refptr<SharedRenderViewCounter> shared_popup_counter_;
647
648 // Whether this is a top level window (instead of a popup). Top level windows
649 // shouldn't count against their own |shared_popup_counter_|.
650 bool decrement_shared_popup_at_destruction_;
651
620 // Handles accessibility requests into the renderer side, as well as 652 // Handles accessibility requests into the renderer side, as well as
621 // maintains the cache and other features of the accessibility tree. 653 // maintains the cache and other features of the accessibility tree.
622 scoped_ptr<GlueAccessibility> glue_accessibility_; 654 scoped_ptr<GlueAccessibility> glue_accessibility_;
623 655
624 DISALLOW_COPY_AND_ASSIGN(RenderView); 656 DISALLOW_COPY_AND_ASSIGN(RenderView);
625 }; 657 };
626 658
627 #endif // CHROME_RENDERER_RENDER_VIEW_H_ 659 #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