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

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, 5 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 142698)
+++ chrome/browser/extensions/extension_tab_util.cc (working copy)
@@ -81,13 +81,19 @@
DictionaryValue* ExtensionTabUtil::CreateTabValue(const WebContents* contents,
TabStripModel* tab_strip,
int tab_index) {
+ return ExtensionTabUtil::CreateTabValue(contents, tab_strip, tab_index, true);
+}
+
+DictionaryValue* ExtensionTabUtil::CreateTabValue(const WebContents* contents,
+ TabStripModel* tab_strip,
+ int tab_index,
+ bool hasPermission) {
Aaron Boodman 2012/07/16 21:37:59 You're going to change this because of other comme
SanjoyPal 2012/07/17 10:39:56 Done.
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());
@@ -97,7 +103,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());
@@ -109,12 +114,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 (hasPermission) {
+ 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