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

Side by Side Diff: chrome/browser/blocked_popup_container.cc

Issue 149145: Add remaining functionality for popup blocker: popup menu to unblock individu... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #include "chrome/browser/blocked_popup_container.h" 5 #include "chrome/browser/blocked_popup_container.h"
6 6
7 #include "chrome/browser/profile.h" 7 #include "chrome/browser/profile.h"
8 #include "chrome/browser/tab_contents/tab_contents.h" 8 #include "chrome/browser/tab_contents/tab_contents.h"
9 #include "chrome/common/pref_names.h" 9 #include "chrome/common/pref_names.h"
10 #include "chrome/common/pref_service.h" 10 #include "chrome/common/pref_service.h"
11 #include "chrome/common/notification_service.h" 11 #include "chrome/common/notification_service.h"
12 12
13 // static 13 // static
14 BlockedPopupContainer* BlockedPopupContainer::Create( 14 BlockedPopupContainer* BlockedPopupContainer::Create(
15 TabContents* owner, Profile* profile) { 15 TabContents* owner, Profile* profile) {
16 BlockedPopupContainer* container = 16 BlockedPopupContainer* container =
17 new BlockedPopupContainer(owner, profile->GetPrefs()); 17 new BlockedPopupContainer(owner, profile->GetPrefs());
18 BlockedPopupContainerView* view = 18 BlockedPopupContainerView* view =
19 BlockedPopupContainerView::Create(container); 19 BlockedPopupContainerView::Create(container);
20 container->set_view(view); 20 container->set_view(view);
21 return container; 21 return container;
22 } 22 }
23 23
24 // static 24 // static
25 BlockedPopupContainer* BlockedPopupContainer::Create(
26 TabContents* owner, Profile* profile, BlockedPopupContainerView* view) {
27 BlockedPopupContainer* container =
28 new BlockedPopupContainer(owner, profile->GetPrefs());
29 container->set_view(view);
30 return container;
31 }
32
33 // static
25 void BlockedPopupContainer::RegisterUserPrefs(PrefService* prefs) { 34 void BlockedPopupContainer::RegisterUserPrefs(PrefService* prefs) {
26 prefs->RegisterListPref(prefs::kPopupWhitelistedHosts); 35 prefs->RegisterListPref(prefs::kPopupWhitelistedHosts);
27 } 36 }
28 37
29 void BlockedPopupContainer::AddTabContents(TabContents* tab_contents, 38 void BlockedPopupContainer::AddTabContents(TabContents* tab_contents,
30 const gfx::Rect& bounds, 39 const gfx::Rect& bounds,
31 const std::string& host) { 40 const std::string& host) {
32 // Show whitelisted popups immediately. 41 // Show whitelisted popups immediately.
33 bool whitelisted = !!whitelist_.count(host); 42 bool whitelisted = !!whitelist_.count(host);
34 if (whitelisted) 43 if (whitelisted)
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 374
366 void BlockedPopupContainer::Observe(NotificationType type, 375 void BlockedPopupContainer::Observe(NotificationType type,
367 const NotificationSource& source, 376 const NotificationSource& source,
368 const NotificationDetails& details) { 377 const NotificationDetails& details) {
369 DCHECK(type == NotificationType::TAB_CONTENTS_DESTROYED); 378 DCHECK(type == NotificationType::TAB_CONTENTS_DESTROYED);
370 TabContents* tab_contents = Source<TabContents>(source).ptr(); 379 TabContents* tab_contents = Source<TabContents>(source).ptr();
371 UnblockedPopups::iterator i(unblocked_popups_.find(tab_contents)); 380 UnblockedPopups::iterator i(unblocked_popups_.find(tab_contents));
372 DCHECK(i != unblocked_popups_.end()); 381 DCHECK(i != unblocked_popups_.end());
373 EraseDataForPopupAndUpdateUI(i); 382 EraseDataForPopupAndUpdateUI(i);
374 } 383 }
OLDNEW
« no previous file with comments | « chrome/browser/blocked_popup_container.h ('k') | chrome/browser/cocoa/blocked_popup_container_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698