| 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/content_settings/content_setting_image_model.h" | 5 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/ptr_util.h" |
| 8 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 9 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 11 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 11 #include "chrome/browser/prerender/prerender_manager.h" | 12 #include "chrome/browser/prerender/prerender_manager.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/grit/generated_resources.h" | 14 #include "chrome/grit/generated_resources.h" |
| 14 #include "components/content_settings/core/browser/host_content_settings_map.h" | 15 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 15 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 16 #include "grit/theme_resources.h" | 17 #include "grit/theme_resources.h" |
| 17 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 WebContents* web_contents) { | 222 WebContents* web_contents) { |
| 222 if (!web_contents) | 223 if (!web_contents) |
| 223 return; | 224 return; |
| 224 TabSpecificContentSettings* content_settings = | 225 TabSpecificContentSettings* content_settings = |
| 225 TabSpecificContentSettings::FromWebContents(web_contents); | 226 TabSpecificContentSettings::FromWebContents(web_contents); |
| 226 if (content_settings) | 227 if (content_settings) |
| 227 content_settings->SetBlockageHasBeenIndicated(content_type()); | 228 content_settings->SetBlockageHasBeenIndicated(content_type()); |
| 228 } | 229 } |
| 229 | 230 |
| 230 // static | 231 // static |
| 231 scoped_ptr<ContentSettingImageModel> | 232 std::unique_ptr<ContentSettingImageModel> |
| 232 ContentSettingSimpleImageModel::CreateForContentTypeForTesting( | 233 ContentSettingSimpleImageModel::CreateForContentTypeForTesting( |
| 233 ContentSettingsType content_settings_type) { | 234 ContentSettingsType content_settings_type) { |
| 234 if (content_settings_type == CONTENT_SETTINGS_TYPE_GEOLOCATION) | 235 if (content_settings_type == CONTENT_SETTINGS_TYPE_GEOLOCATION) |
| 235 return make_scoped_ptr(new ContentSettingGeolocationImageModel()); | 236 return base::WrapUnique(new ContentSettingGeolocationImageModel()); |
| 236 | 237 |
| 237 if (content_settings_type == CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS) | 238 if (content_settings_type == CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS) |
| 238 return make_scoped_ptr(new ContentSettingRPHImageModel()); | 239 return base::WrapUnique(new ContentSettingRPHImageModel()); |
| 239 | 240 |
| 240 if (content_settings_type == CONTENT_SETTINGS_TYPE_MIDI_SYSEX) | 241 if (content_settings_type == CONTENT_SETTINGS_TYPE_MIDI_SYSEX) |
| 241 return make_scoped_ptr(new ContentSettingMIDISysExImageModel()); | 242 return base::WrapUnique(new ContentSettingMIDISysExImageModel()); |
| 242 | 243 |
| 243 return make_scoped_ptr( | 244 return base::WrapUnique( |
| 244 new ContentSettingBlockedImageModel(content_settings_type)); | 245 new ContentSettingBlockedImageModel(content_settings_type)); |
| 245 } | 246 } |
| 246 | 247 |
| 247 // Generic blocked content settings -------------------------------------------- | 248 // Generic blocked content settings -------------------------------------------- |
| 248 | 249 |
| 249 ContentSettingBlockedImageModel::ContentSettingBlockedImageModel( | 250 ContentSettingBlockedImageModel::ContentSettingBlockedImageModel( |
| 250 ContentSettingsType content_type) | 251 ContentSettingsType content_type) |
| 251 : ContentSettingSimpleImageModel(content_type) { | 252 : ContentSettingSimpleImageModel(content_type) { |
| 252 } | 253 } |
| 253 | 254 |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 result.push_back(new ContentSettingMIDISysExImageModel()); | 570 result.push_back(new ContentSettingMIDISysExImageModel()); |
| 570 | 571 |
| 571 return result; | 572 return result; |
| 572 } | 573 } |
| 573 | 574 |
| 574 void ContentSettingImageModel::SetIconByResourceId(int id) { | 575 void ContentSettingImageModel::SetIconByResourceId(int id) { |
| 575 raster_icon_id_ = id; | 576 raster_icon_id_ = id; |
| 576 raster_icon_ = | 577 raster_icon_ = |
| 577 ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(id); | 578 ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(id); |
| 578 } | 579 } |
| OLD | NEW |