Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / chrome / browser / content_settings / mock_settings_observer.cc
blob816914f8b0c4c361f869f1c518588accb126978f
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.
5 #include "chrome/browser/content_settings/mock_settings_observer.h"
7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/content_settings/content_settings_details.h"
9 #include "chrome/browser/content_settings/host_content_settings_map.h"
10 #include "content/public/browser/notification_service.h"
11 #include "content/public/browser/notification_source.h"
12 #include "url/gurl.h"
14 MockSettingsObserver::MockSettingsObserver() {
15 registrar_.Add(this, chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED,
16 content::NotificationService::AllSources());
19 MockSettingsObserver::~MockSettingsObserver() {}
21 void MockSettingsObserver::Observe(
22 int type,
23 const content::NotificationSource& source,
24 const content::NotificationDetails& details) {
25 HostContentSettingsMap* map =
26 content::Source<HostContentSettingsMap>(source).ptr();
27 ContentSettingsDetails* settings_details =
28 content::Details<ContentSettingsDetails>(details).ptr();
29 OnContentSettingsChanged(map,
30 settings_details->type(),
31 settings_details->update_all_types(),
32 settings_details->primary_pattern(),
33 settings_details->secondary_pattern(),
34 settings_details->update_all());
35 // This checks that calling a Get function from an observer doesn't
36 // deadlock.
37 GURL url("http://random-hostname.com/");
38 map->GetContentSetting(url, url, CONTENT_SETTINGS_TYPE_IMAGES, std::string());