OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/webui/options/pepper_flash_content_settings_utils.h" | 5 #include "chrome/browser/ui/webui/options/pepper_flash_content_settings_utils.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 | 10 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 // static | 90 // static |
91 void PepperFlashContentSettingsUtils::SortMediaExceptions( | 91 void PepperFlashContentSettingsUtils::SortMediaExceptions( |
92 MediaExceptions* media_exceptions) { | 92 MediaExceptions* media_exceptions) { |
93 std::sort(media_exceptions->begin(), media_exceptions->end(), | 93 std::sort(media_exceptions->begin(), media_exceptions->end(), |
94 MediaExceptionSortFunc); | 94 MediaExceptionSortFunc); |
95 } | 95 } |
96 | 96 |
97 // static | 97 // static |
98 bool PepperFlashContentSettingsUtils::AreMediaExceptionsEqual( | 98 bool PepperFlashContentSettingsUtils::AreMediaExceptionsEqual( |
99 ContentSetting default_setting_1, | 99 ContentSetting default_audio_setting_1, |
| 100 ContentSetting default_video_setting_1, |
100 const MediaExceptions& exceptions_1, | 101 const MediaExceptions& exceptions_1, |
101 ContentSetting default_setting_2, | 102 ContentSetting default_audio_setting_2, |
| 103 ContentSetting default_video_setting_2, |
102 const MediaExceptions& exceptions_2, | 104 const MediaExceptions& exceptions_2, |
103 bool ignore_audio_setting, | 105 bool ignore_audio_setting, |
104 bool ignore_video_setting) { | 106 bool ignore_video_setting) { |
105 MediaExceptions::const_iterator iter_1 = exceptions_1.begin(); | 107 MediaExceptions::const_iterator iter_1 = exceptions_1.begin(); |
106 MediaExceptions::const_iterator iter_2 = exceptions_2.begin(); | 108 MediaExceptions::const_iterator iter_2 = exceptions_2.begin(); |
107 | 109 |
108 MediaException default_exception_1(ContentSettingsPattern(), | 110 MediaException default_exception_1(ContentSettingsPattern(), |
109 default_setting_1, | 111 default_audio_setting_1, |
110 default_setting_1); | 112 default_video_setting_1); |
111 MediaException default_exception_2(ContentSettingsPattern(), | 113 MediaException default_exception_2(ContentSettingsPattern(), |
112 default_setting_2, | 114 default_audio_setting_2, |
113 default_setting_2); | 115 default_video_setting_2); |
114 | 116 |
115 while (iter_1 != exceptions_1.end() && iter_2 != exceptions_2.end()) { | 117 while (iter_1 != exceptions_1.end() && iter_2 != exceptions_2.end()) { |
116 int compare_result = CompareMediaException(*iter_1, *iter_2); | 118 int compare_result = CompareMediaException(*iter_1, *iter_2); |
117 if (compare_result < 0) { | 119 if (compare_result < 0) { |
118 if (!AreSettingsEqualOrIgnored(*iter_1, default_exception_2, | 120 if (!AreSettingsEqualOrIgnored(*iter_1, default_exception_2, |
119 ignore_audio_setting, | 121 ignore_audio_setting, |
120 ignore_video_setting)) { | 122 ignore_video_setting)) { |
121 return false; | 123 return false; |
122 } | 124 } |
123 ++iter_1; | 125 ++iter_1; |
(...skipping 27 matching lines...) Expand all Loading... |
151 ignore_audio_setting, | 153 ignore_audio_setting, |
152 ignore_video_setting)) { | 154 ignore_video_setting)) { |
153 return false; | 155 return false; |
154 } | 156 } |
155 ++iter_2; | 157 ++iter_2; |
156 } | 158 } |
157 return true; | 159 return true; |
158 } | 160 } |
159 | 161 |
160 } // namespace options | 162 } // namespace options |
OLD | NEW |