Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / content_settings / mock_settings_observer.cc
blob71e96094876de9661d2adfde2d36662c4a7e4276
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 "components/content_settings/core/browser/content_settings_details.h"
9 #include "components/content_settings/core/browser/host_content_settings_map.h"
10 #include "url/gurl.h"
12 MockSettingsObserver::MockSettingsObserver(HostContentSettingsMap* map)
13 : map_(map), observer_(this) {
14 observer_.Add(map_);
17 MockSettingsObserver::~MockSettingsObserver() {}
19 void MockSettingsObserver::OnContentSettingChanged(
20 const ContentSettingsPattern& primary_pattern,
21 const ContentSettingsPattern& secondary_pattern,
22 ContentSettingsType content_type,
23 std::string resource_identifier) {
24 const ContentSettingsDetails details(
25 primary_pattern, secondary_pattern, content_type, resource_identifier);
26 OnContentSettingsChanged(map_,
27 details.type(),
28 details.update_all_types(),
29 details.primary_pattern(),
30 details.secondary_pattern(),
31 details.update_all());
32 // This checks that calling a Get function from an observer doesn't
33 // deadlock.
34 GURL url("http://random-hostname.com/");
35 map_->GetContentSetting(
36 url, url, CONTENT_SETTINGS_TYPE_IMAGES, std::string());