Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
| 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
| 16 #include "content/public/browser/render_frame_host.h" | 16 #include "content/public/browser/render_frame_host.h" |
| 17 #include "content/public/common/javascript_message_type.h" | |
| 17 #include "content/public/common/page_transition_types.h" | 18 #include "content/public/common/page_transition_types.h" |
| 18 | 19 |
| 19 class GURL; | 20 class GURL; |
| 20 struct FrameHostMsg_DidFailProvisionalLoadWithError_Params; | 21 struct FrameHostMsg_DidFailProvisionalLoadWithError_Params; |
| 21 struct FrameHostMsg_OpenURL_Params; | 22 struct FrameHostMsg_OpenURL_Params; |
| 22 struct FrameMsg_Navigate_Params; | 23 struct FrameMsg_Navigate_Params; |
| 23 | 24 |
| 24 namespace base { | 25 namespace base { |
| 25 class FilePath; | 26 class FilePath; |
| 26 class ListValue; | 27 class ListValue; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 // Load the specified URL; this is a shortcut for Navigate(). | 162 // Load the specified URL; this is a shortcut for Navigate(). |
| 162 void NavigateToURL(const GURL& url); | 163 void NavigateToURL(const GURL& url); |
| 163 | 164 |
| 164 // Requests the renderer to select the region between two points. | 165 // Requests the renderer to select the region between two points. |
| 165 void SelectRange(const gfx::Point& start, const gfx::Point& end); | 166 void SelectRange(const gfx::Point& start, const gfx::Point& end); |
| 166 | 167 |
| 167 // Deletes the current selection plus the specified number of characters | 168 // Deletes the current selection plus the specified number of characters |
| 168 // before and after the selection or caret. | 169 // before and after the selection or caret. |
| 169 void ExtendSelectionAndDelete(size_t before, size_t after); | 170 void ExtendSelectionAndDelete(size_t before, size_t after); |
| 170 | 171 |
| 172 // Notifies the RenderView that the JavaScript message that was shown was | |
|
nasko
2014/04/07 15:45:51
nit: RenderFrame
Avi (use Gerrit)
2014/04/07 18:03:46
Done.
| |
| 173 // closed by the user. | |
| 174 void JavaScriptDialogClosed(IPC::Message* reply_msg, | |
| 175 bool success, | |
| 176 const base::string16& user_input); | |
| 177 | |
| 171 protected: | 178 protected: |
| 172 friend class RenderFrameHostFactory; | 179 friend class RenderFrameHostFactory; |
| 173 | 180 |
| 174 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost | 181 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost |
| 175 // should be the abstraction needed here, but we need RenderViewHost to pass | 182 // should be the abstraction needed here, but we need RenderViewHost to pass |
| 176 // into WebContentsObserver::FrameDetached for now. | 183 // into WebContentsObserver::FrameDetached for now. |
| 177 RenderFrameHostImpl(RenderViewHostImpl* render_view_host, | 184 RenderFrameHostImpl(RenderViewHostImpl* render_view_host, |
| 178 RenderFrameHostDelegate* delegate, | 185 RenderFrameHostDelegate* delegate, |
| 179 FrameTree* frame_tree, | 186 FrameTree* frame_tree, |
| 180 FrameTreeNode* frame_tree_node, | 187 FrameTreeNode* frame_tree_node, |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 206 const GURL& target_url); | 213 const GURL& target_url); |
| 207 void OnNavigate(const IPC::Message& msg); | 214 void OnNavigate(const IPC::Message& msg); |
| 208 void OnDidStopLoading(); | 215 void OnDidStopLoading(); |
| 209 void OnBeforeUnloadACK( | 216 void OnBeforeUnloadACK( |
| 210 bool proceed, | 217 bool proceed, |
| 211 const base::TimeTicks& renderer_before_unload_start_time, | 218 const base::TimeTicks& renderer_before_unload_start_time, |
| 212 const base::TimeTicks& renderer_before_unload_end_time); | 219 const base::TimeTicks& renderer_before_unload_end_time); |
| 213 void OnSwapOutACK(); | 220 void OnSwapOutACK(); |
| 214 void OnContextMenu(const ContextMenuParams& params); | 221 void OnContextMenu(const ContextMenuParams& params); |
| 215 void OnJavaScriptExecuteResponse(int id, const base::ListValue& result); | 222 void OnJavaScriptExecuteResponse(int id, const base::ListValue& result); |
| 223 void OnRunJavaScriptMessage(const base::string16& message, | |
| 224 const base::string16& default_prompt, | |
| 225 const GURL& frame_url, | |
| 226 JavaScriptMessageType type, | |
| 227 IPC::Message* reply_msg); | |
| 228 void OnRunBeforeUnloadConfirm(const GURL& frame_url, | |
| 229 const base::string16& message, | |
| 230 bool is_reload, | |
| 231 IPC::Message* reply_msg); | |
| 216 | 232 |
| 217 // Returns whether the given URL is allowed to commit in the current process. | 233 // Returns whether the given URL is allowed to commit in the current process. |
| 218 // This is a more conservative check than RenderProcessHost::FilterURL, since | 234 // This is a more conservative check than RenderProcessHost::FilterURL, since |
| 219 // it will be used to kill processes that commit unauthorized URLs. | 235 // it will be used to kill processes that commit unauthorized URLs. |
| 220 bool CanCommitURL(const GURL& url); | 236 bool CanCommitURL(const GURL& url); |
| 221 | 237 |
| 238 // Returns a pointer to the top-level boolean holding the value of whether | |
| 239 // JavaScript messages are suppressed for the page. | |
| 240 bool* AreJavaScriptMessagesSuppressed(); | |
| 241 | |
| 222 // For now, RenderFrameHosts indirectly keep RenderViewHosts alive via a | 242 // For now, RenderFrameHosts indirectly keep RenderViewHosts alive via a |
| 223 // refcount that calls Shutdown when it reaches zero. This allows each | 243 // refcount that calls Shutdown when it reaches zero. This allows each |
| 224 // RenderFrameHostManager to just care about RenderFrameHosts, while ensuring | 244 // RenderFrameHostManager to just care about RenderFrameHosts, while ensuring |
| 225 // we have a RenderViewHost for each RenderFrameHost. | 245 // we have a RenderViewHost for each RenderFrameHost. |
| 226 // TODO(creis): RenderViewHost will eventually go away and be replaced with | 246 // TODO(creis): RenderViewHost will eventually go away and be replaced with |
| 227 // some form of page context. | 247 // some form of page context. |
| 228 RenderViewHostImpl* render_view_host_; | 248 RenderViewHostImpl* render_view_host_; |
| 229 | 249 |
| 230 RenderFrameHostDelegate* delegate_; | 250 RenderFrameHostDelegate* delegate_; |
| 231 | 251 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 252 // The mapping of pending JavaScript calls created by | 272 // The mapping of pending JavaScript calls created by |
| 253 // ExecuteJavaScript and their corresponding callbacks. | 273 // ExecuteJavaScript and their corresponding callbacks. |
| 254 std::map<int, JavaScriptResultCallback> javascript_callbacks_; | 274 std::map<int, JavaScriptResultCallback> javascript_callbacks_; |
| 255 | 275 |
| 256 int routing_id_; | 276 int routing_id_; |
| 257 bool is_swapped_out_; | 277 bool is_swapped_out_; |
| 258 | 278 |
| 259 // When the last BeforeUnload message was sent. | 279 // When the last BeforeUnload message was sent. |
| 260 base::TimeTicks send_before_unload_start_time_; | 280 base::TimeTicks send_before_unload_start_time_; |
| 261 | 281 |
| 282 // Set if JavaScript messages are suppressed for this page. This is only used | |
| 283 // in the top-level frame. | |
| 284 bool are_javascript_messages_suppressed_; | |
| 285 | |
| 262 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 286 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
| 263 }; | 287 }; |
| 264 | 288 |
| 265 } // namespace content | 289 } // namespace content |
| 266 | 290 |
| 267 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 291 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
| OLD | NEW |