Make it clear that WeakPtrFactory is the last data member
[chromium-blink-merge.git] / extensions / renderer / guest_view / guest_view_container.h
blob004810f118bdb844f4c5f66bf1d9883c951c8db4
1 // Copyright 2014 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.
5 #ifndef CHROME_RENDERER_GUEST_VIEW_GUEST_VIEW_CONTAINER_H_
6 #define CHROME_RENDERER_GUEST_VIEW_GUEST_VIEW_CONTAINER_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/values.h"
10 #include "content/public/renderer/browser_plugin_delegate.h"
11 #include "content/public/renderer/render_frame_observer.h"
12 #include "extensions/renderer/scoped_persistent.h"
14 namespace extensions {
16 class GuestViewContainer : public content::BrowserPluginDelegate,
17 public content::RenderFrameObserver {
18 public:
19 GuestViewContainer(content::RenderFrame* render_frame,
20 const std::string& mime_type);
21 virtual ~GuestViewContainer();
23 static GuestViewContainer* FromID(int render_view_routing_id,
24 int element_instance_id);
26 void AttachGuest(int element_instance_id,
27 int guest_instance_id,
28 scoped_ptr<base::DictionaryValue> params,
29 v8::Handle<v8::Function> callback,
30 v8::Isolate* isolate);
32 // BrowserPluginDelegate implementation.
33 virtual void SetElementInstanceID(int element_instance_id) OVERRIDE;
34 virtual void DidFinishLoading() OVERRIDE;
35 virtual void DidReceiveData(const char* data, int data_length) OVERRIDE;
37 // RenderFrameObserver override.
38 virtual void OnDestruct() OVERRIDE;
39 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
41 private:
42 void OnCreateMimeHandlerViewGuestACK(int element_instance_id);
43 void OnGuestAttached(int element_instance_id, int guest_routing_id);
45 static bool ShouldHandleMessage(const IPC::Message& mesage);
47 const std::string mime_type_;
48 int element_instance_id_;
49 std::string html_string_;
50 // Save the RenderView RoutingID here so that we can use it during
51 // destruction.
52 int render_view_routing_id_;
54 bool attached_;
55 bool attach_pending_;
57 ScopedPersistent<v8::Function> callback_;
58 v8::Isolate* isolate_;
60 DISALLOW_COPY_AND_ASSIGN(GuestViewContainer);
63 } // namespace extensions
65 #endif // CHROME_RENDERER_GUEST_VIEW_GUEST_VIEW_CONTAINER_H_