1 // Copyright 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 #ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_SETTINGS_OVERRIDES_HANDLER_H_
6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_SETTINGS_OVERRIDES_HANDLER_H_
8 #include "chrome/common/extensions/api/manifest_types.h"
9 #include "extensions/common/extension.h"
10 #include "extensions/common/manifest_handler.h"
12 namespace extensions
{
14 class ManifestPermission
;
16 // SettingsOverride is associated with "chrome_settings_overrides" manifest key.
17 // An extension can add a search engine as default or non-default, overwrite the
18 // homepage and append a startup page to the list.
19 struct SettingsOverrides
: public Extension::ManifestData
{
21 virtual ~SettingsOverrides();
23 static const SettingsOverrides
* Get(const Extension
* extension
);
25 bool RequiresHideBookmarkButtonPermission() const;
27 scoped_ptr
<api::manifest_types::ChromeSettingsOverrides::Bookmarks_ui
>
29 scoped_ptr
<api::manifest_types::ChromeSettingsOverrides::Search_provider
>
31 scoped_ptr
<GURL
> homepage
;
32 std::vector
<GURL
> startup_pages
;
34 scoped_ptr
<ManifestPermission
> manifest_permission
;
37 DISALLOW_COPY_AND_ASSIGN(SettingsOverrides
);
40 class SettingsOverridesHandler
: public ManifestHandler
{
42 SettingsOverridesHandler();
43 virtual ~SettingsOverridesHandler();
45 virtual bool Parse(Extension
* extension
, base::string16
* error
) OVERRIDE
;
46 virtual bool Validate(const Extension
* extension
,
48 std::vector
<InstallWarning
>* warnings
) const OVERRIDE
;
50 virtual ManifestPermission
* CreatePermission() OVERRIDE
;
51 virtual ManifestPermission
* CreateInitialRequiredPermission(
52 const Extension
* extension
) OVERRIDE
;
55 class ManifestPermissionImpl
;
57 virtual const std::vector
<std::string
> Keys() const OVERRIDE
;
59 DISALLOW_COPY_AND_ASSIGN(SettingsOverridesHandler
);
62 } // namespace extensions
63 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_SETTINGS_OVERRIDES_HANDLER_H_