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

Unified Diff: chrome/browser/extensions/extension_tab_util.cc

Issue 11824004: Do not pass URLs in onUpdated events to extensions unless they have the (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 11 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/extension_tab_util.cc
diff --git a/chrome/browser/extensions/extension_tab_util.cc b/chrome/browser/extensions/extension_tab_util.cc
index 1ebe3af4a2e779be5ce682219100f6967218cd0e..1f9a7f136487956bff23d0e5e4750a61ebdf13db 100644
--- a/chrome/browser/extensions/extension_tab_util.cc
+++ b/chrome/browser/extensions/extension_tab_util.cc
@@ -133,6 +133,25 @@ DictionaryValue* ExtensionTabUtil::CreateTabValue(
return result;
}
+DictionaryValue* ExtensionTabUtil::ScrubTabValue(
+ const WebContents* contents,
+ const Extension* extension,
+ const DictionaryValue* update_info) {
+ DictionaryValue* scrubbed_info = update_info->DeepCopy();
not at google - send to devlin 2013/01/08 21:25:09 it doesn't seem necessary to return a copy here; w
mvrable 2013/01/09 01:46:59 Done.
+
+ // Strip any sensitive data fields out of the update dictionary, if the
+ // extension does not have the tabs permission.
+ if (!extension ||
+ !extension->HasAPIPermissionForTab(ExtensionTabUtil::GetTabId(contents),
+ APIPermission::kTab)) {
+ scrubbed_info->Remove(keys::kUrlKey, NULL);
+ scrubbed_info->Remove(keys::kTitleKey, NULL);
+ scrubbed_info->Remove(keys::kFaviconUrlKey, NULL);
+ }
+
+ return scrubbed_info;
+}
not at google - send to devlin 2013/01/08 21:25:09 It would be nice to avoid the duplication here and
mvrable 2013/01/09 01:46:59 Done, I think: do these changes look reasonable?
+
bool ExtensionTabUtil::GetTabStripModel(const WebContents* web_contents,
TabStripModel** tab_strip_model,
int* tab_index) {

Powered by Google App Engine
This is Rietveld 408576698