| 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/stub_settings_observer.h" | |
| 6 | |
| 7 #include "chrome/browser/content_settings/host_content_settings_map.h" | |
| 8 #include "googleurl/src/gurl.h" | |
| 9 | |
| 10 StubSettingsObserver::StubSettingsObserver() | |
| 11 : last_notifier(NULL), | |
| 12 counter(0) { | |
| 13 registrar_.Add(this, NotificationType::CONTENT_SETTINGS_CHANGED, | |
| 14 NotificationService::AllSources()); | |
| 15 } | |
| 16 | |
| 17 StubSettingsObserver::~StubSettingsObserver() {} | |
| 18 | |
| 19 void StubSettingsObserver::Observe(NotificationType type, | |
| 20 const NotificationSource& source, | |
| 21 const NotificationDetails& details) { | |
| 22 ++counter; | |
| 23 Source<HostContentSettingsMap> content_settings(source); | |
| 24 Details<ContentSettingsDetails> settings_details(details); | |
| 25 last_notifier = content_settings.ptr(); | |
| 26 last_pattern = settings_details.ptr()->pattern(); | |
| 27 last_update_all = settings_details.ptr()->update_all(); | |
| 28 last_update_all_types = settings_details.ptr()->update_all_types(); | |
| 29 last_type = settings_details.ptr()->type(); | |
| 30 // This checks that calling a Get function from an observer doesn't | |
| 31 // deadlock. | |
| 32 last_notifier->GetContentSettings(GURL("http://random-hostname.com/")); | |
| 33 } | |
| OLD | NEW |