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/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "content/public/browser/browser_plugin_guest_manager.h" | 13 #include "content/public/browser/browser_plugin_guest_manager.h" |
14 #include "content/public/browser/site_instance.h" | 14 #include "content/public/browser/site_instance.h" |
15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
16 | 16 |
17 class AppViewGuest; | |
18 class GuestViewBase; | 17 class GuestViewBase; |
19 class GuestViewManagerFactory; | 18 class GuestViewManagerFactory; |
20 class GURL; | 19 class GURL; |
21 | 20 |
22 namespace content { | 21 namespace content { |
23 class BrowserContext; | 22 class BrowserContext; |
24 } // namespace content | 23 } // namespace content |
25 | 24 |
26 namespace guestview { | |
27 class TestGuestViewManager; | |
28 } // namespace guestview | |
29 | |
30 class GuestViewManager : public content::BrowserPluginGuestManager, | 25 class GuestViewManager : public content::BrowserPluginGuestManager, |
31 public base::SupportsUserData::Data { | 26 public base::SupportsUserData::Data { |
32 public: | 27 public: |
33 explicit GuestViewManager(content::BrowserContext* context); | 28 explicit GuestViewManager(content::BrowserContext* context); |
34 virtual ~GuestViewManager(); | 29 virtual ~GuestViewManager(); |
35 | 30 |
36 static GuestViewManager* FromBrowserContext(content::BrowserContext* context); | 31 static GuestViewManager* FromBrowserContext(content::BrowserContext* context); |
37 | 32 |
38 // Overrides factory for testing. Default (NULL) value indicates regular | 33 // Overrides factory for testing. Default (NULL) value indicates regular |
39 // (non-test) environment. | 34 // (non-test) environment. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 66 |
72 // BrowserPluginGuestManager implementation. | 67 // BrowserPluginGuestManager implementation. |
73 virtual void MaybeGetGuestByInstanceIDOrKill( | 68 virtual void MaybeGetGuestByInstanceIDOrKill( |
74 int guest_instance_id, | 69 int guest_instance_id, |
75 int embedder_render_process_id, | 70 int embedder_render_process_id, |
76 const GuestByInstanceIDCallback& callback) OVERRIDE; | 71 const GuestByInstanceIDCallback& callback) OVERRIDE; |
77 virtual bool ForEachGuest(content::WebContents* embedder_web_contents, | 72 virtual bool ForEachGuest(content::WebContents* embedder_web_contents, |
78 const GuestCallback& callback) OVERRIDE; | 73 const GuestCallback& callback) OVERRIDE; |
79 | 74 |
80 protected: | 75 protected: |
81 friend class AppViewGuest; | |
82 friend class GuestViewBase; | 76 friend class GuestViewBase; |
83 friend class guestview::TestGuestViewManager; | |
84 FRIEND_TEST_ALL_PREFIXES(GuestViewManagerTest, AddRemove); | 77 FRIEND_TEST_ALL_PREFIXES(GuestViewManagerTest, AddRemove); |
85 | 78 |
86 // Can be overriden in tests. | 79 // Can be overriden in tests. |
87 virtual void AddGuest(int guest_instance_id, | 80 virtual void AddGuest(int guest_instance_id, |
88 content::WebContents* guest_web_contents); | 81 content::WebContents* guest_web_contents); |
89 | 82 |
90 void RemoveGuest(int guest_instance_id); | 83 void RemoveGuest(int guest_instance_id); |
91 | 84 |
92 content::WebContents* GetGuestByInstanceID(int guest_instance_id); | 85 content::WebContents* GetGuestByInstanceID(int guest_instance_id); |
93 | 86 |
(...skipping 27 matching lines...) Expand all Loading... |
121 // The remaining instance IDs that are greater than | 114 // The remaining instance IDs that are greater than |
122 // |last_instance_id_removed_| are kept here. | 115 // |last_instance_id_removed_| are kept here. |
123 std::set<int> removed_instance_ids_; | 116 std::set<int> removed_instance_ids_; |
124 | 117 |
125 content::BrowserContext* context_; | 118 content::BrowserContext* context_; |
126 | 119 |
127 DISALLOW_COPY_AND_ASSIGN(GuestViewManager); | 120 DISALLOW_COPY_AND_ASSIGN(GuestViewManager); |
128 }; | 121 }; |
129 | 122 |
130 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ | 123 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ |
OLD | NEW |