Remove srpcgen-diff test from scons
[chromium-blink-merge.git] / chrome_frame / policy_settings.h
blob8370b47513ff6cb1d4fe51ba6c388a4a7cfdda11
1 // Copyright (c) 2011 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_FRAME_POLICY_SETTINGS_H_
6 #define CHROME_FRAME_POLICY_SETTINGS_H_
8 #include <string>
9 #include <vector>
10 #include "base/memory/singleton.h"
12 #include "base/basictypes.h"
14 // A simple class that reads and caches policy settings for Chrome Frame.
15 // TODO(tommi): Support refreshing when new settings are pushed.
16 // TODO(tommi): Use Chrome's classes for this (and the notification service).
17 class PolicySettings {
18 public:
19 typedef enum RendererForUrl {
20 RENDERER_NOT_SPECIFIED = -1,
21 RENDER_IN_HOST,
22 RENDER_IN_CHROME_FRAME,
25 static PolicySettings* GetInstance();
27 RendererForUrl default_renderer() const {
28 return default_renderer_;
31 RendererForUrl GetRendererForUrl(const wchar_t* url);
33 RendererForUrl GetRendererForContentType(const wchar_t* content_type);
35 // Returns the policy-configured Chrome app locale, or an empty string if none
36 // is configured.
37 const std::wstring& ApplicationLocale() const {
38 return application_locale_;
41 // Helper functions for reading settings from the registry
42 static void ReadUrlSettings(RendererForUrl* default_renderer,
43 std::vector<std::wstring>* renderer_exclusion_list);
44 static void ReadContentTypeSetting(
45 std::vector<std::wstring>* content_type_list);
46 static void ReadApplicationLocaleSetting(std::wstring* application_locale);
48 protected:
49 PolicySettings() : default_renderer_(RENDERER_NOT_SPECIFIED) {
50 RefreshFromRegistry();
53 ~PolicySettings() {
56 // Protected for now since the class is not thread safe.
57 void RefreshFromRegistry();
59 protected:
60 RendererForUrl default_renderer_;
61 std::vector<std::wstring> renderer_exclusion_list_;
62 std::vector<std::wstring> content_type_list_;
63 std::wstring application_locale_;
65 private:
66 // This ensures no construction is possible outside of the class itself.
67 friend struct DefaultSingletonTraits<PolicySettings>;
68 DISALLOW_COPY_AND_ASSIGN(PolicySettings);
71 #endif // CHROME_FRAME_POLICY_SETTINGS_H_