| 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 #include <memory> |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 | 9 |
| 11 namespace options { | 10 namespace options { |
| 12 | 11 |
| 13 namespace { | 12 namespace { |
| 14 | 13 |
| 15 int CompareMediaException(const MediaException& i, const MediaException& j) { | 14 int CompareMediaException(const MediaException& i, const MediaException& j) { |
| 16 return i.pattern.Compare(j.pattern); | 15 return i.pattern.Compare(j.pattern); |
| 17 } | 16 } |
| 18 | 17 |
| 19 bool MediaExceptionSortFunc(const MediaException& i, const MediaException& j) { | 18 bool MediaExceptionSortFunc(const MediaException& i, const MediaException& j) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } | 50 } |
| 52 return CONTENT_SETTING_DEFAULT; | 51 return CONTENT_SETTING_DEFAULT; |
| 53 } | 52 } |
| 54 | 53 |
| 55 // static | 54 // static |
| 56 void PepperFlashContentSettingsUtils::FlashSiteSettingsToMediaExceptions( | 55 void PepperFlashContentSettingsUtils::FlashSiteSettingsToMediaExceptions( |
| 57 const ppapi::FlashSiteSettings& site_settings, | 56 const ppapi::FlashSiteSettings& site_settings, |
| 58 MediaExceptions* media_exceptions) { | 57 MediaExceptions* media_exceptions) { |
| 59 media_exceptions->clear(); | 58 media_exceptions->clear(); |
| 60 | 59 |
| 61 scoped_ptr<ContentSettingsPattern::BuilderInterface> builder( | 60 std::unique_ptr<ContentSettingsPattern::BuilderInterface> builder( |
| 62 ContentSettingsPattern::CreateBuilder(false)); | 61 ContentSettingsPattern::CreateBuilder(false)); |
| 63 builder->WithSchemeWildcard()->WithPortWildcard(); | 62 builder->WithSchemeWildcard()->WithPortWildcard(); |
| 64 for (ppapi::FlashSiteSettings::const_iterator iter = site_settings.begin(); | 63 for (ppapi::FlashSiteSettings::const_iterator iter = site_settings.begin(); |
| 65 iter != site_settings.end(); ++iter) { | 64 iter != site_settings.end(); ++iter) { |
| 66 builder->WithHost(iter->site); | 65 builder->WithHost(iter->site); |
| 67 | 66 |
| 68 ContentSettingsPattern pattern = builder->Build(); | 67 ContentSettingsPattern pattern = builder->Build(); |
| 69 if (!pattern.IsValid()) | 68 if (!pattern.IsValid()) |
| 70 continue; | 69 continue; |
| 71 | 70 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 } | 121 } |
| 123 while (iter_2 != exceptions_2.end()) { | 122 while (iter_2 != exceptions_2.end()) { |
| 124 if (iter_2->setting != default_exception_1.setting) | 123 if (iter_2->setting != default_exception_1.setting) |
| 125 return false; | 124 return false; |
| 126 ++iter_2; | 125 ++iter_2; |
| 127 } | 126 } |
| 128 return true; | 127 return true; |
| 129 } | 128 } |
| 130 | 129 |
| 131 } // namespace options | 130 } // namespace options |
| OLD | NEW |