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

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

Issue 10697017: Tabs Extension: Implementation of tabs.duplicate api. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 4 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
===================================================================
--- chrome/browser/extensions/extension_tab_util.cc (revision 150331)
+++ chrome/browser/extensions/extension_tab_util.cc (working copy)
@@ -83,13 +83,20 @@
DictionaryValue* ExtensionTabUtil::CreateTabValue(const WebContents* contents,
TabStripModel* tab_strip,
int tab_index) {
+ return ExtensionTabUtil::CreateTabValue(contents, tab_strip, tab_index,
+ INCLUDE_PRIVACY_SENSITIVE_FIELDS);
+}
+
+DictionaryValue* ExtensionTabUtil::CreateTabValue(const WebContents* contents,
+ TabStripModel* tab_strip,
+ int tab_index,
+ PrivacyFlags flag) {
DictionaryValue* result = new DictionaryValue();
bool is_loading = contents->IsLoading();
result->SetInteger(keys::kIdKey, ExtensionTabUtil::GetTabId(contents));
result->SetInteger(keys::kIndexKey, tab_index);
result->SetInteger(keys::kWindowIdKey,
ExtensionTabUtil::GetWindowIdOfTab(contents));
- result->SetString(keys::kUrlKey, contents->GetURL().spec());
result->SetString(keys::kStatusKey, GetTabStatusText(is_loading));
result->SetBoolean(keys::kActiveKey,
tab_strip && tab_index == tab_strip->active_index());
@@ -99,7 +106,6 @@
tab_strip && tab_strip->IsTabSelected(tab_index));
result->SetBoolean(keys::kPinnedKey,
tab_strip && tab_strip->IsTabPinned(tab_index));
- result->SetString(keys::kTitleKey, contents->GetTitle());
result->SetBoolean(keys::kIncognitoKey,
contents->GetBrowserContext()->IsOffTheRecord());
@@ -111,12 +117,16 @@
ExtensionTabUtil::GetTabId(opener->GetWebContents()));
}
}
-
- if (!is_loading) {
- NavigationEntry* entry = contents->GetController().GetActiveEntry();
- if (entry) {
- if (entry->GetFavicon().valid)
- result->SetString(keys::kFaviconUrlKey, entry->GetFavicon().url.spec());
+ if (flag == INCLUDE_PRIVACY_SENSITIVE_FIELDS) {
+ result->SetString(keys::kUrlKey, contents->GetURL().spec());
+ result->SetString(keys::kTitleKey, contents->GetTitle());
+ if (!is_loading) {
+ NavigationEntry* entry = contents->GetController().GetActiveEntry();
+ if (entry) {
+ if (entry->GetFavicon().valid)
+ result->SetString(keys::kFaviconUrlKey,
+ entry->GetFavicon().url.spec());
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698