Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: chrome/browser/content_settings/mock_settings_observer.cc

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/common/chrome_notification_types.h"
10 #include "content/common/notification_service.h" 10 #include "content/public/browser/notification_service.h"
11 #include "content/public/browser/notification_source.h" 11 #include "content/public/browser/notification_source.h"
12 #include "googleurl/src/gurl.h" 12 #include "googleurl/src/gurl.h"
13 13
14 MockSettingsObserver::MockSettingsObserver() { 14 MockSettingsObserver::MockSettingsObserver() {
15 registrar_.Add(this, chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED, 15 registrar_.Add(this, chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED,
16 NotificationService::AllSources()); 16 content::NotificationService::AllSources());
17 } 17 }
18 18
19 MockSettingsObserver::~MockSettingsObserver() {} 19 MockSettingsObserver::~MockSettingsObserver() {}
20 20
21 void MockSettingsObserver::Observe( 21 void MockSettingsObserver::Observe(
22 int type, 22 int type,
23 const content::NotificationSource& source, 23 const content::NotificationSource& source,
24 const content::NotificationDetails& details) { 24 const content::NotificationDetails& details) {
25 HostContentSettingsMap* map = 25 HostContentSettingsMap* map =
26 content::Source<HostContentSettingsMap>(source).ptr(); 26 content::Source<HostContentSettingsMap>(source).ptr();
27 ContentSettingsDetails* settings_details = 27 ContentSettingsDetails* settings_details =
28 content::Details<ContentSettingsDetails>(details).ptr(); 28 content::Details<ContentSettingsDetails>(details).ptr();
29 OnContentSettingsChanged(map, 29 OnContentSettingsChanged(map,
30 settings_details->type(), 30 settings_details->type(),
31 settings_details->update_all_types(), 31 settings_details->update_all_types(),
32 settings_details->primary_pattern(), 32 settings_details->primary_pattern(),
33 settings_details->secondary_pattern(), 33 settings_details->secondary_pattern(),
34 settings_details->update_all()); 34 settings_details->update_all());
35 // This checks that calling a Get function from an observer doesn't 35 // This checks that calling a Get function from an observer doesn't
36 // deadlock. 36 // deadlock.
37 map->GetContentSettings(GURL("http://random-hostname.com/"), 37 map->GetContentSettings(GURL("http://random-hostname.com/"),
38 GURL("http://random-hostname.com/")); 38 GURL("http://random-hostname.com/"));
39 } 39 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698