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 "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 9 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
10 #include "chrome/browser/extensions/chrome_extension_function.h" | 10 #include "chrome/browser/extensions/chrome_extension_function.h" |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 result->SetInteger(keys::kOpenerTabIdKey, GetTabIdForExtensions(opener)); | 425 result->SetInteger(keys::kOpenerTabIdKey, GetTabIdForExtensions(opener)); |
426 } | 426 } |
427 | 427 |
428 return result; | 428 return result; |
429 } | 429 } |
430 | 430 |
431 void ExtensionTabUtil::ScrubTabValueForExtension( | 431 void ExtensionTabUtil::ScrubTabValueForExtension( |
432 WebContents* contents, | 432 WebContents* contents, |
433 const Extension* extension, | 433 const Extension* extension, |
434 base::DictionaryValue* tab_info) { | 434 base::DictionaryValue* tab_info) { |
435 bool has_permission = extension && | 435 int tab_id = GetTabId(contents); |
| 436 bool has_permission = tab_id >= 0 && extension && |
436 extension->permissions_data()->HasAPIPermissionForTab( | 437 extension->permissions_data()->HasAPIPermissionForTab( |
437 GetTabId(contents), APIPermission::kTab); | 438 tab_id, APIPermission::kTab); |
438 | 439 |
439 if (!has_permission) { | 440 if (!has_permission) { |
440 tab_info->Remove(keys::kUrlKey, NULL); | 441 tab_info->Remove(keys::kUrlKey, NULL); |
441 tab_info->Remove(keys::kTitleKey, NULL); | 442 tab_info->Remove(keys::kTitleKey, NULL); |
442 tab_info->Remove(keys::kFaviconUrlKey, NULL); | 443 tab_info->Remove(keys::kFaviconUrlKey, NULL); |
443 } | 444 } |
444 } | 445 } |
445 | 446 |
446 void ExtensionTabUtil::ScrubTabForExtension(const Extension* extension, | 447 void ExtensionTabUtil::ScrubTabForExtension(const Extension* extension, |
447 api::tabs::Tab* tab) { | 448 api::tabs::Tab* tab) { |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 chrome::ShowSingletonTabOverwritingNTP(browser, params); | 650 chrome::ShowSingletonTabOverwritingNTP(browser, params); |
650 return true; | 651 return true; |
651 } | 652 } |
652 | 653 |
653 // static | 654 // static |
654 bool ExtensionTabUtil::BrowserSupportsTabs(Browser* browser) { | 655 bool ExtensionTabUtil::BrowserSupportsTabs(Browser* browser) { |
655 return browser && browser->tab_strip_model() && !browser->is_devtools(); | 656 return browser && browser->tab_strip_model() && !browser->is_devtools(); |
656 } | 657 } |
657 | 658 |
658 } // namespace extensions | 659 } // namespace extensions |
OLD | NEW |