root/chrome/browser/ui/omnibox/location_bar.cc

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. IsBookmarkStarHiddenByExtension

// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/omnibox/location_bar.h"

#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/manifest_handlers/settings_overrides_handler.h"
#include "chrome/common/extensions/manifest_handlers/ui_overrides_handler.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension_set.h"
#include "extensions/common/feature_switch.h"
#include "extensions/common/permissions/permissions_data.h"


LocationBar::LocationBar(Profile* profile) : profile_(profile) {
}

LocationBar::~LocationBar() {
}

bool LocationBar::IsBookmarkStarHiddenByExtension() const {
  const extensions::ExtensionSet& extension_set =
      extensions::ExtensionRegistry::Get(profile_)->enabled_extensions();
  for (extensions::ExtensionSet::const_iterator i = extension_set.begin();
       i != extension_set.end(); ++i) {
    using extensions::UIOverrides;
    using extensions::SettingsOverrides;
    const UIOverrides* ui_overrides = UIOverrides::Get(i->get());
    const SettingsOverrides* settings_overrides =
        SettingsOverrides::Get(i->get());
    if (((settings_overrides &&
          SettingsOverrides::RemovesBookmarkButton(*settings_overrides)) ||
         (ui_overrides &&
          UIOverrides::RemovesBookmarkButton(*ui_overrides))) &&
        (extensions::PermissionsData::HasAPIPermission(
            *i,
            extensions::APIPermission::kBookmarkManagerPrivate) ||
         extensions::FeatureSwitch::enable_override_bookmarks_ui()->
             IsEnabled()))
      return true;
  }

  return false;
}

/* [<][>][^][v][top][bottom][index][help] */