Reland 178902 Implementation of sessionRestore apis.

BUG=14737
TEST=ExtensionApiTest.SessionRestoreApis
[email protected], [email protected]

Review URL: https://chromiumcodereview.appspot.com/10735007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179426 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/extensions/extension_tab_util.cc b/chrome/browser/extensions/extension_tab_util.cc
index 44cc21a..b3c7d5f 100644
--- a/chrome/browser/extensions/extension_tab_util.cc
+++ b/chrome/browser/extensions/extension_tab_util.cc
@@ -26,6 +26,7 @@
 #include "googleurl/src/gurl.h"
 
 namespace keys = extensions::tabs_constants;
+namespace tabs = extensions::api::tabs;
 
 using content::NavigationEntry;
 using content::WebContents;
@@ -139,6 +140,18 @@
   }
 }
 
+void ExtensionTabUtil::ScrubTabForExtension(const Extension* extension,
+                                            tabs::Tab* tab) {
+  bool has_permission = extension && extension->HasAPIPermission(
+      APIPermission::kTab);
+
+  if (!has_permission) {
+    tab->url.reset();
+    tab->title.reset();
+    tab->fav_icon_url.reset();
+  }
+}
+
 bool ExtensionTabUtil::GetTabStripModel(const WebContents* web_contents,
                                         TabStripModel** tab_strip_model,
                                         int* tab_index) {