Index: chrome/browser/guest_view/guest_view_manager.h |
diff --git a/chrome/browser/guest_view/guest_view_manager.h b/chrome/browser/guest_view/guest_view_manager.h |
index df643dc3b093d7d8f10e5ea33d5af08272bf02a1..26117f7f690d290a8cb3c0896c3efffee5c7e4ee 100644 |
--- a/chrome/browser/guest_view/guest_view_manager.h |
+++ b/chrome/browser/guest_view/guest_view_manager.h |
@@ -7,6 +7,7 @@ |
#include <map> |
+#include "base/gtest_prod_util.h" |
#include "base/lazy_instance.h" |
#include "base/macros.h" |
#include "content/public/browser/browser_plugin_guest_manager.h" |
@@ -56,8 +57,11 @@ class GuestViewManager : public content::BrowserPluginGuestManager, |
private: |
friend class GuestViewBase; |
friend class GuestWebContentsObserver; |
+ friend class TestGuestViewManager; |
+ FRIEND_TEST_ALL_PREFIXES(GuestViewManagerTest, AddRemove); |
- void AddGuest(int guest_instance_id, |
+ // Returns true if adding the instance was successful. |
+ bool AddGuest(int guest_instance_id, |
content::WebContents* guest_web_contents); |
void RemoveGuest(int guest_instance_id); |
@@ -89,6 +93,16 @@ class GuestViewManager : public content::BrowserPluginGuestManager, |
GuestInstanceMap guest_web_contents_by_instance_id_; |
int current_instance_id_; |
+ |
+ // Any instance ID whose number not greater than this was removed via |
+ // RemoveGuest. |
+ // This is used so that we don't have store all removed instance IDs in |
+ // |removed_instance_ids_|. |
+ int last_instance_id_removed_; |
+ // The remaining instance IDs that are greater than |
+ // |last_instance_id_removed_| are kept here. |
+ std::set<int> removed_instance_ids_; |
+ |
content::BrowserContext* context_; |
DISALLOW_COPY_AND_ASSIGN(GuestViewManager); |