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

Side by Side Diff: content/public/browser/web_contents_delegate.h

Issue 2521793003: Fix WebContentsDelegate::ShouldCreateWebContents implementations. (Closed)
Patch Set: Rename in MaybeCreateBackgroundContents Created 4 years 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_
6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ 6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 24 matching lines...) Expand all
35 namespace base { 35 namespace base {
36 class FilePath; 36 class FilePath;
37 class ListValue; 37 class ListValue;
38 } 38 }
39 39
40 namespace content { 40 namespace content {
41 class ColorChooser; 41 class ColorChooser;
42 class JavaScriptDialogManager; 42 class JavaScriptDialogManager;
43 class PageState; 43 class PageState;
44 class RenderFrameHost; 44 class RenderFrameHost;
45 class RenderWidgetHost;
45 class SessionStorageNamespace; 46 class SessionStorageNamespace;
47 class SiteInstance;
46 class WebContents; 48 class WebContents;
47 class WebContentsImpl; 49 class WebContentsImpl;
48 struct ColorSuggestion; 50 struct ColorSuggestion;
49 struct ContextMenuParams; 51 struct ContextMenuParams;
50 struct DropData; 52 struct DropData;
51 struct FileChooserParams; 53 struct FileChooserParams;
52 struct NativeWebKeyboardEvent; 54 struct NativeWebKeyboardEvent;
53 struct Referrer; 55 struct Referrer;
54 struct SecurityStyleExplanations; 56 struct SecurityStyleExplanations;
55 } // namespace content 57 } // namespace content
56 58
57 namespace gfx { 59 namespace gfx {
58 class Point; 60 class Point;
59 class Rect; 61 class Rect;
60 class Size; 62 class Size;
61 } 63 }
62 64
63 namespace net { 65 namespace net {
64 class X509Certificate; 66 class X509Certificate;
65 } 67 }
66 68
67 namespace blink { 69 namespace blink {
68 class WebGestureEvent; 70 class WebGestureEvent;
69 } 71 }
70 72
71 namespace content { 73 namespace content {
72 class RenderWidgetHost;
73 74
74 struct OpenURLParams; 75 struct OpenURLParams;
75 struct WebContentsUnresponsiveState; 76 struct WebContentsUnresponsiveState;
76 77
77 // Objects implement this interface to get notified about changes in the 78 // Objects implement this interface to get notified about changes in the
78 // WebContents and to provide necessary functionality. 79 // WebContents and to provide necessary functionality.
79 class CONTENT_EXPORT WebContentsDelegate { 80 class CONTENT_EXPORT WebContentsDelegate {
80 public: 81 public:
81 WebContentsDelegate(); 82 WebContentsDelegate();
82 83
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 const DropData& data, 283 const DropData& data,
283 blink::WebDragOperationsMask operations_allowed); 284 blink::WebDragOperationsMask operations_allowed);
284 285
285 // Shows the repost form confirmation dialog box. 286 // Shows the repost form confirmation dialog box.
286 virtual void ShowRepostFormWarningDialog(WebContents* source) {} 287 virtual void ShowRepostFormWarningDialog(WebContents* source) {}
287 288
288 // Allows delegate to override navigation to the history entries. 289 // Allows delegate to override navigation to the history entries.
289 // Returns true to allow WebContents to continue with the default processing. 290 // Returns true to allow WebContents to continue with the default processing.
290 virtual bool OnGoToEntryOffset(int offset); 291 virtual bool OnGoToEntryOffset(int offset);
291 292
292 // Allows delegate to control whether a WebContents will be created. Returns 293 // Allows delegate to control whether a new WebContents can be created by
293 // true to allow the creation. Default is to allow it. In cases where the 294 // |web_contents|.
294 // delegate handles the creation/navigation itself, it will use |target_url|. 295 //
295 // The embedder has to synchronously adopt |route_id| or else the view will 296 // The route ID parameters passed to this method are associated with the
296 // be destroyed. 297 // |source_site_instance|'s RenderProcessHost. They may also be
298 // MSG_ROUTING_NONE. If they are valid, they correspond to a trio of
299 // RenderView, RenderFrame, and RenderWidget objects that have been created in
300 // the renderer, but not yet assigned a WebContents, RenderViewHost,
301 // RenderFrameHost, or RenderWidgetHost.
302 //
303 // The return value is interpreted as follows:
304 //
305 // Return true: |web_contents| should create a WebContents.
306 // Return false: |web_contents| should not create a WebContents. The
307 // provisionally-created RenderView (if it exists) in the renderer
308 // process will be destroyed, UNLESS the delegate, during this method,
309 // itself creates a WebContents using |source_site_instance|,
310 // |route_id|, |main_frame_route_id|, and |main_frame_widget_route_id|
311 // as creation parameters. If this happens, the delegate assumes
312 // ownership of the corresponding RenderView, etc. |web_contents| will
313 // detect that this has happened by looking for the existence of a
314 // RenderViewHost in |source_site_instance| with |route_id|.
297 virtual bool ShouldCreateWebContents( 315 virtual bool ShouldCreateWebContents(
298 WebContents* web_contents, 316 WebContents* web_contents,
317 SiteInstance* source_site_instance,
299 int32_t route_id, 318 int32_t route_id,
300 int32_t main_frame_route_id, 319 int32_t main_frame_route_id,
301 int32_t main_frame_widget_route_id, 320 int32_t main_frame_widget_route_id,
302 WindowContainerType window_container_type, 321 WindowContainerType window_container_type,
322 const GURL& opener_url,
303 const std::string& frame_name, 323 const std::string& frame_name,
304 const GURL& target_url, 324 const GURL& target_url,
305 const std::string& partition_id, 325 const std::string& partition_id,
306 SessionStorageNamespace* session_storage_namespace); 326 SessionStorageNamespace* session_storage_namespace);
307 327
308 // Notifies the delegate about the creation of a new WebContents. This 328 // Notifies the delegate about the creation of a new WebContents. This
309 // typically happens when popups are created. 329 // typically happens when popups are created.
310 virtual void WebContentsCreated(WebContents* source_contents, 330 virtual void WebContentsCreated(WebContents* source_contents,
311 int opener_render_process_id, 331 int opener_render_process_id,
312 int opener_render_frame_id, 332 int opener_render_frame_id,
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 // Called when |this| is no longer the WebContentsDelegate for |source|. 567 // Called when |this| is no longer the WebContentsDelegate for |source|.
548 void Detach(WebContents* source); 568 void Detach(WebContents* source);
549 569
550 // The WebContents that this is currently a delegate for. 570 // The WebContents that this is currently a delegate for.
551 std::set<WebContents*> attached_contents_; 571 std::set<WebContents*> attached_contents_;
552 }; 572 };
553 573
554 } // namespace content 574 } // namespace content
555 575
556 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ 576 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/public/browser/web_contents_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698