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

Unified Diff: extensions/renderer/api/automation/automation_api_helper.cc

Issue 2928033002: Move GetDocument method from WebFrame to WebLocalFrame. (Closed)
Patch Set: Split a DCHECK in two as suggested by boliu@. Created 3 years, 6 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/test/layouttest_support.cc ('k') | extensions/renderer/script_context.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/api/automation/automation_api_helper.cc
diff --git a/extensions/renderer/api/automation/automation_api_helper.cc b/extensions/renderer/api/automation/automation_api_helper.cc
index 45c62026f263d18b390e2e183fbcc35dedfefbeb..bcb4ad86f1baf6e488a25dd49e8a77853bcbe23f 100644
--- a/extensions/renderer/api/automation/automation_api_helper.cc
+++ b/extensions/renderer/api/automation/automation_api_helper.cc
@@ -10,7 +10,7 @@
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebElement.h"
#include "third_party/WebKit/public/web/WebExceptionCode.h"
-#include "third_party/WebKit/public/web/WebFrame.h"
+#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebNode.h"
#include "third_party/WebKit/public/web/WebView.h"
@@ -47,8 +47,15 @@ void AutomationApiHelper::OnQuerySelector(int request_id,
routing_id(), request_id, error, 0));
return;
}
- blink::WebDocument document =
- render_view()->GetWebView()->MainFrame()->GetDocument();
+
+ // ExtensionMsg_AutomationQuerySelector should only be sent to an active view.
+ DCHECK(render_view()->GetWebView()->MainFrame()->IsWebLocalFrame());
+
+ blink::WebDocument document = render_view()
+ ->GetWebView()
+ ->MainFrame()
+ ->ToWebLocalFrame()
+ ->GetDocument();
if (document.IsNull()) {
error.value = ExtensionHostMsg_AutomationQuerySelector_Error::kNoDocument;
Send(new ExtensionHostMsg_AutomationQuerySelector_Result(
« no previous file with comments | « content/test/layouttest_support.cc ('k') | extensions/renderer/script_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698