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

Side by Side Diff: content/browser/browser_plugin/browser_plugin_guest.h

Issue 11028019: Browser plugin: Implement loadRedirect event. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initial patch Created 8 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) 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 // A BrowserPluginGuest represents the browser side of browser <--> renderer 5 // A BrowserPluginGuest represents the browser side of browser <--> renderer
6 // communication. A BrowserPlugin (a WebPlugin) is on the renderer side of 6 // communication. A BrowserPlugin (a WebPlugin) is on the renderer side of
7 // browser <--> guest renderer communication. The 'guest' renderer is a 7 // browser <--> guest renderer communication. The 'guest' renderer is a
8 // <browser> tag. 8 // <browser> tag.
9 // 9 //
10 // BrowserPluginGuest lives on the UI thread of the browser process. It has a 10 // BrowserPluginGuest lives on the UI thread of the browser process. It has a
(...skipping 16 matching lines...) Expand all
27 // WebContentsObserver for the WebContents. 27 // WebContentsObserver for the WebContents.
28 28
29 #ifndef CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ 29 #ifndef CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_
30 #define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ 30 #define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_
31 31
32 #include <map> 32 #include <map>
33 33
34 #include "base/compiler_specific.h" 34 #include "base/compiler_specific.h"
35 #include "base/id_map.h" 35 #include "base/id_map.h"
36 #include "base/time.h" 36 #include "base/time.h"
37 #include "content/public/browser/notification_observer.h"
38 #include "content/public/browser/notification_registrar.h"
37 #include "content/public/browser/web_contents_delegate.h" 39 #include "content/public/browser/web_contents_delegate.h"
38 #include "content/public/browser/web_contents_observer.h" 40 #include "content/public/browser/web_contents_observer.h"
39 #include "ui/gfx/rect.h" 41 #include "ui/gfx/rect.h"
40 #include "webkit/glue/webcursor.h" 42 #include "webkit/glue/webcursor.h"
41 43
42 class TransportDIB; 44 class TransportDIB;
43 struct ViewHostMsg_UpdateRect_Params; 45 struct ViewHostMsg_UpdateRect_Params;
44 46
45 namespace WebKit { 47 namespace WebKit {
46 class WebInputEvent; 48 class WebInputEvent;
47 } 49 }
48 50
49 namespace content { 51 namespace content {
50 52
51 class BrowserPluginHostFactory; 53 class BrowserPluginHostFactory;
52 class BrowserPluginEmbedder; 54 class BrowserPluginEmbedder;
53 class RenderProcessHost; 55 class RenderProcessHost;
54 56
55 // A browser plugin guest provides functionality for WebContents to operate in 57 // A browser plugin guest provides functionality for WebContents to operate in
56 // the guest role and implements guest specific overrides for ViewHostMsg_* 58 // the guest role and implements guest specific overrides for ViewHostMsg_*
57 // messages. 59 // messages.
58 // 60 //
59 // BrowserPluginEmbedder is responsible for creating and destroying a guest. 61 // BrowserPluginEmbedder is responsible for creating and destroying a guest.
60 class CONTENT_EXPORT BrowserPluginGuest : public WebContentsDelegate, 62 class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver,
63 public WebContentsDelegate,
61 public WebContentsObserver { 64 public WebContentsObserver {
62 public: 65 public:
63 virtual ~BrowserPluginGuest(); 66 virtual ~BrowserPluginGuest();
64 67
65 static BrowserPluginGuest* Create(int instance_id, 68 static BrowserPluginGuest* Create(int instance_id,
66 WebContentsImpl* web_contents, 69 WebContentsImpl* web_contents,
67 content::RenderViewHost* render_view_host); 70 content::RenderViewHost* render_view_host);
68 71
69 // Overrides factory for testing. Default (NULL) value indicates regular 72 // Overrides factory for testing. Default (NULL) value indicates regular
70 // (non-test) environment. 73 // (non-test) environment.
71 static void set_factory_for_testing(BrowserPluginHostFactory* factory) { 74 static void set_factory_for_testing(BrowserPluginHostFactory* factory) {
72 content::BrowserPluginGuest::factory_ = factory; 75 content::BrowserPluginGuest::factory_ = factory;
73 } 76 }
74 77
75 void set_guest_hang_timeout_for_testing(const base::TimeDelta& timeout) { 78 void set_guest_hang_timeout_for_testing(const base::TimeDelta& timeout) {
76 guest_hang_timeout_ = timeout; 79 guest_hang_timeout_ = timeout;
77 } 80 }
78 81
79 void set_embedder_render_process_host( 82 void set_embedder_render_process_host(
80 RenderProcessHost* render_process_host) { 83 RenderProcessHost* render_process_host) {
81 embedder_render_process_host_ = render_process_host; 84 embedder_render_process_host_ = render_process_host;
82 } 85 }
83 86
87 // NotificationObserver implementation.
88 virtual void Observe(int type,
89 const NotificationSource& source,
90 const NotificationDetails& details) OVERRIDE;
91
84 // WebContentsObserver implementation. 92 // WebContentsObserver implementation.
85 virtual void DidCommitProvisionalLoadForFrame( 93 virtual void DidCommitProvisionalLoadForFrame(
86 int64 frame_id, 94 int64 frame_id,
87 bool is_main_frame, 95 bool is_main_frame,
88 const GURL& url, 96 const GURL& url,
89 PageTransition transition_type, 97 PageTransition transition_type,
90 RenderViewHost* render_view_host) OVERRIDE; 98 RenderViewHost* render_view_host) OVERRIDE;
91 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; 99 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE;
92 100
93 // WebContentsDelegate implementation. 101 // WebContentsDelegate implementation.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 TransportDIB* damage_buffer() const { return damage_buffer_.get(); } 162 TransportDIB* damage_buffer() const { return damage_buffer_.get(); }
155 const gfx::Size& damage_view_size() const { return damage_view_size_; } 163 const gfx::Size& damage_view_size() const { return damage_view_size_; }
156 float damage_buffer_scale_factor() const { 164 float damage_buffer_scale_factor() const {
157 return damage_buffer_scale_factor_; 165 return damage_buffer_scale_factor_;
158 } 166 }
159 167
160 // Helper to send messages to embedder. Overridden in test implementation 168 // Helper to send messages to embedder. Overridden in test implementation
161 // since we want to intercept certain messages for testing. 169 // since we want to intercept certain messages for testing.
162 virtual void SendMessageToEmbedder(IPC::Message* msg); 170 virtual void SendMessageToEmbedder(IPC::Message* msg);
163 171
172 // Called when a redirect notification occurs.
173 void LoadRedirect(const GURL& old_url,
174 const GURL& new_url,
175 bool is_top_level);
176
164 // Static factory instance (always NULL for non-test). 177 // Static factory instance (always NULL for non-test).
165 static content::BrowserPluginHostFactory* factory_; 178 static content::BrowserPluginHostFactory* factory_;
166 179
180 NotificationRegistrar notification_registrar_;
167 RenderProcessHost* embedder_render_process_host_; 181 RenderProcessHost* embedder_render_process_host_;
168 // An identifier that uniquely identifies a browser plugin guest within an 182 // An identifier that uniquely identifies a browser plugin guest within an
169 // embedder. 183 // embedder.
170 int instance_id_; 184 int instance_id_;
171 scoped_ptr<TransportDIB> damage_buffer_; 185 scoped_ptr<TransportDIB> damage_buffer_;
172 #if defined(OS_WIN) 186 #if defined(OS_WIN)
173 size_t damage_buffer_size_; 187 size_t damage_buffer_size_;
174 #endif 188 #endif
175 gfx::Size damage_view_size_; 189 gfx::Size damage_view_size_;
176 float damage_buffer_scale_factor_; 190 float damage_buffer_scale_factor_;
177 scoped_ptr<IPC::Message> pending_input_event_reply_; 191 scoped_ptr<IPC::Message> pending_input_event_reply_;
178 gfx::Rect guest_rect_; 192 gfx::Rect guest_rect_;
179 WebCursor cursor_; 193 WebCursor cursor_;
180 IDMap<RenderViewHost> pending_updates_; 194 IDMap<RenderViewHost> pending_updates_;
181 int pending_update_counter_; 195 int pending_update_counter_;
182 base::TimeDelta guest_hang_timeout_; 196 base::TimeDelta guest_hang_timeout_;
183 197
184 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); 198 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest);
185 }; 199 };
186 200
187 } // namespace content 201 } // namespace content
188 202
189 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ 203 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698