1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "chrome/browser/ui/location_bar/location_bar.h" 6 7 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/common/extensions/manifest_handlers/ui_overrides_handler.h" 9 #include "extensions/browser/extension_registry.h" 10 #include "extensions/common/extension_set.h" 11 #include "extensions/common/feature_switch.h" 12 #include "extensions/common/permissions/permissions_data.h" 13 14 LocationBar(Profile * profile)15LocationBar::LocationBar(Profile* profile) : profile_(profile) { 16 } 17 ~LocationBar()18LocationBar::~LocationBar() { 19 } 20 IsBookmarkStarHiddenByExtension() const21bool LocationBar::IsBookmarkStarHiddenByExtension() const { 22 const extensions::ExtensionSet& extension_set = 23 extensions::ExtensionRegistry::Get(profile_)->enabled_extensions(); 24 for (extensions::ExtensionSet::const_iterator i = extension_set.begin(); 25 i != extension_set.end(); ++i) { 26 if (extensions::UIOverrides::RemovesBookmarkButton(i->get()) && 27 ((*i)->permissions_data()->HasAPIPermission( 28 extensions::APIPermission::kBookmarkManagerPrivate) || 29 extensions::FeatureSwitch::enable_override_bookmarks_ui() 30 ->IsEnabled())) 31 return true; 32 } 33 34 return false; 35 } 36