Disable TabDragController tests that fail with a real compositor.
[chromium-blink-merge.git] / chrome / browser / ui / omnibox / location_bar.cc
blob2ed2870c886dfd3b2c4349154d92942f82d50dba
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/extensions/extension_system.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/common/extensions/manifest_handlers/settings_overrides_handler.h"
11 #include "extensions/common/extension_set.h"
12 #include "extensions/common/feature_switch.h"
13 #include "extensions/common/permissions/permissions_data.h"
16 LocationBar::LocationBar(Profile* profile) : profile_(profile) {
19 LocationBar::~LocationBar() {
22 bool LocationBar::IsBookmarkStarHiddenByExtension() const {
23 const ExtensionService* extension_service =
24 extensions::ExtensionSystem::GetForBrowserContext(
25 profile_)->extension_service();
26 // Extension service may be NULL during unit test execution.
27 if (!extension_service)
28 return false;
30 const extensions::ExtensionSet* extension_set =
31 extension_service->extensions();
32 for (extensions::ExtensionSet::const_iterator i = extension_set->begin();
33 i != extension_set->end(); ++i) {
34 const extensions::SettingsOverrides* settings_overrides =
35 extensions::SettingsOverrides::Get(i->get());
36 if (settings_overrides &&
37 settings_overrides->RequiresHideBookmarkButtonPermission() &&
38 (extensions::PermissionsData::HasAPIPermission(
39 *i,
40 extensions::APIPermission::kBookmarkManagerPrivate) ||
41 extensions::FeatureSwitch::enable_override_bookmarks_ui()->
42 IsEnabled()))
43 return true;
46 return false;