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 "base/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
6 #include "chrome/browser/chrome_notification_types.h" | 6 #include "chrome/browser/chrome_notification_types.h" |
7 #include "chrome/browser/content_settings/host_content_settings_map.h" | 7 #include "chrome/browser/content_settings/host_content_settings_map.h" |
8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
9 #include "chrome/browser/prerender/prerender_manager.h" | 9 #include "chrome/browser/prerender/prerender_manager.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 content::NotificationService::AllSources()); | 31 content::NotificationService::AllSources()); |
32 } | 32 } |
33 virtual ~NotificationForwarder() {} | 33 virtual ~NotificationForwarder() {} |
34 | 34 |
35 void clear() { | 35 void clear() { |
36 registrar_.RemoveAll(); | 36 registrar_.RemoveAll(); |
37 } | 37 } |
38 | 38 |
39 virtual void Observe(int type, | 39 virtual void Observe(int type, |
40 const content::NotificationSource& source, | 40 const content::NotificationSource& source, |
41 const content::NotificationDetails& details) OVERRIDE { | 41 const content::NotificationDetails& details) override { |
42 if (type == chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED) { | 42 if (type == chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED) { |
43 model_->UpdateFromWebContents( | 43 model_->UpdateFromWebContents( |
44 content::Source<content::WebContents>(source).ptr()); | 44 content::Source<content::WebContents>(source).ptr()); |
45 } | 45 } |
46 } | 46 } |
47 | 47 |
48 private: | 48 private: |
49 content::NotificationRegistrar registrar_; | 49 content::NotificationRegistrar registrar_; |
50 ContentSettingImageModel* model_; | 50 ContentSettingImageModel* model_; |
51 | 51 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 scoped_ptr<ContentSettingImageModel> content_setting_image_model( | 121 scoped_ptr<ContentSettingImageModel> content_setting_image_model( |
122 ContentSettingImageModel::CreateContentSettingImageModel( | 122 ContentSettingImageModel::CreateContentSettingImageModel( |
123 CONTENT_SETTINGS_TYPE_IMAGES)); | 123 CONTENT_SETTINGS_TYPE_IMAGES)); |
124 NotificationForwarder forwarder(content_setting_image_model.get()); | 124 NotificationForwarder forwarder(content_setting_image_model.get()); |
125 // Should not crash. | 125 // Should not crash. |
126 TabSpecificContentSettings::CreateForWebContents(web_contents()); | 126 TabSpecificContentSettings::CreateForWebContents(web_contents()); |
127 forwarder.clear(); | 127 forwarder.clear(); |
128 } | 128 } |
129 | 129 |
130 } // namespace | 130 } // namespace |
OLD | NEW |