Index: extensions/browser/guest_view/web_view/web_view_find_helper.h |
diff --git a/extensions/browser/guest_view/web_view/web_view_find_helper.h b/extensions/browser/guest_view/web_view/web_view_find_helper.h |
index 0c622d0c089d1360048ec3184ad0bb8f7e95881d..6ec34e0c71c84e5201e4bd06ba81921d1748efb4 100644 |
--- a/extensions/browser/guest_view/web_view/web_view_find_helper.h |
+++ b/extensions/browser/guest_view/web_view/web_view_find_helper.h |
@@ -9,6 +9,7 @@ |
#include <vector> |
#include "base/macros.h" |
+#include "base/memory/ref_counted.h" |
#include "base/memory/weak_ptr.h" |
#include "base/values.h" |
#include "content/public/browser/web_contents.h" |
@@ -99,13 +100,12 @@ class WebViewFindHelper { |
}; |
// Handles all information about a find request and its results. |
- class FindInfo { |
+ class FindInfo : public base::RefCounted<FindInfo> { |
public: |
FindInfo(int request_id, |
const base::string16& search_text, |
const blink::WebFindOptions& options, |
scoped_refptr<WebViewInternalFindFunction> find_function); |
- ~FindInfo(); |
// Add another request to |find_next_requests_|. |
void AddFindNextRequest(const base::WeakPtr<FindInfo>& request) { |
@@ -141,6 +141,10 @@ class WebViewFindHelper { |
void SendResponse(bool canceled); |
private: |
+ friend class base::RefCounted<FindInfo>; |
+ |
+ ~FindInfo(); |
+ |
const int request_id_; |
const base::string16 search_text_; |
blink::WebFindOptions options_; |
@@ -172,12 +176,13 @@ class WebViewFindHelper { |
// Stores aggregated find results and other info for the |findupdate| event. |
scoped_ptr<FindUpdateEvent> find_update_event_; |
- // Pointer to the first request of the current find session. |
- linked_ptr<FindInfo> current_find_session_; |
+ // Pointer to the first request of the current find session. find_info_map_ |
+ // retains ownership. |
+ scoped_refptr<FindInfo> current_find_session_; |
// Stores each find request's information by request_id so that its callback |
// function can be called when its find results are available. |
- typedef std::map<int, linked_ptr<FindInfo> > FindInfoMap; |
+ using FindInfoMap = std::map<int, scoped_refptr<FindInfo>>; |
FindInfoMap find_info_map_; |
DISALLOW_COPY_AND_ASSIGN(WebViewFindHelper); |