summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-11 19:34:47 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-11 19:34:47 +0000
commit9ea9ca45885eeb653d041a7f828ee8880ae4926a (patch)
treef811d8c7c0417ceac57b6c950d065faea3ab0593 /chrome/browser
parentcbc9ed60c4959214cbbcff09035534e29eaed0db (diff)
downloadchromium_src-9ea9ca45885eeb653d041a7f828ee8880ae4926a.zip
chromium_src-9ea9ca45885eeb653d041a7f828ee8880ae4926a.tar.gz
chromium_src-9ea9ca45885eeb653d041a7f828ee8880ae4926a.tar.bz2
Move all the PrefObserverBridges into namespaces (like is already done with ToolbarController's) so we stop violating the ODR and things start working properly.
BUG=http://crbug.com/37898 TEST=as in bug Review URL: http://codereview.chromium.org/887002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41306 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/cocoa/content_settings_dialog_controller.h6
-rw-r--r--chrome/browser/cocoa/content_settings_dialog_controller.mm19
-rw-r--r--chrome/browser/cocoa/preferences_window_controller.h11
-rw-r--r--chrome/browser/cocoa/preferences_window_controller.mm14
4 files changed, 35 insertions, 15 deletions
diff --git a/chrome/browser/cocoa/content_settings_dialog_controller.h b/chrome/browser/cocoa/content_settings_dialog_controller.h
index 40dceca..246a698 100644
--- a/chrome/browser/cocoa/content_settings_dialog_controller.h
+++ b/chrome/browser/cocoa/content_settings_dialog_controller.h
@@ -9,7 +9,10 @@
#include "chrome/common/content_settings_types.h"
#include "chrome/browser/pref_member.h"
+namespace ContentSettingsDialogControllerInternal {
class PrefObserverBridge;
+}
+
class Profile;
// This controller manages a dialog that lets the user manage the content
@@ -21,7 +24,8 @@ class Profile;
Profile* profile_; // weak
IntegerPrefMember lastSelectedTab_;
BooleanPrefMember clearSiteDataOnExit_;
- scoped_ptr<PrefObserverBridge> observer_; // Watches for pref changes.
+ scoped_ptr<ContentSettingsDialogControllerInternal::PrefObserverBridge>
+ observer_; // Watches for pref changes.
}
// Show the content settings dialog associated with the given profile (or the
diff --git a/chrome/browser/cocoa/content_settings_dialog_controller.mm b/chrome/browser/cocoa/content_settings_dialog_controller.mm
index 2532a44..2af5616 100644
--- a/chrome/browser/cocoa/content_settings_dialog_controller.mm
+++ b/chrome/browser/cocoa/content_settings_dialog_controller.mm
@@ -53,6 +53,8 @@ ContentSettingsDialogController* g_instance = nil;
@property(assign, nonatomic) NSInteger pluginsEnabledIndex;
@end
+namespace ContentSettingsDialogControllerInternal {
+
// A C++ class registered for changes in preferences.
class PrefObserverBridge : public NotificationObserver {
public:
@@ -64,11 +66,12 @@ class PrefObserverBridge : public NotificationObserver {
virtual void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- std::wstring* pref_name = Details<std::wstring>(details).ptr();
- if (type == NotificationType::PREF_CHANGED &&
- *pref_name == prefs::kClearSiteDataOnExit) {
- // Update UI.
- [controller_ setClearSiteDataOnExit:[controller_ clearSiteDataOnExit]];
+ if (type == NotificationType::PREF_CHANGED) {
+ std::wstring* pref_name = Details<std::wstring>(details).ptr();
+ if (*pref_name == prefs::kClearSiteDataOnExit) {
+ // Update UI.
+ [controller_ setClearSiteDataOnExit:[controller_ clearSiteDataOnExit]];
+ }
}
}
@@ -76,6 +79,7 @@ class PrefObserverBridge : public NotificationObserver {
ContentSettingsDialogController* controller_; // weak, owns us
};
+} // ContentSettingsDialogControllerInternal
@implementation ContentSettingsDialogController
@@ -113,9 +117,10 @@ class PrefObserverBridge : public NotificationObserver {
if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
profile_ = profile;
- observer_.reset(new PrefObserverBridge(self));
+ observer_.reset(
+ new ContentSettingsDialogControllerInternal::PrefObserverBridge(self));
clearSiteDataOnExit_.Init(prefs::kClearSiteDataOnExit,
- profile->GetPrefs(), NULL);
+ profile->GetPrefs(), observer_.get());
// We don't need to observe changes in this value.
lastSelectedTab_.Init(prefs::kContentSettingsWindowLastTabIndex,
diff --git a/chrome/browser/cocoa/preferences_window_controller.h b/chrome/browser/cocoa/preferences_window_controller.h
index b064d87..33fce3a 100644
--- a/chrome/browser/cocoa/preferences_window_controller.h
+++ b/chrome/browser/cocoa/preferences_window_controller.h
@@ -9,10 +9,13 @@
#include "chrome/browser/options_window.h"
#include "chrome/browser/pref_member.h"
+namespace PreferencesWindowControllerInternal {
class PersonalDataManagerObserver;
+class PrefObserverBridge;
+}
+
@class CustomHomePagesModel;
@class FontLanguageSettingsController;
-class PrefObserverBridge;
class PrefService;
class Profile;
class ProfileSyncService;
@@ -37,7 +40,8 @@ class ProfileSyncService;
PrefService* prefs_; // weak ref - Obtained from profile_ for convenience.
// weak ref - Also obtained from profile_ for convenience. May be NULL.
ProfileSyncService* syncService_;
- scoped_ptr<PrefObserverBridge> observer_; // Watches for pref changes.
+ scoped_ptr<PreferencesWindowControllerInternal::PrefObserverBridge>
+ observer_; // Watches for pref changes.
IBOutlet NSToolbar* toolbar_;
@@ -82,7 +86,8 @@ class ProfileSyncService;
BooleanPrefMember askSavePasswords_;
BooleanPrefMember formAutofill_;
// Manages PersonalDataManager loading.
- scoped_ptr<PersonalDataManagerObserver> personalDataManagerObserver_;
+ scoped_ptr<PreferencesWindowControllerInternal::PersonalDataManagerObserver>
+ personalDataManagerObserver_;
IBOutlet NSButton* autoFillSettingsButton_;
IBOutlet NSButton* syncButton_;
IBOutlet NSTextField* syncStatus_;
diff --git a/chrome/browser/cocoa/preferences_window_controller.mm b/chrome/browser/cocoa/preferences_window_controller.mm
index 139e453..fcc3fd7 100644
--- a/chrome/browser/cocoa/preferences_window_controller.mm
+++ b/chrome/browser/cocoa/preferences_window_controller.mm
@@ -395,6 +395,8 @@ CGFloat AutoSizeUnderTheHoodContent(NSView* view,
animate:(BOOL)animate;
@end
+namespace PreferencesWindowControllerInternal {
+
// A C++ class registered for changes in preferences. Bridges the
// notification back to the PWC.
class PrefObserverBridge : public NotificationObserver,
@@ -516,6 +518,7 @@ void PersonalDataManagerObserver::ShowAutoFillDialog(
::ShowAutoFillDialog(personal_data_manager, profiles, credit_cards, profile);
}
+} // namespace PreferencesWindowControllerInternal
@implementation PreferencesWindowController
@@ -531,7 +534,8 @@ void PersonalDataManagerObserver::ShowAutoFillDialog(
initialPage_ = initialPage;
prefs_ = profile->GetPrefs();
DCHECK(prefs_);
- observer_.reset(new PrefObserverBridge(self));
+ observer_.reset(
+ new PreferencesWindowControllerInternal::PrefObserverBridge(self));
// Set up the model for the custom home page table. The KVO observation
// tells us when the number of items in the array changes. The normal
@@ -1279,13 +1283,15 @@ const int kDisabledIndex = 1;
if (personalDataManager->IsDataLoaded()) {
// |personalDataManager| data is loaded, we can proceed with the dialog.
- PersonalDataManagerObserver::ShowAutoFillDialog(personalDataManager,
- profile_);
+ PreferencesWindowControllerInternal::
+ PersonalDataManagerObserver::ShowAutoFillDialog(personalDataManager,
+ profile_);
} else {
// |personalDataManager| data is NOT loaded, so we load it here, installing
// our observer.
personalDataManagerObserver_.reset(
- new PersonalDataManagerObserver(personalDataManager, profile_));
+ new PreferencesWindowControllerInternal::PersonalDataManagerObserver(
+ personalDataManager, profile_));
personalDataManager->SetObserver(personalDataManagerObserver_.get());
}
}