OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/content_settings/mock_settings_observer.h" | 5 #include "chrome/browser/content_settings/mock_settings_observer.h" |
6 | 6 |
7 #include "chrome/browser/content_settings/content_settings_details.h" | 7 #include "chrome/browser/content_settings/content_settings_details.h" |
8 #include "chrome/browser/content_settings/host_content_settings_map.h" | 8 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 9 #include "chrome/common/chrome_notification_types.h" |
9 #include "content/common/notification_service.h" | 10 #include "content/common/notification_service.h" |
10 #include "content/common/notification_source.h" | 11 #include "content/common/notification_source.h" |
11 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
12 | 13 |
13 MockSettingsObserver::MockSettingsObserver() { | 14 MockSettingsObserver::MockSettingsObserver() { |
14 registrar_.Add(this, NotificationType::CONTENT_SETTINGS_CHANGED, | 15 registrar_.Add(this, chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED, |
15 NotificationService::AllSources()); | 16 NotificationService::AllSources()); |
16 } | 17 } |
17 | 18 |
18 MockSettingsObserver::~MockSettingsObserver() {} | 19 MockSettingsObserver::~MockSettingsObserver() {} |
19 | 20 |
20 void MockSettingsObserver::Observe(NotificationType type, | 21 void MockSettingsObserver::Observe(int type, |
21 const NotificationSource& source, | 22 const NotificationSource& source, |
22 const NotificationDetails& details) { | 23 const NotificationDetails& details) { |
23 HostContentSettingsMap* map = | 24 HostContentSettingsMap* map = |
24 Source<HostContentSettingsMap>(source).ptr(); | 25 Source<HostContentSettingsMap>(source).ptr(); |
25 ContentSettingsDetails* settings_details = | 26 ContentSettingsDetails* settings_details = |
26 Details<ContentSettingsDetails>(details).ptr(); | 27 Details<ContentSettingsDetails>(details).ptr(); |
27 OnContentSettingsChanged(map, | 28 OnContentSettingsChanged(map, |
28 settings_details->type(), | 29 settings_details->type(), |
29 settings_details->update_all_types(), | 30 settings_details->update_all_types(), |
30 settings_details->primary_pattern(), | 31 settings_details->primary_pattern(), |
31 settings_details->secondary_pattern(), | 32 settings_details->secondary_pattern(), |
32 settings_details->update_all()); | 33 settings_details->update_all()); |
33 // This checks that calling a Get function from an observer doesn't | 34 // This checks that calling a Get function from an observer doesn't |
34 // deadlock. | 35 // deadlock. |
35 map->GetContentSettings(GURL("http://random-hostname.com/"), | 36 map->GetContentSettings(GURL("http://random-hostname.com/"), |
36 GURL("http://random-hostname.com/")); | 37 GURL("http://random-hostname.com/")); |
37 } | 38 } |
OLD | NEW |