OLD | NEW |
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 <string> | 8 #include <string> |
9 #include <queue> | 9 #include <queue> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
14 #include "base/gfx/point.h" | 14 #include "base/gfx/point.h" |
15 #include "base/gfx/rect.h" | 15 #include "base/gfx/rect.h" |
16 #include "base/shared_memory.h" | 16 #include "base/shared_memory.h" |
17 #include "base/timer.h" | 17 #include "base/timer.h" |
18 #include "base/values.h" | 18 #include "base/values.h" |
19 #include "build/build_config.h" | 19 #include "build/build_config.h" |
20 #include "chrome/common/id_map.h" | 20 #include "chrome/common/id_map.h" |
21 #include "chrome/common/renderer_preferences.h" | 21 #include "chrome/common/renderer_preferences.h" |
| 22 #include "chrome/common/view_types.h" |
22 #include "chrome/renderer/automation/dom_automation_controller.h" | 23 #include "chrome/renderer/automation/dom_automation_controller.h" |
23 #include "chrome/renderer/dom_ui_bindings.h" | 24 #include "chrome/renderer/dom_ui_bindings.h" |
24 #include "chrome/renderer/extensions/extension_process_bindings.h" | 25 #include "chrome/renderer/extensions/extension_process_bindings.h" |
25 #include "chrome/renderer/external_host_bindings.h" | 26 #include "chrome/renderer/external_host_bindings.h" |
26 #include "chrome/renderer/render_widget.h" | 27 #include "chrome/renderer/render_widget.h" |
27 #include "third_party/skia/include/core/SkBitmap.h" | 28 #include "third_party/skia/include/core/SkBitmap.h" |
28 #include "testing/gtest/include/gtest/gtest_prod.h" | 29 #include "testing/gtest/include/gtest/gtest_prod.h" |
29 #include "webkit/api/public/WebConsoleMessage.h" | 30 #include "webkit/api/public/WebConsoleMessage.h" |
30 #include "webkit/api/public/WebTextDirection.h" | 31 #include "webkit/api/public/WebTextDirection.h" |
31 #include "webkit/glue/dom_serializer_delegate.h" | 32 #include "webkit/glue/dom_serializer_delegate.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 typedef base::RefCountedData<int> SharedRenderViewCounter; | 92 typedef base::RefCountedData<int> SharedRenderViewCounter; |
92 | 93 |
93 // | 94 // |
94 // RenderView is an object that manages a WebView object, and provides a | 95 // RenderView is an object that manages a WebView object, and provides a |
95 // communication interface with an embedding application process | 96 // communication interface with an embedding application process |
96 // | 97 // |
97 class RenderView : public RenderWidget, | 98 class RenderView : public RenderWidget, |
98 public WebViewDelegate, | 99 public WebViewDelegate, |
99 public webkit_glue::DomSerializerDelegate { | 100 public webkit_glue::DomSerializerDelegate { |
100 public: | 101 public: |
| 102 struct RenderViewSet { |
| 103 std::set<RenderView* > render_view_set_; |
| 104 }; |
101 // Creates a new RenderView. The parent_hwnd specifies a HWND to use as the | 105 // Creates a new RenderView. The parent_hwnd specifies a HWND to use as the |
102 // parent of the WebView HWND that will be created. The modal_dialog_event | 106 // parent of the WebView HWND that will be created. The modal_dialog_event |
103 // is set by the RenderView whenever a modal dialog alert is shown, so that | 107 // is set by the RenderView whenever a modal dialog alert is shown, so that |
104 // the renderer and plugin processes know to pump window messages. If this | 108 // the renderer and plugin processes know to pump window messages. If this |
105 // is a constrained popup or as a new tab, opener_id is the routing ID of the | 109 // is a constrained popup or as a new tab, opener_id is the routing ID of the |
106 // RenderView responsible for creating this RenderView (corresponding to the | 110 // RenderView responsible for creating this RenderView (corresponding to the |
107 // parent_hwnd). |counter| is either a currently initialized counter, or NULL | 111 // parent_hwnd). |counter| is either a currently initialized counter, or NULL |
108 // (in which case we treat this RenderView as a top level window). | 112 // (in which case we treat this RenderView as a top level window). |
109 static RenderView* Create( | 113 static RenderView* Create( |
110 RenderThreadBase* render_thread, | 114 RenderThreadBase* render_thread, |
(...skipping 14 matching lines...) Expand all Loading... |
125 } | 129 } |
126 | 130 |
127 gfx::NativeViewId host_window() const { | 131 gfx::NativeViewId host_window() const { |
128 return host_window_; | 132 return host_window_; |
129 } | 133 } |
130 | 134 |
131 base::WaitableEvent* modal_dialog_event() { | 135 base::WaitableEvent* modal_dialog_event() { |
132 return modal_dialog_event_.get(); | 136 return modal_dialog_event_.get(); |
133 } | 137 } |
134 | 138 |
| 139 int browser_window_id() { |
| 140 return browser_window_id_; |
| 141 } |
| 142 |
| 143 ViewType::Type view_type() { |
| 144 return view_type_; |
| 145 } |
| 146 |
135 // IPC::Channel::Listener | 147 // IPC::Channel::Listener |
136 virtual void OnMessageReceived(const IPC::Message& msg); | 148 virtual void OnMessageReceived(const IPC::Message& msg); |
137 | 149 |
138 // WebViewDelegate | 150 // WebViewDelegate |
139 virtual bool CanAcceptLoadDrops() const; | 151 virtual bool CanAcceptLoadDrops() const; |
140 virtual void ShowModalHTMLDialog(const GURL& url, int width, int height, | 152 virtual void ShowModalHTMLDialog(const GURL& url, int width, int height, |
141 const std::string& json_arguments, | 153 const std::string& json_arguments, |
142 std::string* json_retval); | 154 std::string* json_retval); |
143 virtual void RunJavaScriptAlert(WebKit::WebFrame* webframe, | 155 virtual void RunJavaScriptAlert(WebKit::WebFrame* webframe, |
144 const std::wstring& message); | 156 const std::wstring& message); |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 bool ended, bool cancelled); | 548 bool ended, bool cancelled); |
537 void OnDragSourceSystemDragEnded(); | 549 void OnDragSourceSystemDragEnded(); |
538 void OnInstallMissingPlugin(); | 550 void OnInstallMissingPlugin(); |
539 void OnFileChooserResponse(const std::vector<FilePath>& file_names); | 551 void OnFileChooserResponse(const std::vector<FilePath>& file_names); |
540 void OnEnableViewSourceMode(); | 552 void OnEnableViewSourceMode(); |
541 void OnEnableIntrinsicWidthChangedMode(); | 553 void OnEnableIntrinsicWidthChangedMode(); |
542 void OnSetRendererPrefs(const RendererPreferences& renderer_prefs); | 554 void OnSetRendererPrefs(const RendererPreferences& renderer_prefs); |
543 void OnMediaPlayerActionAt(int x, | 555 void OnMediaPlayerActionAt(int x, |
544 int y, | 556 int y, |
545 const MediaPlayerAction& action); | 557 const MediaPlayerAction& action); |
| 558 void OnNotifyRendererViewType(ViewType::Type view_type); |
| 559 void OnUpdateBrowserWindowId(int window_id); |
546 void OnUpdateBackForwardListCount(int back_list_count, | 560 void OnUpdateBackForwardListCount(int back_list_count, |
547 int forward_list_count); | 561 int forward_list_count); |
548 void OnGetAccessibilityInfo( | 562 void OnGetAccessibilityInfo( |
549 const webkit_glue::WebAccessibility::InParams& in_params, | 563 const webkit_glue::WebAccessibility::InParams& in_params, |
550 webkit_glue::WebAccessibility::OutParams* out_params); | 564 webkit_glue::WebAccessibility::OutParams* out_params); |
551 void OnClearAccessibilityInfo(int acc_obj_id, bool clear_all); | 565 void OnClearAccessibilityInfo(int acc_obj_id, bool clear_all); |
552 | 566 |
553 void OnExtensionMessageInvoke(const std::string& function_name, | 567 void OnExtensionMessageInvoke(const std::string& function_name, |
554 const ListValue& args); | 568 const ListValue& args); |
555 | 569 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 // as a temporary holder for the state until the WebDataSource corresponding | 844 // as a temporary holder for the state until the WebDataSource corresponding |
831 // to the new navigation is created. See DidCreateDataSource. | 845 // to the new navigation is created. See DidCreateDataSource. |
832 scoped_ptr<NavigationState> pending_navigation_state_; | 846 scoped_ptr<NavigationState> pending_navigation_state_; |
833 | 847 |
834 // PrintWebViewHelper handles printing. Note that this object is constructed | 848 // PrintWebViewHelper handles printing. Note that this object is constructed |
835 // when printing for the first time but only destroyed with the RenderView. | 849 // when printing for the first time but only destroyed with the RenderView. |
836 scoped_ptr<PrintWebViewHelper> print_helper_; | 850 scoped_ptr<PrintWebViewHelper> print_helper_; |
837 | 851 |
838 RendererPreferences renderer_preferences_; | 852 RendererPreferences renderer_preferences_; |
839 | 853 |
| 854 // Type of view attached with RenderView, it could be INVALID, TAB_CONTENTS, |
| 855 // EXTENSION_TOOLSTRIP, EXTENSION_BACKGROUND_PAGE, DEV_TOOLS_UI. |
| 856 ViewType::Type view_type_; |
| 857 |
| 858 // Id number of browser window which RenderView is attached to. |
| 859 int browser_window_id_; |
| 860 |
840 // page id for the last navigation sent to the browser. | 861 // page id for the last navigation sent to the browser. |
841 int32 last_top_level_navigation_page_id_; | 862 int32 last_top_level_navigation_page_id_; |
842 | 863 |
843 DISALLOW_COPY_AND_ASSIGN(RenderView); | 864 DISALLOW_COPY_AND_ASSIGN(RenderView); |
844 }; | 865 }; |
845 | 866 |
846 #endif // CHROME_RENDERER_RENDER_VIEW_H_ | 867 #endif // CHROME_RENDERER_RENDER_VIEW_H_ |
OLD | NEW |