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

Side by Side Diff: chrome/browser/extensions/extension_tab_util.cc

Issue 10829186: Tabs API is usable without tabs permission. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_tab_util.h" 5 #include "chrome/browser/extensions/extension_tab_util.h"
6 6
7 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" 7 #include "chrome/browser/extensions/api/tabs/tabs_constants.h"
8 #include "chrome/browser/extensions/tab_helper.h" 8 #include "chrome/browser/extensions/tab_helper.h"
9 #include "chrome/browser/extensions/window_controller.h" 9 #include "chrome/browser/extensions/window_controller.h"
10 #include "chrome/browser/net/url_fixer_upper.h" 10 #include "chrome/browser/net/url_fixer_upper.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 124 }
125 125
126 DictionaryValue* ExtensionTabUtil::CreateTabValueActive( 126 DictionaryValue* ExtensionTabUtil::CreateTabValueActive(
127 const WebContents* contents, 127 const WebContents* contents,
128 bool active) { 128 bool active) {
129 DictionaryValue* result = ExtensionTabUtil::CreateTabValue(contents); 129 DictionaryValue* result = ExtensionTabUtil::CreateTabValue(contents);
130 result->SetBoolean(keys::kSelectedKey, active); 130 result->SetBoolean(keys::kSelectedKey, active);
131 return result; 131 return result;
132 } 132 }
133 133
134 void ExtensionTabUtil::StripTabOfSensitiveData(DictionaryValue* tab) {
135 if (tab->HasKey(keys::kUrlKey))
136 tab->SetString(keys::kUrlKey, std::string());
137 if (tab->HasKey(keys::kTitleKey))
138 tab->SetString(keys::kTitleKey, std::string());
139 if (tab->HasKey(keys::kFaviconUrlKey))
140 tab->SetString(keys::kFaviconUrlKey, std::string());
141 }
142
134 bool ExtensionTabUtil::GetTabStripModel(const WebContents* web_contents, 143 bool ExtensionTabUtil::GetTabStripModel(const WebContents* web_contents,
135 TabStripModel** tab_strip_model, 144 TabStripModel** tab_strip_model,
136 int* tab_index) { 145 int* tab_index) {
137 DCHECK(web_contents); 146 DCHECK(web_contents);
138 DCHECK(tab_strip_model); 147 DCHECK(tab_strip_model);
139 DCHECK(tab_index); 148 DCHECK(tab_index);
140 149
141 for (BrowserList::const_iterator it = BrowserList::begin(); 150 for (BrowserList::const_iterator it = BrowserList::begin();
142 it != BrowserList::end(); ++it) { 151 it != BrowserList::end(); ++it) {
143 TabStripModel* tab_strip = (*it)->tab_strip_model(); 152 TabStripModel* tab_strip = (*it)->tab_strip_model();
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 272
264 // static 273 // static
265 extensions::WindowController* ExtensionTabUtil::GetWindowControllerOfTab( 274 extensions::WindowController* ExtensionTabUtil::GetWindowControllerOfTab(
266 const WebContents* web_contents) { 275 const WebContents* web_contents) {
267 Browser* browser = browser::FindBrowserWithWebContents(web_contents); 276 Browser* browser = browser::FindBrowserWithWebContents(web_contents);
268 if (browser != NULL) 277 if (browser != NULL)
269 return browser->extension_window_controller(); 278 return browser->extension_window_controller();
270 279
271 return NULL; 280 return NULL;
272 } 281 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698