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

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

Issue 2668693007: [MD Bookmarks] Double Click (Closed)
Patch Set: change the loop and add tab changes Created 3 years, 10 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 new std::string(chrome::GetExtensionIdForMutedTab(contents))); 434 new std::string(chrome::GetExtensionIdForMutedTab(contents)));
435 break; 435 break;
436 } 436 }
437 return info; 437 return info;
438 } 438 }
439 439
440 // static 440 // static
441 void ExtensionTabUtil::ScrubTabForExtension(const Extension* extension, 441 void ExtensionTabUtil::ScrubTabForExtension(const Extension* extension,
442 content::WebContents* contents, 442 content::WebContents* contents,
443 api::tabs::Tab* tab) { 443 api::tabs::Tab* tab) {
444 DCHECK(extension); 444 bool has_permission = false;
445 445 if (extension) {
benwells 2017/02/07 07:13:07 It looks like this change is just making it so thi
jiaxi 2017/02/08 00:04:00 This function removes privacy sensitive fields if
benwells 2017/02/08 00:36:15 Ah right, it isn't equivalent to that snippet I pu
446 bool api_permission = false; 446 bool api_permission = false;
447 std::string url; 447 std::string url;
448 if (contents) { 448 if (contents) {
449 api_permission = extension->permissions_data()->HasAPIPermissionForTab( 449 api_permission = extension->permissions_data()->HasAPIPermissionForTab(
450 GetTabId(contents), APIPermission::kTab); 450 GetTabId(contents), APIPermission::kTab);
451 url = contents->GetURL().spec(); 451 url = contents->GetURL().spec();
452 } else { 452 } else {
453 api_permission = 453 api_permission =
454 extension->permissions_data()->HasAPIPermission(APIPermission::kTab); 454 extension->permissions_data()->HasAPIPermission(APIPermission::kTab);
455 url = *tab->url; 455 url = *tab->url;
456 }
457 bool host_permission = extension->permissions_data()
458 ->active_permissions()
459 .HasExplicitAccessToOrigin(GURL(url));
460 has_permission = api_permission || host_permission;
456 } 461 }
457 bool host_permission = extension->permissions_data()
458 ->active_permissions()
459 .HasExplicitAccessToOrigin(GURL(url));
460 bool has_permission = api_permission || host_permission;
461 if (!has_permission) { 462 if (!has_permission) {
462 tab->url.reset(); 463 tab->url.reset();
463 tab->title.reset(); 464 tab->title.reset();
464 tab->fav_icon_url.reset(); 465 tab->fav_icon_url.reset();
465 } 466 }
466 } 467 }
467 468
468 bool ExtensionTabUtil::GetTabStripModel(const WebContents* web_contents, 469 bool ExtensionTabUtil::GetTabStripModel(const WebContents* web_contents,
469 TabStripModel** tab_strip_model, 470 TabStripModel** tab_strip_model,
470 int* tab_index) { 471 int* tab_index) {
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 chrome::ShowSingletonTabOverwritingNTP(browser, params); 667 chrome::ShowSingletonTabOverwritingNTP(browser, params);
667 return true; 668 return true;
668 } 669 }
669 670
670 // static 671 // static
671 bool ExtensionTabUtil::BrowserSupportsTabs(Browser* browser) { 672 bool ExtensionTabUtil::BrowserSupportsTabs(Browser* browser) {
672 return browser && browser->tab_strip_model() && !browser->is_devtools(); 673 return browser && browser->tab_strip_model() && !browser->is_devtools();
673 } 674 }
674 675
675 } // namespace extensions 676 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/md_bookmarks/item.js » ('j') | chrome/common/extensions/api/_api_features.json » ('J')

Powered by Google App Engine
This is Rietveld 408576698