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

Side by Side Diff: content/browser/tab_contents/tab_contents_view_helper.h

Issue 10031044: TabContents -> WebContentsImpl, part 5. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase (fixed) Created 8 years, 8 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_HELPER_H_
6 #define CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_HELPER_H_
7 #pragma once
8
9 #include <map>
10
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "content/common/content_export.h"
14 #include "content/public/browser/notification_observer.h"
15 #include "content/public/browser/notification_registrar.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h"
17 #include "webkit/glue/window_open_disposition.h"
18
19 class WebContentsImpl;
20 struct ViewHostMsg_CreateWindow_Params;
21
22 namespace content {
23 class RenderWidgetHostView;
24 class WebContents;
25 }
26
27 namespace gfx {
28 class Rect;
29 }
30
31 // TODO(avi): Once all the TabContentsViews implementations are in content (I'm
32 // looking at you, TabContentsViewViews...) then change the parameters to take
33 // WebContentsImpl rather than WebContents.
34
35 // Provides helper methods that provide common implementations of some
36 // WebContentsView methods.
37 class CONTENT_EXPORT TabContentsViewHelper
38 : public content::NotificationObserver {
39 public:
40 TabContentsViewHelper();
41 virtual ~TabContentsViewHelper();
42
43 // Creates a new window; call |ShowCreatedWindow| below to show it.
44 WebContentsImpl* CreateNewWindow(
45 content::WebContents* web_contents,
46 int route_id,
47 const ViewHostMsg_CreateWindow_Params& params);
48
49 // Creates a new popup or fullscreen widget; call |ShowCreatedWidget| below to
50 // show it. If |is_fullscreen| is true it is a fullscreen widget, if not then
51 // a pop-up. |popup_type| is only meaningful for a pop-up.
52 content::RenderWidgetHostView* CreateNewWidget(
53 content::WebContents* web_contents,
54 int route_id,
55 bool is_fullscreen,
56 WebKit::WebPopupType popup_type);
57
58 // Shows a window created with |CreateNewWindow| above.
59 WebContentsImpl* ShowCreatedWindow(content::WebContents* web_contents,
60 int route_id,
61 WindowOpenDisposition disposition,
62 const gfx::Rect& initial_pos,
63 bool user_gesture);
64
65 // Shows a widget created with |CreateNewWidget| above. |initial_pos| is only
66 // meaningful for non-fullscreen widgets.
67 content::RenderWidgetHostView* ShowCreatedWidget(
68 content::WebContents* web_contents,
69 int route_id,
70 bool is_fullscreen,
71 const gfx::Rect& initial_pos);
72
73 private:
74 // content::NotificationObserver implementation
75 virtual void Observe(int type,
76 const content::NotificationSource& source,
77 const content::NotificationDetails& details) OVERRIDE;
78
79 // Finds the new RenderWidgetHost and returns it. Note that this can only be
80 // called once as this call also removes it from the internal map.
81 content::RenderWidgetHostView* GetCreatedWidget(int route_id);
82
83 // Finds the new WebContentsImpl by route_id, initializes it for
84 // renderer-initiated creation, and returns it. Note that this can only be
85 // called once as this call also removes it from the internal map.
86 WebContentsImpl* GetCreatedWindow(int route_id);
87
88 // Tracks created WebContentsImpl objects that have not been shown yet. They
89 // are identified by the route ID passed to CreateNewWindow.
90 typedef std::map<int, WebContentsImpl*> PendingContents;
91 PendingContents pending_contents_;
92
93 // These maps hold on to the widgets that we created on behalf of the renderer
94 // that haven't shown yet.
95 typedef std::map<int, content::RenderWidgetHostView*> PendingWidgetViews;
96 PendingWidgetViews pending_widget_views_;
97
98 // Registers and unregisters us for notifications.
99 content::NotificationRegistrar registrar_;
100
101 DISALLOW_COPY_AND_ASSIGN(TabContentsViewHelper);
102 };
103
104 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698