OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ |
6 #define CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ | 6 #define CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "content/public/browser/browser_plugin_guest_manager_delegate.h" | 12 #include "content/public/browser/browser_plugin_guest_manager.h" |
13 #include "content/public/browser/site_instance.h" | 13 #include "content/public/browser/site_instance.h" |
14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
15 | 15 |
16 class GuestViewBase; | 16 class GuestViewBase; |
17 class GuestWebContentsObserver; | 17 class GuestWebContentsObserver; |
18 class GURL; | 18 class GURL; |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 class BrowserContext; | 21 class BrowserContext; |
22 } // namespace content | 22 } // namespace content |
23 | 23 |
24 class GuestViewManager : public content::BrowserPluginGuestManagerDelegate, | 24 class GuestViewManager : public content::BrowserPluginGuestManager, |
25 public base::SupportsUserData::Data { | 25 public base::SupportsUserData::Data { |
26 public: | 26 public: |
27 explicit GuestViewManager(content::BrowserContext* context); | 27 explicit GuestViewManager(content::BrowserContext* context); |
28 virtual ~GuestViewManager(); | 28 virtual ~GuestViewManager(); |
29 | 29 |
30 static GuestViewManager* FromBrowserContext(content::BrowserContext* context); | 30 static GuestViewManager* FromBrowserContext(content::BrowserContext* context); |
31 | 31 |
32 // Returns the guest WebContents associated with the given |guest_instance_id| | 32 // Returns the guest WebContents associated with the given |guest_instance_id| |
33 // if the provided |embedder_render_process_id| is allowed to access it. | 33 // if the provided |embedder_render_process_id| is allowed to access it. |
34 // If the embedder is not allowed access, the embedder will be killed, and | 34 // If the embedder is not allowed access, the embedder will be killed, and |
35 // this method will return NULL. If no WebContents exists with the given | 35 // this method will return NULL. If no WebContents exists with the given |
36 // instance ID, then NULL will also be returned. | 36 // instance ID, then NULL will also be returned. |
37 content::WebContents* GetGuestByInstanceIDSafely( | 37 content::WebContents* GetGuestByInstanceIDSafely( |
38 int guest_instance_id, | 38 int guest_instance_id, |
39 int embedder_render_process_id); | 39 int embedder_render_process_id); |
40 | 40 |
41 // BrowserPluginGuestManagerDelegate implementation. | 41 // BrowserPluginGuestManager implementation. |
42 virtual content::WebContents* CreateGuest( | 42 virtual content::WebContents* CreateGuest( |
43 content::SiteInstance* embedder_site_instance, | 43 content::SiteInstance* embedder_site_instance, |
44 int instance_id, | 44 int instance_id, |
45 const std::string& storage_partition_id, | 45 const std::string& storage_partition_id, |
46 bool persist_storage, | 46 bool persist_storage, |
47 scoped_ptr<base::DictionaryValue> extra_params) OVERRIDE; | 47 scoped_ptr<base::DictionaryValue> extra_params) OVERRIDE; |
48 virtual int GetNextInstanceID() OVERRIDE; | 48 virtual int GetNextInstanceID() OVERRIDE; |
49 virtual void MaybeGetGuestByInstanceIDOrKill( | 49 virtual void MaybeGetGuestByInstanceIDOrKill( |
50 int guest_instance_id, | 50 int guest_instance_id, |
51 int embedder_render_process_id, | 51 int embedder_render_process_id, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 typedef std::map<int, content::WebContents*> GuestInstanceMap; | 88 typedef std::map<int, content::WebContents*> GuestInstanceMap; |
89 GuestInstanceMap guest_web_contents_by_instance_id_; | 89 GuestInstanceMap guest_web_contents_by_instance_id_; |
90 | 90 |
91 int current_instance_id_; | 91 int current_instance_id_; |
92 content::BrowserContext* context_; | 92 content::BrowserContext* context_; |
93 | 93 |
94 DISALLOW_COPY_AND_ASSIGN(GuestViewManager); | 94 DISALLOW_COPY_AND_ASSIGN(GuestViewManager); |
95 }; | 95 }; |
96 | 96 |
97 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ | 97 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ |
OLD | NEW |