Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1462)

Unified Diff: content/renderer/render_frame_impl.h

Issue 2902253003: Refactor UniqueNameHelper to use an adapter pattern for code sharing. (Closed)
Patch Set: Fix off by one bug Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/BUILD.gn ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_frame_impl.h
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
index adf66eed6e52bc7655aa02271d5100046cbf6930..aadcdbadf84c12f528407c6a426d6fee32bfb5b9 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
@@ -37,6 +37,7 @@
#include "content/common/frame_message_enums.h"
#include "content/common/host_zoom.mojom.h"
#include "content/common/renderer.mojom.h"
+#include "content/common/unique_name_helper.h"
#include "content/common/url_loader_factory.mojom.h"
#include "content/public/common/console_message_level.h"
#include "content/public/common/javascript_dialog_type.h"
@@ -48,7 +49,6 @@
#include "content/renderer/frame_blame_context.h"
#include "content/renderer/mojo/blink_interface_provider_impl.h"
#include "content/renderer/renderer_webcookiejar_impl.h"
-#include "content/renderer/unique_name_helper.h"
#include "ipc/ipc_message.h"
#include "ipc/ipc_platform_file.h"
#include "media/base/routing_token_callback.h"
@@ -1167,6 +1167,27 @@ class CONTENT_EXPORT RenderFrameImpl
// |frame_| has been invalidated.
bool is_main_frame_;
+ class UniqueNameFrameAdapter : public UniqueNameHelper::FrameAdapter {
+ public:
+ explicit UniqueNameFrameAdapter(RenderFrameImpl* render_frame);
+ ~UniqueNameFrameAdapter() override;
+
+ // FrameAdapter overrides:
+ bool IsMainFrame() const override;
+ bool IsCandidateUnique(const std::string& name) const override;
+ int GetSiblingCount() const override;
+ int GetChildCount() const override;
+ std::vector<base::StringPiece> CollectAncestorNames(
+ BeginPoint begin_point,
+ bool (*should_stop)(base::StringPiece)) const override;
+ std::vector<int> GetFramePosition(BeginPoint begin_point) const override;
+
+ private:
+ blink::WebLocalFrame* GetWebFrame() const;
+
+ RenderFrameImpl* render_frame_;
+ };
+ UniqueNameFrameAdapter unique_name_frame_adapter_;
UniqueNameHelper unique_name_helper_;
// When a frame is detached in response to a message from the browser process,
« no previous file with comments | « content/renderer/BUILD.gn ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698