Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 | 126 |
| 127 if (tab_strip) { | 127 if (tab_strip) { |
| 128 WebContents* opener = tab_strip->GetOpenerOfWebContentsAt(tab_index); | 128 WebContents* opener = tab_strip->GetOpenerOfWebContentsAt(tab_index); |
| 129 if (opener) | 129 if (opener) |
| 130 result->SetInteger(keys::kOpenerTabIdKey, GetTabId(opener)); | 130 result->SetInteger(keys::kOpenerTabIdKey, GetTabId(opener)); |
| 131 } | 131 } |
| 132 | 132 |
| 133 return result; | 133 return result; |
| 134 } | 134 } |
| 135 | 135 |
| 136 DictionaryValue* ExtensionTabUtil::ScrubTabValue( | |
| 137 const WebContents* contents, | |
| 138 const Extension* extension, | |
| 139 const DictionaryValue* update_info) { | |
| 140 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.
| |
| 141 | |
| 142 // Strip any sensitive data fields out of the update dictionary, if the | |
| 143 // extension does not have the tabs permission. | |
| 144 if (!extension || | |
| 145 !extension->HasAPIPermissionForTab(ExtensionTabUtil::GetTabId(contents), | |
| 146 APIPermission::kTab)) { | |
| 147 scrubbed_info->Remove(keys::kUrlKey, NULL); | |
| 148 scrubbed_info->Remove(keys::kTitleKey, NULL); | |
| 149 scrubbed_info->Remove(keys::kFaviconUrlKey, NULL); | |
| 150 } | |
| 151 | |
| 152 return scrubbed_info; | |
| 153 } | |
|
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?
| |
| 154 | |
| 136 bool ExtensionTabUtil::GetTabStripModel(const WebContents* web_contents, | 155 bool ExtensionTabUtil::GetTabStripModel(const WebContents* web_contents, |
| 137 TabStripModel** tab_strip_model, | 156 TabStripModel** tab_strip_model, |
| 138 int* tab_index) { | 157 int* tab_index) { |
| 139 DCHECK(web_contents); | 158 DCHECK(web_contents); |
| 140 DCHECK(tab_strip_model); | 159 DCHECK(tab_strip_model); |
| 141 DCHECK(tab_index); | 160 DCHECK(tab_index); |
| 142 | 161 |
| 143 for (BrowserList::const_iterator it = BrowserList::begin(); | 162 for (BrowserList::const_iterator it = BrowserList::begin(); |
| 144 it != BrowserList::end(); ++it) { | 163 it != BrowserList::end(); ++it) { |
| 145 TabStripModel* tab_strip = (*it)->tab_strip_model(); | 164 TabStripModel* tab_strip = (*it)->tab_strip_model(); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 267 | 286 |
| 268 // static | 287 // static |
| 269 extensions::WindowController* ExtensionTabUtil::GetWindowControllerOfTab( | 288 extensions::WindowController* ExtensionTabUtil::GetWindowControllerOfTab( |
| 270 const WebContents* web_contents) { | 289 const WebContents* web_contents) { |
| 271 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); | 290 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); |
| 272 if (browser != NULL) | 291 if (browser != NULL) |
| 273 return browser->extension_window_controller(); | 292 return browser->extension_window_controller(); |
| 274 | 293 |
| 275 return NULL; | 294 return NULL; |
| 276 } | 295 } |
| OLD | NEW |