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

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

Issue 265044: Eliminate WebView::GetDelegate and replace RenderViewSet with a linked list o... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 <map>
8 #include <set> 9 #include <set>
9 #include <string> 10 #include <string>
10 #include <queue> 11 #include <queue>
11 #include <vector> 12 #include <vector>
12 13
13 #include "base/basictypes.h" 14 #include "base/basictypes.h"
14 #include "base/file_path.h" 15 #include "base/file_path.h"
15 #include "base/gfx/point.h" 16 #include "base/gfx/point.h"
16 #include "base/gfx/rect.h" 17 #include "base/gfx/rect.h"
17 #include "base/id_map.h" 18 #include "base/id_map.h"
18 #include "base/shared_memory.h" 19 #include "base/shared_memory.h"
19 #include "base/timer.h" 20 #include "base/timer.h"
20 #include "base/values.h" 21 #include "base/values.h"
21 #include "base/weak_ptr.h" 22 #include "base/weak_ptr.h"
22 #include "build/build_config.h" 23 #include "build/build_config.h"
23 #include "chrome/common/edit_command.h" 24 #include "chrome/common/edit_command.h"
24 #include "chrome/common/navigation_gesture.h" 25 #include "chrome/common/navigation_gesture.h"
25 #include "chrome/common/notification_type.h" 26 #include "chrome/common/notification_type.h"
26 #include "chrome/common/renderer_preferences.h" 27 #include "chrome/common/renderer_preferences.h"
27 #include "chrome/common/view_types.h" 28 #include "chrome/common/view_types.h"
28 #include "chrome/renderer/automation/dom_automation_controller.h" 29 #include "chrome/renderer/automation/dom_automation_controller.h"
29 #include "chrome/renderer/dom_ui_bindings.h" 30 #include "chrome/renderer/dom_ui_bindings.h"
30 #include "chrome/renderer/extensions/extension_process_bindings.h" 31 #include "chrome/renderer/extensions/extension_process_bindings.h"
31 #include "chrome/renderer/external_host_bindings.h" 32 #include "chrome/renderer/external_host_bindings.h"
32 #include "chrome/renderer/notification_provider.h" 33 #include "chrome/renderer/notification_provider.h"
33 #include "chrome/renderer/render_widget.h" 34 #include "chrome/renderer/render_widget.h"
35 #include "chrome/renderer/render_view_visitor.h"
34 #include "third_party/skia/include/core/SkBitmap.h" 36 #include "third_party/skia/include/core/SkBitmap.h"
35 #include "testing/gtest/include/gtest/gtest_prod.h" 37 #include "testing/gtest/include/gtest/gtest_prod.h"
36 #include "webkit/api/public/WebConsoleMessage.h" 38 #include "webkit/api/public/WebConsoleMessage.h"
37 #include "webkit/api/public/WebFrameClient.h" 39 #include "webkit/api/public/WebFrameClient.h"
38 #include "webkit/api/public/WebTextDirection.h" 40 #include "webkit/api/public/WebTextDirection.h"
39 #include "webkit/glue/dom_serializer_delegate.h" 41 #include "webkit/glue/dom_serializer_delegate.h"
40 #include "webkit/glue/form_data.h" 42 #include "webkit/glue/form_data.h"
41 #include "webkit/glue/image_resource_fetcher.h" 43 #include "webkit/glue/image_resource_fetcher.h"
42 #include "webkit/glue/password_form_dom_manager.h" 44 #include "webkit/glue/password_form_dom_manager.h"
43 #include "webkit/glue/webaccessibilitymanager.h" 45 #include "webkit/glue/webaccessibilitymanager.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // RenderView is an object that manages a WebView object, and provides a 106 // RenderView is an object that manages a WebView object, and provides a
105 // communication interface with an embedding application process 107 // communication interface with an embedding application process
106 // 108 //
107 class RenderView : public RenderWidget, 109 class RenderView : public RenderWidget,
108 public WebViewDelegate, 110 public WebViewDelegate,
109 public WebKit::WebFrameClient, 111 public WebKit::WebFrameClient,
110 public webkit_glue::WebPluginPageDelegate, 112 public webkit_glue::WebPluginPageDelegate,
111 public webkit_glue::DomSerializerDelegate, 113 public webkit_glue::DomSerializerDelegate,
112 public base::SupportsWeakPtr<RenderView> { 114 public base::SupportsWeakPtr<RenderView> {
113 public: 115 public:
114 struct RenderViewSet { 116 // Visit all RenderViews with a live WebView (i.e., RenderViews that have
115 std::set<RenderView*> render_view_set_; 117 // been closed but not yet destroyed are excluded).
116 }; 118 static void ForEach(RenderViewVisitor* visitor);
119
120 // Returns the RenderView containing the given WebView.
121 static RenderView* FromWebView(WebView* webview);
117 122
118 // Creates a new RenderView. The parent_hwnd specifies a HWND to use as the 123 // Creates a new RenderView. The parent_hwnd specifies a HWND to use as the
119 // parent of the WebView HWND that will be created. If this is a constrained 124 // parent of the WebView HWND that will be created. If this is a constrained
120 // popup or as a new tab, opener_id is the routing ID of the RenderView 125 // popup or as a new tab, opener_id is the routing ID of the RenderView
121 // responsible for creating this RenderView (corresponding to parent_hwnd). 126 // responsible for creating this RenderView (corresponding to parent_hwnd).
122 // |counter| is either a currently initialized counter, or NULL (in which case 127 // |counter| is either a currently initialized counter, or NULL (in which case
123 // we treat this RenderView as a top level window). 128 // we treat this RenderView as a top level window).
124 static RenderView* Create( 129 static RenderView* Create(
125 RenderThreadBase* render_thread, 130 RenderThreadBase* render_thread,
126 gfx::NativeViewId parent_hwnd, 131 gfx::NativeViewId parent_hwnd,
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 void OnSetExtensionViewMode(const std::string& mode); 429 void OnSetExtensionViewMode(const std::string& mode);
425 430
426 const WebPreferences& webkit_preferences() const { 431 const WebPreferences& webkit_preferences() const {
427 return webkit_preferences_; 432 return webkit_preferences_;
428 } 433 }
429 434
430 // Sends a message and runs a nested message loop. 435 // Sends a message and runs a nested message loop.
431 bool SendAndRunNestedMessageLoop(IPC::SyncMessage* message); 436 bool SendAndRunNestedMessageLoop(IPC::SyncMessage* message);
432 437
433 protected: 438 protected:
434 // RenderWidget override. 439 // RenderWidget overrides:
440 virtual void Close();
435 virtual void OnResize(const gfx::Size& new_size, 441 virtual void OnResize(const gfx::Size& new_size,
436 const gfx::Rect& resizer_rect); 442 const gfx::Rect& resizer_rect);
437 // RenderWidget override
438 virtual void DidPaint(); 443 virtual void DidPaint();
439 // RenderWidget override.
440 virtual void DidHandleKeyEvent(); 444 virtual void DidHandleKeyEvent();
441 445
442 private: 446 private:
443 // For unit tests. 447 // For unit tests.
444 friend class RenderViewTest; 448 friend class RenderViewTest;
445 FRIEND_TEST(RenderViewTest, OnLoadAlternateHTMLText); 449 FRIEND_TEST(RenderViewTest, OnLoadAlternateHTMLText);
446 FRIEND_TEST(RenderViewTest, OnNavStateChanged); 450 FRIEND_TEST(RenderViewTest, OnNavStateChanged);
447 FRIEND_TEST(RenderViewTest, OnImeStateChanged); 451 FRIEND_TEST(RenderViewTest, OnImeStateChanged);
448 FRIEND_TEST(RenderViewTest, ImeComposition); 452 FRIEND_TEST(RenderViewTest, ImeComposition);
449 FRIEND_TEST(RenderViewTest, OnSetTextDirection); 453 FRIEND_TEST(RenderViewTest, OnSetTextDirection);
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 // browser for. This is used to determine if the most recent transition 807 // browser for. This is used to determine if the most recent transition
804 // generated a history entry (less than page_id_), or not (equal to or 808 // generated a history entry (less than page_id_), or not (equal to or
805 // greater than). Note that this will be greater than page_id_ if the user 809 // greater than). Note that this will be greater than page_id_ if the user
806 // goes back. 810 // goes back.
807 int32 last_page_id_sent_to_browser_; 811 int32 last_page_id_sent_to_browser_;
808 812
809 // Page_id from the last page we indexed. This prevents us from indexing the 813 // Page_id from the last page we indexed. This prevents us from indexing the
810 // same page twice in a row. 814 // same page twice in a row.
811 int32 last_indexed_page_id_; 815 int32 last_indexed_page_id_;
812 816
817 // The next available page ID to use. This ensures that the page IDs are
818 // globally unique in the renderer.
819 static int32 next_page_id_;
820
813 // Used for popups. 821 // Used for popups.
814 bool opened_by_user_gesture_; 822 bool opened_by_user_gesture_;
815 GURL creator_url_; 823 GURL creator_url_;
816 824
817 // The alternate error page URL, if one exists. 825 // The alternate error page URL, if one exists.
818 GURL alternate_error_page_url_; 826 GURL alternate_error_page_url_;
819 827
820 // The pending file upload. 828 // The pending file upload.
821 scoped_ptr<webkit_glue::FileUploadData> pending_upload_data_; 829 scoped_ptr<webkit_glue::FileUploadData> pending_upload_data_;
822 830
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 WebPreferences webkit_preferences_; 983 WebPreferences webkit_preferences_;
976 984
977 // Stores edit commands associated to the next key event. 985 // Stores edit commands associated to the next key event.
978 // Shall be cleared as soon as the next key event is processed. 986 // Shall be cleared as soon as the next key event is processed.
979 EditCommands edit_commands_; 987 EditCommands edit_commands_;
980 988
981 // ImageResourceFetchers schedule via DownloadImage. 989 // ImageResourceFetchers schedule via DownloadImage.
982 typedef std::set<webkit_glue::ImageResourceFetcher*> ImageResourceFetcherSet; 990 typedef std::set<webkit_glue::ImageResourceFetcher*> ImageResourceFetcherSet;
983 ImageResourceFetcherSet image_fetchers_; 991 ImageResourceFetcherSet image_fetchers_;
984 992
993 typedef std::map<WebView*, RenderView*> ViewMap;
985 994
986 DISALLOW_COPY_AND_ASSIGN(RenderView); 995 DISALLOW_COPY_AND_ASSIGN(RenderView);
987 }; 996 };
988 997
989 #endif // CHROME_RENDERER_RENDER_VIEW_H_ 998 #endif // CHROME_RENDERER_RENDER_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698