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

Unified Diff: chrome/browser/extensions/api/webview/webview_api.cc

Issue 226043005: Fix webview.executeScript API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make use of GURL. Created 6 years, 8 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
Index: chrome/browser/extensions/api/webview/webview_api.cc
diff --git a/chrome/browser/extensions/api/webview/webview_api.cc b/chrome/browser/extensions/api/webview/webview_api.cc
index 7879c3be8040a3997c9c7c2f4a52485e388e5f7f..f9ec2d2ee225faae01c1d51f95ac107832de2f74 100644
--- a/chrome/browser/extensions/api/webview/webview_api.cc
+++ b/chrome/browser/extensions/api/webview/webview_api.cc
@@ -263,8 +263,17 @@ bool WebviewExecuteCodeFunction::Init() {
if (!guest_instance_id_)
return false;
+ std::string src;
+ if (!args_->GetString(1, &src))
+ return false;
+
+ guest_src_ = GURL(src);
+
+ if (guest_src_.is_empty())
Fady Samuel 2014/04/07 20:39:34 if (guest_src_.is_empty() || guest_src_.invalid())
not at google - send to devlin 2014/04/07 20:43:18 I think that empty implies invalid.
Fady Samuel 2014/04/07 20:44:12 Perhaps then if (guest_src_.invalid())?
not at google - send to devlin 2014/04/07 21:00:07 It would be if (!guest_src_.is_valid()) return
Xi Han 2014/04/07 21:03:37 Done.
Xi Han 2014/04/07 21:03:37 Done.
Xi Han 2014/04/07 21:03:37 Done.
Xi Han 2014/04/07 21:03:37 Done.
Xi Han 2014/04/07 21:03:37 It makes sense to me, invalide() (actually !guest_
Xi Han 2014/04/07 21:09:44 Thx for checking the real method name. On 2014/04
+ return false;
+
base::DictionaryValue* details_value = NULL;
- if (!args_->GetDictionary(1, &details_value))
+ if (!args_->GetDictionary(2, &details_value))
return false;
scoped_ptr<InjectDetails> details(new InjectDetails());
if (!InjectDetails::Populate(*details_value, details.get()))
@@ -295,6 +304,8 @@ bool WebviewExecuteCodeFunction::IsWebView() const {
return true;
}
+GURL WebviewExecuteCodeFunction::GetWebViewSrc() const { return guest_src_; }
+
WebviewExecuteScriptFunction::WebviewExecuteScriptFunction() {
}

Powered by Google App Engine
This is Rietveld 408576698