| 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 COMPONENTS_GUEST_VIEW_BROWSER_TEST_GUEST_VIEW_MANAGER_H_ | 5 #ifndef COMPONENTS_GUEST_VIEW_BROWSER_TEST_GUEST_VIEW_MANAGER_H_ |
| 6 #define COMPONENTS_GUEST_VIEW_BROWSER_TEST_GUEST_VIEW_MANAGER_H_ | 6 #define COMPONENTS_GUEST_VIEW_BROWSER_TEST_GUEST_VIEW_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/memory/linked_ptr.h" | 8 #include "base/memory/linked_ptr.h" |
| 9 #include "components/guest_view/browser/guest_view_manager.h" | 9 #include "components/guest_view/browser/guest_view_manager.h" |
| 10 #include "components/guest_view/browser/guest_view_manager_factory.h" | 10 #include "components/guest_view/browser/guest_view_manager_factory.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 content::WebContents* GetLastGuestCreated(); | 29 content::WebContents* GetLastGuestCreated(); |
| 30 | 30 |
| 31 // Returns the number of guests currently still alive at the time of calling | 31 // Returns the number of guests currently still alive at the time of calling |
| 32 // this method. | 32 // this method. |
| 33 size_t GetNumGuestsActive() const; | 33 size_t GetNumGuestsActive() const; |
| 34 | 34 |
| 35 // Returns the size of the set of removed instance IDs. | 35 // Returns the size of the set of removed instance IDs. |
| 36 size_t GetNumRemovedInstanceIDs() const; | 36 size_t GetNumRemovedInstanceIDs() const; |
| 37 | 37 |
| 38 using GuestViewCreateFunction = | 38 using GuestViewCreateFunction = |
| 39 base::Callback<GuestViewBase*(content::WebContents*)>;; | 39 base::Callback<GuestViewBase*(content::WebContents*)>; |
| 40 | 40 |
| 41 template <typename T> | 41 template <typename T> |
| 42 void RegisterTestGuestViewType(GuestViewCreateFunction create_function) { | 42 void RegisterTestGuestViewType( |
| 43 guest_view_registry_[T::Type] = create_function; | 43 const GuestViewCreateFunction& create_function) { |
| 44 auto new_entry = std::make_pair(T::Type, GuestViewData( |
| 45 create_function, base::Bind(&T::CleanUp))); |
| 46 guest_view_registry_.insert(new_entry); |
| 44 } | 47 } |
| 45 | 48 |
| 46 // Returns the number of guests that have been created since the creation of | 49 // Returns the number of guests that have been created since the creation of |
| 47 // this GuestViewManager. | 50 // this GuestViewManager. |
| 48 int num_guests_created() const { return num_guests_created_; } | 51 int num_guests_created() const { return num_guests_created_; } |
| 49 | 52 |
| 50 // Returns the number of GuestViews that have been garbage collected in | 53 // Returns the number of GuestViews that have been garbage collected in |
| 51 // JavaScript since the creation of this GuestViewManager. | 54 // JavaScript since the creation of this GuestViewManager. |
| 52 int num_views_garbage_collected() const { | 55 int num_views_garbage_collected() const { |
| 53 return num_views_garbage_collected_; | 56 return num_views_garbage_collected_; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 100 |
| 98 private: | 101 private: |
| 99 TestGuestViewManager* test_guest_view_manager_; | 102 TestGuestViewManager* test_guest_view_manager_; |
| 100 | 103 |
| 101 DISALLOW_COPY_AND_ASSIGN(TestGuestViewManagerFactory); | 104 DISALLOW_COPY_AND_ASSIGN(TestGuestViewManagerFactory); |
| 102 }; | 105 }; |
| 103 | 106 |
| 104 } // namespace guest_view | 107 } // namespace guest_view |
| 105 | 108 |
| 106 #endif // COMPONENTS_GUEST_VIEW_BROWSER_TEST_GUEST_VIEW_MANAGER_H_ | 109 #endif // COMPONENTS_GUEST_VIEW_BROWSER_TEST_GUEST_VIEW_MANAGER_H_ |
| OLD | NEW |