Chromium Code Reviews| 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 EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_FIND_HELPER_H_ | 5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_FIND_HELPER_H_ |
| 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_FIND_HELPER_H_ | 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_FIND_HELPER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 12 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 13 #include "base/values.h" | 14 #include "base/values.h" |
| 14 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
| 15 #include "third_party/WebKit/public/web/WebFindOptions.h" | 16 #include "third_party/WebKit/public/web/WebFindOptions.h" |
| 16 #include "ui/gfx/geometry/rect.h" | 17 #include "ui/gfx/geometry/rect.h" |
| 17 | 18 |
| 18 namespace extensions { | 19 namespace extensions { |
| 19 class WebViewInternalFindFunction; | 20 class WebViewInternalFindFunction; |
| 20 class WebViewGuest; | 21 class WebViewGuest; |
| 21 | 22 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 // Pointer to the webview that is being helped. | 166 // Pointer to the webview that is being helped. |
| 166 WebViewGuest* const webview_guest_; | 167 WebViewGuest* const webview_guest_; |
| 167 | 168 |
| 168 // A counter to generate a unique request id for a find request. | 169 // A counter to generate a unique request id for a find request. |
| 169 // We only need the ids to be unique for a given WebViewGuest. | 170 // We only need the ids to be unique for a given WebViewGuest. |
| 170 int current_find_request_id_; | 171 int current_find_request_id_; |
| 171 | 172 |
| 172 // Stores aggregated find results and other info for the |findupdate| event. | 173 // Stores aggregated find results and other info for the |findupdate| event. |
| 173 scoped_ptr<FindUpdateEvent> find_update_event_; | 174 scoped_ptr<FindUpdateEvent> find_update_event_; |
| 174 | 175 |
| 175 // Pointer to the first request of the current find session. | 176 // Pointer to the first request of the current find session. find_info_map_ |
| 176 linked_ptr<FindInfo> current_find_session_; | 177 // retains ownership. |
| 178 base::WeakPtr<FindInfo> current_find_session_; | |
|
dcheng
2016/01/27 22:18:27
An alternative is to make this a raw pointer, but
| |
| 177 | 179 |
| 178 // Stores each find request's information by request_id so that its callback | 180 // Stores each find request's information by request_id so that its callback |
| 179 // function can be called when its find results are available. | 181 // function can be called when its find results are available. |
| 180 typedef std::map<int, linked_ptr<FindInfo> > FindInfoMap; | 182 using FindInfoMap = std::map<int, scoped_ptr<FindInfo>>; |
| 181 FindInfoMap find_info_map_; | 183 FindInfoMap find_info_map_; |
| 182 | 184 |
| 183 DISALLOW_COPY_AND_ASSIGN(WebViewFindHelper); | 185 DISALLOW_COPY_AND_ASSIGN(WebViewFindHelper); |
| 184 }; | 186 }; |
| 185 | 187 |
| 186 } // namespace extensions | 188 } // namespace extensions |
| 187 | 189 |
| 188 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_FIND_HELPER_H_ | 190 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_FIND_HELPER_H_ |
| OLD | NEW |