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

Unified Diff: extensions/browser/api/guest_view/web_view/web_view_internal_api.cc

Issue 1056133005: Make WebUI webview content script work with incognito. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webview-content-script-api-from-xi
Patch Set: Created 5 years, 9 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 | « no previous file | extensions/browser/declarative_user_script_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/guest_view/web_view/web_view_internal_api.cc
diff --git a/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc b/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc
index dc116905a801f00c131b5da139c888a1b1be8469..a56ce4d84470f815e77cb86b9234e5c6a9c13318 100644
--- a/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc
+++ b/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc
@@ -7,6 +7,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
+#include "content/public/browser/browser_context.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
@@ -191,6 +192,7 @@ bool Parse(const ContentScriptDetails& script_value,
bool Parse(std::vector<linked_ptr<ContentScriptDetails>> content_script_list,
const extensions::Extension* extension,
const GURL& owner_base_url,
+ bool is_incognito_enabled,
std::map<std::string, UserScript>* result,
std::string* error) {
if (content_script_list.size() == 0)
@@ -201,8 +203,10 @@ bool Parse(std::vector<linked_ptr<ContentScriptDetails>> content_script_list,
UserScript script;
if (!Parse(script_value, extension, owner_base_url, &script, error))
return false;
- else
+ else {
+ script.set_incognito_enabled(is_incognito_enabled);
result->insert(std::pair<std::string, UserScript>(name, script));
+ }
}
return true;
}
@@ -391,11 +395,13 @@ bool WebViewInternalAddContentScriptsFunction::RunAsync() {
return false;
}
+ const bool is_incognito_enabled = browser_context()->IsOffTheRecord();
+
GURL owner_base_url(
render_view_host()->GetSiteInstance()->GetSiteURL().GetWithEmptyPath());
std::map<std::string, UserScript> result;
- if (!Parse(params->content_script_list, extension(), owner_base_url, &result,
- &error_)) {
+ if (!Parse(params->content_script_list, extension(), owner_base_url,
+ is_incognito_enabled, &result, &error_)) {
SendResponse(false);
return false;
}
« no previous file with comments | « no previous file | extensions/browser/declarative_user_script_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698