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