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

Unified Diff: extensions/renderer/guest_view/guest_view_container.h

Issue 624063002: <webview>: resizing with display:none set should resize on attachment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup Created 6 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 side-by-side diff with in-line comments
Download patch
Index: extensions/renderer/guest_view/guest_view_container.h
diff --git a/extensions/renderer/guest_view/guest_view_container.h b/extensions/renderer/guest_view/guest_view_container.h
index 004810f118bdb844f4c5f66bf1d9883c951c8db4..fc2adbbfe6da49e5142797bb20de4876cfd3cfac 100644
--- a/extensions/renderer/guest_view/guest_view_container.h
+++ b/extensions/renderer/guest_view/guest_view_container.h
@@ -5,6 +5,9 @@
#ifndef CHROME_RENDERER_GUEST_VIEW_GUEST_VIEW_CONTAINER_H_
#define CHROME_RENDERER_GUEST_VIEW_GUEST_VIEW_CONTAINER_H_
+#include <queue>
+
+#include "base/memory/linked_ptr.h"
#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "content/public/renderer/browser_plugin_delegate.h"
@@ -16,6 +19,36 @@ namespace extensions {
class GuestViewContainer : public content::BrowserPluginDelegate,
public content::RenderFrameObserver {
public:
+ class AttachRequest {
lazyboy 2014/10/03 20:30:05 Add a description on this since this is public.
Fady Samuel 2014/10/03 21:52:31 Done.
+ public:
+ AttachRequest(int element_instance_id,
+ int guest_instance_id,
+ scoped_ptr<base::DictionaryValue> params,
+ v8::Handle<v8::Function> callback,
+ v8::Isolate* isolate);
+ ~AttachRequest();
+
+ int element_instance_id() const { return element_instance_id_; }
+
+ int guest_instance_id() const { return guest_instance_id_; }
+
+ base::DictionaryValue* attach_params() const {
+ return params_.get();
+ }
+
+ bool has_callback() const { return !callback_.IsEmpty(); }
lazyboy 2014/10/03 20:30:05 HasCallback() and define it in .cc file.
Fady Samuel 2014/10/03 21:52:31 Done.
+ v8::Handle<v8::Function> GetCallback() const;
+
+ v8::Isolate* isolate() const { return isolate_; }
+
+ private:
+ const int element_instance_id_;
+ const int guest_instance_id_;
+ scoped_ptr<base::DictionaryValue> params_;
+ ScopedPersistent<v8::Function> callback_;
+ v8::Isolate* const isolate_;
+ };
+
GuestViewContainer(content::RenderFrame* render_frame,
const std::string& mime_type);
virtual ~GuestViewContainer();
@@ -23,16 +56,13 @@ class GuestViewContainer : public content::BrowserPluginDelegate,
static GuestViewContainer* FromID(int render_view_routing_id,
int element_instance_id);
- void AttachGuest(int element_instance_id,
- int guest_instance_id,
- scoped_ptr<base::DictionaryValue> params,
- v8::Handle<v8::Function> callback,
- v8::Isolate* isolate);
+ void AttachGuest(linked_ptr<AttachRequest> request);
// BrowserPluginDelegate implementation.
virtual void SetElementInstanceID(int element_instance_id) OVERRIDE;
virtual void DidFinishLoading() OVERRIDE;
virtual void DidReceiveData(const char* data, int data_length) OVERRIDE;
+ virtual void Ready() OVERRIDE;
// RenderFrameObserver override.
virtual void OnDestruct() OVERRIDE;
@@ -42,6 +72,8 @@ class GuestViewContainer : public content::BrowserPluginDelegate,
void OnCreateMimeHandlerViewGuestACK(int element_instance_id);
void OnGuestAttached(int element_instance_id, int guest_routing_id);
+ void AttachGuestInternal(linked_ptr<AttachRequest> request);
+
static bool ShouldHandleMessage(const IPC::Message& mesage);
const std::string mime_type_;
@@ -52,10 +84,10 @@ class GuestViewContainer : public content::BrowserPluginDelegate,
int render_view_routing_id_;
bool attached_;
- bool attach_pending_;
+ bool ready_;
- ScopedPersistent<v8::Function> callback_;
- v8::Isolate* isolate_;
+ std::deque<linked_ptr<AttachRequest> > pending_requests_;
+ linked_ptr<AttachRequest> pending_response_;
DISALLOW_COPY_AND_ASSIGN(GuestViewContainer);
};

Powered by Google App Engine
This is Rietveld 408576698