ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / chrome / browser / ui / webui / options / pepper_flash_content_settings_utils.h
blob7d4b3615be3b69dfd779925ca34e5d0cf104d177
1 // Copyright (c) 2012 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_BROWSER_UI_WEBUI_OPTIONS_PEPPER_FLASH_CONTENT_SETTINGS_UTILS_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_PEPPER_FLASH_CONTENT_SETTINGS_UTILS_H_
8 #include <vector>
10 #include "components/content_settings/core/common/content_settings.h"
11 #include "components/content_settings/core/common/content_settings_pattern.h"
12 #include "ppapi/c/private/ppp_flash_browser_operations.h"
13 #include "ppapi/shared_impl/ppp_flash_browser_operations_shared.h"
15 namespace options {
17 struct MediaException {
18 MediaException(const ContentSettingsPattern& in_pattern,
19 ContentSetting in_audio_setting,
20 ContentSetting in_video_setting);
21 ~MediaException();
23 bool operator==(const MediaException& other) const;
25 ContentSettingsPattern pattern;
26 ContentSetting audio_setting;
27 ContentSetting video_setting;
30 typedef std::vector<MediaException> MediaExceptions;
32 class PepperFlashContentSettingsUtils {
33 public:
34 static ContentSetting FlashPermissionToContentSetting(
35 PP_Flash_BrowserOperations_Permission permission);
37 static void FlashSiteSettingsToMediaExceptions(
38 const ppapi::FlashSiteSettings& site_settings,
39 MediaExceptions* media_exceptions);
41 // Sorts |media_exceptions| in ascending order by comparing the |pattern|
42 // field of the elements.
43 static void SortMediaExceptions(MediaExceptions* media_exceptions);
45 // Checks whether |exceptions_1| and |exceptions_2| describe the same set of
46 // exceptions. |exceptions_1| and |exceptions_2| should be sorted by
47 // SortMediaExceptions() before passing into this method.
49 // When an element of |exceptions_1| has a pattern that doesn't match any
50 // element of |exceptions_2|, it would be compared with |default_setting_2|,
51 // and visa versa.
53 // |ignore_audio_setting| and |ignore_video_setting| specify whether to skip
54 // comparison of the |audio_setting| and |video_setting| field of
55 // MediaException, respectively.
56 static bool AreMediaExceptionsEqual(ContentSetting default_setting_1,
57 const MediaExceptions& exceptions_1,
58 ContentSetting default_setting_2,
59 const MediaExceptions& exceptions_2,
60 bool ignore_audio_setting,
61 bool ignore_video_setting);
64 } // namespace options
66 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_PEPPER_FLASH_CONTENT_SETTINGS_UTILS_H_