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

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

Issue 26497003: Remove NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED from browser plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
« no previous file with comments | « no previous file | content/browser/browser_plugin/browser_plugin_guest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 is the browser side of a browser <--> embedder 5 // A BrowserPluginGuest is the browser side of a browser <--> embedder
6 // renderer channel. A BrowserPlugin (a WebPlugin) is on the embedder 6 // renderer channel. A BrowserPlugin (a WebPlugin) is on the embedder
7 // renderer side of browser <--> embedder renderer communication. 7 // renderer side of browser <--> embedder renderer communication.
8 // 8 //
9 // BrowserPluginGuest lives on the UI thread of the browser process. It has a 9 // BrowserPluginGuest lives on the UI thread of the browser process. It has a
10 // helper, BrowserPluginGuestHelper, which is a RenderViewHostObserver. The 10 // helper, BrowserPluginGuestHelper, which is a RenderViewHostObserver. The
(...skipping 15 matching lines...) Expand all
26 26
27 #include "base/compiler_specific.h" 27 #include "base/compiler_specific.h"
28 #include "base/id_map.h" 28 #include "base/id_map.h"
29 #include "base/memory/shared_memory.h" 29 #include "base/memory/shared_memory.h"
30 #include "base/memory/weak_ptr.h" 30 #include "base/memory/weak_ptr.h"
31 #include "base/values.h" 31 #include "base/values.h"
32 #include "content/common/edit_command.h" 32 #include "content/common/edit_command.h"
33 #include "content/port/common/input_event_ack_state.h" 33 #include "content/port/common/input_event_ack_state.h"
34 #include "content/public/browser/browser_plugin_guest_delegate.h" 34 #include "content/public/browser/browser_plugin_guest_delegate.h"
35 #include "content/public/browser/javascript_dialog_manager.h" 35 #include "content/public/browser/javascript_dialog_manager.h"
36 #include "content/public/browser/notification_observer.h"
37 #include "content/public/browser/notification_registrar.h"
38 #include "content/public/browser/render_view_host_observer.h" 36 #include "content/public/browser/render_view_host_observer.h"
39 #include "content/public/browser/web_contents_delegate.h" 37 #include "content/public/browser/web_contents_delegate.h"
40 #include "content/public/browser/web_contents_observer.h" 38 #include "content/public/browser/web_contents_observer.h"
41 #include "content/public/common/browser_plugin_permission_type.h" 39 #include "content/public/common/browser_plugin_permission_type.h"
42 #include "third_party/WebKit/public/web/WebDragOperation.h" 40 #include "third_party/WebKit/public/web/WebDragOperation.h"
43 #include "third_party/WebKit/public/web/WebDragStatus.h" 41 #include "third_party/WebKit/public/web/WebDragStatus.h"
44 #include "third_party/WebKit/public/web/WebInputEvent.h" 42 #include "third_party/WebKit/public/web/WebInputEvent.h"
45 #include "ui/gfx/rect.h" 43 #include "ui/gfx/rect.h"
46 #include "ui/surface/transport_dib.h" 44 #include "ui/surface/transport_dib.h"
47 45
(...skipping 30 matching lines...) Expand all
78 // messages. 76 // messages.
79 // 77 //
80 // When a guest is initially created, it is in an unattached state. That is, 78 // When a guest is initially created, it is in an unattached state. That is,
81 // it is not visible anywhere and has no embedder WebContents assigned. 79 // it is not visible anywhere and has no embedder WebContents assigned.
82 // A BrowserPluginGuest is said to be "attached" if it has an embedder. 80 // A BrowserPluginGuest is said to be "attached" if it has an embedder.
83 // A BrowserPluginGuest can also create a new unattached guest via 81 // A BrowserPluginGuest can also create a new unattached guest via
84 // CreateNewWindow. The newly created guest will live in the same partition, 82 // CreateNewWindow. The newly created guest will live in the same partition,
85 // which means it can share storage and can script this guest. 83 // which means it can share storage and can script this guest.
86 class CONTENT_EXPORT BrowserPluginGuest 84 class CONTENT_EXPORT BrowserPluginGuest
87 : public JavaScriptDialogManager, 85 : public JavaScriptDialogManager,
88 public NotificationObserver,
89 public WebContentsDelegate, 86 public WebContentsDelegate,
90 public WebContentsObserver, 87 public WebContentsObserver,
91 public base::SupportsWeakPtr<BrowserPluginGuest> { 88 public base::SupportsWeakPtr<BrowserPluginGuest> {
92 public: 89 public:
93 typedef base::Callback<void(bool)> GeolocationCallback; 90 typedef base::Callback<void(bool)> GeolocationCallback;
94 virtual ~BrowserPluginGuest(); 91 virtual ~BrowserPluginGuest();
95 92
96 static BrowserPluginGuest* Create( 93 static BrowserPluginGuest* Create(
97 int instance_id, 94 int instance_id,
98 WebContentsImpl* web_contents, 95 WebContentsImpl* web_contents,
99 scoped_ptr<base::DictionaryValue> extra_params); 96 scoped_ptr<base::DictionaryValue> extra_params);
100 97
101 static BrowserPluginGuest* CreateWithOpener( 98 static BrowserPluginGuest* CreateWithOpener(
102 int instance_id, 99 int instance_id,
103 WebContentsImpl* web_contents, 100 WebContentsImpl* web_contents,
104 BrowserPluginGuest* opener, 101 BrowserPluginGuest* opener,
105 bool has_render_view); 102 bool has_render_view);
106 103
107 // Called when the embedder RenderViewHost is destroyed to give the 104 // Called when the embedder WebContents is destroyed to give the
108 // BrowserPluginGuest an opportunity to clean up after itself. 105 // BrowserPluginGuest an opportunity to clean up after itself.
109 void EmbedderDestroyed(); 106 void EmbedderDestroyed();
110 107
108 // Called when the embedder WebContents changes visibility.
109 void EmbedderVisibilityChanged(bool visible);
110
111 // Destroys the guest WebContents and all its associated state, including 111 // Destroys the guest WebContents and all its associated state, including
112 // this BrowserPluginGuest, and its new unattached windows. 112 // this BrowserPluginGuest, and its new unattached windows.
113 void Destroy(); 113 void Destroy();
114 114
115 // Returns the identifier that uniquely identifies a browser plugin guest 115 // Returns the identifier that uniquely identifies a browser plugin guest
116 // within an embedder. 116 // within an embedder.
117 int instance_id() const { return instance_id_; } 117 int instance_id() const { return instance_id_; }
118 118
119 // Overrides factory for testing. Default (NULL) value indicates regular 119 // Overrides factory for testing. Default (NULL) value indicates regular
120 // (non-test) environment. 120 // (non-test) environment.
(...skipping 21 matching lines...) Expand all
142 void clear_damage_buffer() { damage_buffer_.reset(); } 142 void clear_damage_buffer() { damage_buffer_.reset(); }
143 bool is_in_destruction() { return is_in_destruction_; } 143 bool is_in_destruction() { return is_in_destruction_; }
144 144
145 BrowserPluginGuest* opener() const { return opener_.get(); } 145 BrowserPluginGuest* opener() const { return opener_.get(); }
146 146
147 // Returns whether the mouse pointer was unlocked. 147 // Returns whether the mouse pointer was unlocked.
148 bool UnlockMouseIfNecessary(const NativeWebKeyboardEvent& event); 148 bool UnlockMouseIfNecessary(const NativeWebKeyboardEvent& event);
149 149
150 void UpdateVisibility(); 150 void UpdateVisibility();
151 151
152 // NotificationObserver implementation.
153 virtual void Observe(int type,
154 const NotificationSource& source,
155 const NotificationDetails& details) OVERRIDE;
156
157 // WebContentsObserver implementation. 152 // WebContentsObserver implementation.
158 virtual void DidCommitProvisionalLoadForFrame( 153 virtual void DidCommitProvisionalLoadForFrame(
159 int64 frame_id, 154 int64 frame_id,
160 bool is_main_frame, 155 bool is_main_frame,
161 const GURL& url, 156 const GURL& url,
162 PageTransition transition_type, 157 PageTransition transition_type,
163 RenderViewHost* render_view_host) OVERRIDE; 158 RenderViewHost* render_view_host) OVERRIDE;
164 virtual void DidStopLoading(RenderViewHost* render_view_host) OVERRIDE; 159 virtual void DidStopLoading(RenderViewHost* render_view_host) OVERRIDE;
165 160
166 virtual void RenderViewReady() OVERRIDE; 161 virtual void RenderViewReady() OVERRIDE;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 void EndSystemDrag(); 285 void EndSystemDrag();
291 286
292 // |this| takes ownership of |delegate|. 287 // |this| takes ownership of |delegate|.
293 void SetDelegate(BrowserPluginGuestDelegate* delegate); 288 void SetDelegate(BrowserPluginGuestDelegate* delegate);
294 289
295 void RespondToPermissionRequest(int request_id, 290 void RespondToPermissionRequest(int request_id,
296 bool should_allow, 291 bool should_allow,
297 const std::string& user_input); 292 const std::string& user_input);
298 293
299 private: 294 private:
300 class EmbedderRenderViewHostObserver; 295 class EmbedderWebContentsObserver;
301 friend class TestBrowserPluginGuest; 296 friend class TestBrowserPluginGuest;
302 297
303 class DownloadRequest; 298 class DownloadRequest;
304 class GeolocationRequest; 299 class GeolocationRequest;
305 class JavaScriptDialogRequest; 300 class JavaScriptDialogRequest;
306 // MediaRequest because of naming conflicts with MediaStreamRequest. 301 // MediaRequest because of naming conflicts with MediaStreamRequest.
307 class MediaRequest; 302 class MediaRequest;
308 class NewWindowRequest; 303 class NewWindowRequest;
309 class PermissionRequest; 304 class PermissionRequest;
310 class PointerLockRequest; 305 class PointerLockRequest;
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 // Forwards all messages from the |pending_messages_| queue to the embedder. 464 // Forwards all messages from the |pending_messages_| queue to the embedder.
470 void SendQueuedMessages(); 465 void SendQueuedMessages();
471 466
472 // Weak pointer used to ask GeolocationPermissionContext about geolocation 467 // Weak pointer used to ask GeolocationPermissionContext about geolocation
473 // permission. 468 // permission.
474 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; 469 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_;
475 470
476 // Static factory instance (always NULL for non-test). 471 // Static factory instance (always NULL for non-test).
477 static BrowserPluginHostFactory* factory_; 472 static BrowserPluginHostFactory* factory_;
478 473
479 NotificationRegistrar notification_registrar_; 474 scoped_ptr<EmbedderWebContentsObserver> embedder_web_contents_observer_;
480 scoped_ptr<EmbedderRenderViewHostObserver> embedder_rvh_observer_;
481 WebContentsImpl* embedder_web_contents_; 475 WebContentsImpl* embedder_web_contents_;
482 476
483 std::map<int, int> bridge_id_to_request_id_map_; 477 std::map<int, int> bridge_id_to_request_id_map_;
484 478
485 // An identifier that uniquely identifies a browser plugin guest within an 479 // An identifier that uniquely identifies a browser plugin guest within an
486 // embedder. 480 // embedder.
487 int instance_id_; 481 int instance_id_;
488 scoped_ptr<base::SharedMemory> damage_buffer_; 482 scoped_ptr<base::SharedMemory> damage_buffer_;
489 // An identifier that uniquely identifies a damage buffer. 483 // An identifier that uniquely identifies a damage buffer.
490 uint32 damage_buffer_sequence_id_; 484 uint32 damage_buffer_sequence_id_;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 // These are parameters passed from JavaScript on attachment to the content 544 // These are parameters passed from JavaScript on attachment to the content
551 // embedder. 545 // embedder.
552 scoped_ptr<base::DictionaryValue> extra_attach_params_; 546 scoped_ptr<base::DictionaryValue> extra_attach_params_;
553 547
554 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); 548 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest);
555 }; 549 };
556 550
557 } // namespace content 551 } // namespace content
558 552
559 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ 553 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/browser_plugin/browser_plugin_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698