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

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

Issue 150132: First cut at popup blocking for Mac. Remove ifdefs in cross-platform code. Im... (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/extensions/extension_function_dispatcher.h" 7 #include "chrome/browser/extensions/extension_function_dispatcher.h"
8 #include "chrome/browser/profile.h" 8 #include "chrome/browser/profile.h"
9 #include "chrome/browser/tab_contents/tab_contents.h" 9 #include "chrome/browser/tab_contents/tab_contents.h"
10 #include "chrome/common/pref_names.h" 10 #include "chrome/common/pref_names.h"
11 #include "chrome/common/pref_service.h" 11 #include "chrome/common/pref_service.h"
12 #include "chrome/common/notification_service.h" 12 #include "chrome/common/notification_service.h"
13 13
14 // static 14 // static
15 BlockedPopupContainer* BlockedPopupContainer::Create( 15 BlockedPopupContainer* BlockedPopupContainer::Create(
16 TabContents* owner, Profile* profile) { 16 TabContents* owner, Profile* profile) {
17 BlockedPopupContainer* container = 17 BlockedPopupContainer* container =
18 new BlockedPopupContainer(owner, profile->GetPrefs()); 18 new BlockedPopupContainer(owner, profile->GetPrefs());
19
20 // TODO(port): This ifdef goes away once Mac peeps write a Cocoa
21 // implementation of BlockedPopupContainerView.
22 #if defined(OS_WIN) || defined(OS_LINUX)
23 BlockedPopupContainerView* view = 19 BlockedPopupContainerView* view =
24 BlockedPopupContainerView::Create(container); 20 BlockedPopupContainerView::Create(container);
25 container->set_view(view); 21 container->set_view(view);
26 #endif
27
28 return container; 22 return container;
29 } 23 }
30 24
31 // static 25 // static
32 void BlockedPopupContainer::RegisterUserPrefs(PrefService* prefs) { 26 void BlockedPopupContainer::RegisterUserPrefs(PrefService* prefs) {
33 prefs->RegisterListPref(prefs::kPopupWhitelistedHosts); 27 prefs->RegisterListPref(prefs::kPopupWhitelistedHosts);
34 } 28 }
35 29
36 void BlockedPopupContainer::AddTabContents(TabContents* tab_contents, 30 void BlockedPopupContainer::AddTabContents(TabContents* tab_contents,
37 const gfx::Rect& bounds, 31 const gfx::Rect& bounds,
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 372
379 void BlockedPopupContainer::Observe(NotificationType type, 373 void BlockedPopupContainer::Observe(NotificationType type,
380 const NotificationSource& source, 374 const NotificationSource& source,
381 const NotificationDetails& details) { 375 const NotificationDetails& details) {
382 DCHECK(type == NotificationType::TAB_CONTENTS_DESTROYED); 376 DCHECK(type == NotificationType::TAB_CONTENTS_DESTROYED);
383 TabContents* tab_contents = Source<TabContents>(source).ptr(); 377 TabContents* tab_contents = Source<TabContents>(source).ptr();
384 UnblockedPopups::iterator i(unblocked_popups_.find(tab_contents)); 378 UnblockedPopups::iterator i(unblocked_popups_.find(tab_contents));
385 DCHECK(i != unblocked_popups_.end()); 379 DCHECK(i != unblocked_popups_.end());
386 EraseDataForPopupAndUpdateUI(i); 380 EraseDataForPopupAndUpdateUI(i);
387 } 381 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698