1 // Copyright (c) 2013 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.
5 #include "chrome/browser/ui/omnibox/location_bar.h"
7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/common/extensions/manifest_handlers/settings_overrides_handler.h"
10 #include "chrome/common/extensions/manifest_handlers/ui_overrides_handler.h"
11 #include "extensions/browser/extension_registry.h"
12 #include "extensions/common/extension_set.h"
13 #include "extensions/common/feature_switch.h"
14 #include "extensions/common/permissions/permissions_data.h"
17 LocationBar::LocationBar(Profile
* profile
) : profile_(profile
) {
20 LocationBar::~LocationBar() {
23 bool LocationBar::IsBookmarkStarHiddenByExtension() const {
24 const extensions::ExtensionSet
& extension_set
=
25 extensions::ExtensionRegistry::Get(profile_
)->enabled_extensions();
26 for (extensions::ExtensionSet::const_iterator i
= extension_set
.begin();
27 i
!= extension_set
.end(); ++i
) {
28 using extensions::UIOverrides
;
29 using extensions::SettingsOverrides
;
30 const UIOverrides
* ui_overrides
= UIOverrides::Get(i
->get());
31 const SettingsOverrides
* settings_overrides
=
32 SettingsOverrides::Get(i
->get());
33 if (((settings_overrides
&&
34 SettingsOverrides::RemovesBookmarkButton(*settings_overrides
)) ||
36 UIOverrides::RemovesBookmarkButton(*ui_overrides
))) &&
37 (extensions::PermissionsData::HasAPIPermission(
39 extensions::APIPermission::kBookmarkManagerPrivate
) ||
40 extensions::FeatureSwitch::enable_override_bookmarks_ui()->