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 CONTENT_BROWSER_BROWSER_PLUGIN_TEST_GUEST_MANAGER_DELEGATE_H_ | 5 #ifndef CONTENT_BROWSER_BROWSER_PLUGIN_TEST_GUEST_MANAGER_DELEGATE_H_ |
6 #define CONTENT_BROWSER_BROWSER_PLUGIN_TEST_GUEST_MANAGER_DELEGATE_H_ | 6 #define CONTENT_BROWSER_BROWSER_PLUGIN_TEST_GUEST_MANAGER_DELEGATE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
11 #include "content/public/browser/browser_plugin_guest_manager_delegate.h" | 11 #include "content/public/browser/browser_plugin_guest_manager_delegate.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 // This class is temporary until BrowserPluginHostTest.* tests are entirely | 15 // This class is temporary until BrowserPluginHostTest.* tests are entirely |
16 // moved out of content. | 16 // moved out of content. |
17 class TestGuestManagerDelegate : public BrowserPluginGuestManagerDelegate { | 17 class TestGuestManagerDelegate : public BrowserPluginGuestManagerDelegate { |
18 public: | 18 public: |
19 virtual ~TestGuestManagerDelegate(); | 19 virtual ~TestGuestManagerDelegate(); |
20 | 20 |
21 static TestGuestManagerDelegate* GetInstance(); | 21 static TestGuestManagerDelegate* GetInstance(); |
22 | 22 |
| 23 void AddGuest(int guest_instance_id, WebContents* guest_web_contents); |
| 24 void RemoveGuest(int guest_instance_id); |
| 25 SiteInstance* GetGuestSiteInstance(const GURL& guest_site); |
| 26 |
23 // BrowserPluginGuestManagerDelegate implementation. | 27 // BrowserPluginGuestManagerDelegate implementation. |
| 28 virtual content::WebContents* CreateGuest( |
| 29 content::SiteInstance* embedder_site_instance, |
| 30 int instance_id, |
| 31 const std::string& storage_partition_id, |
| 32 bool persist_storage, |
| 33 scoped_ptr<base::DictionaryValue> extra_params) OVERRIDE; |
24 virtual int GetNextInstanceID() OVERRIDE; | 34 virtual int GetNextInstanceID() OVERRIDE; |
25 virtual void AddGuest(int guest_instance_id, | |
26 WebContents* guest_web_contents) OVERRIDE; | |
27 virtual void RemoveGuest(int guest_instance_id) OVERRIDE; | |
28 virtual void MaybeGetGuestByInstanceIDOrKill( | 35 virtual void MaybeGetGuestByInstanceIDOrKill( |
29 int guest_instance_id, | 36 int guest_instance_id, |
30 int embedder_render_process_id, | 37 int embedder_render_process_id, |
31 const GuestByInstanceIDCallback& callback) OVERRIDE; | 38 const GuestByInstanceIDCallback& callback) OVERRIDE; |
32 virtual SiteInstance* GetGuestSiteInstance( | |
33 const GURL& guest_site) OVERRIDE; | |
34 virtual bool ForEachGuest(WebContents* embedder_web_contents, | 39 virtual bool ForEachGuest(WebContents* embedder_web_contents, |
35 const GuestCallback& callback) OVERRIDE; | 40 const GuestCallback& callback) OVERRIDE; |
36 | 41 |
37 private: | 42 private: |
38 friend struct DefaultSingletonTraits<TestGuestManagerDelegate>; | 43 friend struct DefaultSingletonTraits<TestGuestManagerDelegate>; |
39 TestGuestManagerDelegate(); | 44 TestGuestManagerDelegate(); |
40 // Contains guests' WebContents, mapping from their instance ids. | 45 // Contains guests' WebContents, mapping from their instance ids. |
41 typedef std::map<int, WebContents*> GuestInstanceMap; | 46 typedef std::map<int, WebContents*> GuestInstanceMap; |
42 GuestInstanceMap guest_web_contents_by_instance_id_; | 47 GuestInstanceMap guest_web_contents_by_instance_id_; |
43 | 48 |
44 int next_instance_id_; | 49 int next_instance_id_; |
45 | 50 |
46 DISALLOW_COPY_AND_ASSIGN(TestGuestManagerDelegate); | 51 DISALLOW_COPY_AND_ASSIGN(TestGuestManagerDelegate); |
47 }; | 52 }; |
48 | 53 |
49 } // namespace content | 54 } // namespace content |
50 | 55 |
51 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_TEST_GUEST_MANAGER_DELEGATE_H_ | 56 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_TEST_GUEST_MANAGER_DELEGATE_H_ |
OLD | NEW |