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

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

Issue 269113002: Remove BrowserPluginGuestManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@guestview_manager_createguest
Patch Set: Updateed Created 6 years, 7 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
OLDNEW
(Empty)
1 // Copyright 2013 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 // A BrowserPluginGuestManager serves as a message router to BrowserPluginGuests
6 // for all guests within a given profile.
7 // Messages are routed to a particular guest instance based on an instance_id.
8
9 #ifndef CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_MANAGER_H_
10 #define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_MANAGER_H_
11
12 #include "base/basictypes.h"
13 #include "base/supports_user_data.h"
14 #include "base/values.h"
15 #include "content/common/content_export.h"
16 #include "content/public/browser/browser_plugin_guest_manager_delegate.h"
17 #include "ipc/ipc_message.h"
18
19 struct BrowserPluginHostMsg_Attach_Params;
20 struct BrowserPluginHostMsg_ResizeGuest_Params;
21 class GURL;
22
23 namespace gfx {
24 class Point;
25 }
26
27 namespace IPC {
28 class Message;
29 } // namespace IPC
30
31 namespace content {
32
33 class BrowserContext;
34 class BrowserPluginGuest;
35 class BrowserPluginHostFactory;
36 class RenderWidgetHostImpl;
37 class SiteInstance;
38 class WebContents;
39
40 // WARNING: All APIs should be guarded with a process ID check like
41 // CanEmbedderAccessInstanceIDMaybeKill, to prevent abuse by normal renderer
42 // processes.
43 class CONTENT_EXPORT BrowserPluginGuestManager :
44 public base::SupportsUserData::Data {
45 public:
46 virtual ~BrowserPluginGuestManager();
47
48 static BrowserPluginGuestManager* FromBrowserContext(BrowserContext* context);
49
50 BrowserPluginGuestManagerDelegate* GetDelegate() const;
51
52 static BrowserPluginGuestManager* Create(BrowserContext* context);
53
54 // Overrides factory for testing. Default (NULL) value indicates regular
55 // (non-test) environment.
56 static void set_factory_for_testing(BrowserPluginHostFactory* factory) {
57 content::BrowserPluginGuestManager::factory_ = factory;
58 }
59
60 // Gets the next available instance id. 0 is considered an invalid instance
61 // ID.
62 int GetNextInstanceID();
63
64 // Creates a guest WebContents with the provided |instance_id| and |params|.
65 // If params.src is present, the new guest will also be navigated to the
66 // provided URL. Optionally, the new guest may be attached to a
67 // |guest_opener|, and may be attached to a pre-selected |routing_id|.
68 virtual BrowserPluginGuest* CreateGuest(
69 SiteInstance* embedder_site_instance,
70 int instance_id,
71 const std::string& storage_partition_id,
72 bool persist_storage,
73 scoped_ptr<base::DictionaryValue> extra_params);
74
75 typedef base::Callback<void(BrowserPluginGuest*)> GuestByInstanceIDCallback;
76 void MaybeGetGuestByInstanceIDOrKill(
77 int instance_id,
78 int embedder_render_process_id,
79 const GuestByInstanceIDCallback& callback) const;
80
81 typedef base::Callback<bool(BrowserPluginGuest*)> GuestCallback;
82 bool ForEachGuest(WebContents* embedder_web_contents,
83 const GuestCallback& callback);
84
85 void OnMessageReceived(const IPC::Message& message, int render_process_id);
86
87 private:
88 friend class TestBrowserPluginGuestManager;
89
90 explicit BrowserPluginGuestManager(BrowserContext* context);
91
92 // Static factory instance (always NULL outside of tests).
93 static BrowserPluginHostFactory* factory_;
94
95 // The BrowserContext in which this manager this stored.
96 BrowserContext* context_;
97
98 // Contains guests' WebContents, mapping from their instance ids.
99 typedef std::map<int, WebContents*> GuestInstanceMap;
100 GuestInstanceMap guest_web_contents_by_instance_id_;
101 int next_instance_id_;
102
103 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuestManager);
104 };
105
106 } // namespace content
107
108 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_MANAGER_H_
OLDNEW
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.cc ('k') | content/browser/browser_plugin/browser_plugin_guest_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698