base: Change DCHECK_IS_ON to a macro DCHECK_IS_ON().
[chromium-blink-merge.git] / ui / message_center / cocoa / settings_controller.h
blob10a990267ca6b4020e3a3eb1d6ddaf42859b4fb8
1 // Copyright (c) 2013 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 #ifndef UI_MESSAGE_CENTER_COCOA_SETTINGS_CONTROLLER_H_
6 #define UI_MESSAGE_CENTER_COCOA_SETTINGS_CONTROLLER_H_
8 #import <Cocoa/Cocoa.h>
10 #import "base/mac/scoped_nsobject.h"
11 #include "base/memory/scoped_ptr.h"
12 #import "ui/message_center/cocoa/opaque_views.h"
13 #import "ui/message_center/cocoa/settings_entry_view.h"
14 #include "ui/message_center/message_center_export.h"
15 #include "ui/message_center/notifier_settings.h"
17 @class MCSettingsController;
18 @class MCTrayViewController;
20 namespace message_center {
22 // Bridge class between C++ and Cocoa world.
23 class NotifierSettingsObserverMac : public NotifierSettingsObserver {
24 public:
25 NotifierSettingsObserverMac(MCSettingsController* settings_controller)
26 : settings_controller_(settings_controller) {}
27 virtual ~NotifierSettingsObserverMac();
29 // Overridden from NotifierSettingsObserver:
30 void UpdateIconImage(const NotifierId& notifier_id,
31 const gfx::Image& icon) override;
32 void NotifierGroupChanged() override;
33 void NotifierEnabledChanged(const NotifierId& notifier_id,
34 bool enabled) override;
36 private:
37 MCSettingsController* settings_controller_; // weak, owns this
39 DISALLOW_COPY_AND_ASSIGN(NotifierSettingsObserverMac);
42 } // namespace message_center
44 // The view controller responsible for the settings sheet in the center.
45 MESSAGE_CENTER_EXPORT
46 @interface MCSettingsController : NSViewController {
47 @private
48 scoped_ptr<message_center::NotifierSettingsObserverMac> observer_;
49 message_center::NotifierSettingsProvider* provider_;
50 MCTrayViewController* trayViewController_; // Weak. Owns us.
52 // The "Settings" text at the top.
53 base::scoped_nsobject<NSTextField> settingsText_;
55 // The smaller text below the "Settings" text.
56 base::scoped_nsobject<NSTextField> detailsText_;
58 // The profile switcher.
59 base::scoped_nsobject<MCDropDown> groupDropDownButton_;
61 // Container for all the checkboxes.
62 base::scoped_nsobject<NSScrollView> scrollView_;
64 std::vector<message_center::Notifier*> notifiers_;
67 // Designated initializer.
68 - (id)initWithProvider:(message_center::NotifierSettingsProvider*)provider
69 trayViewController:(MCTrayViewController*)trayViewController;
71 // Returns whether |provider_| has an advanced settings handler for the given
72 // notifier; i.e. we should show the "Learn More" button.
73 - (BOOL)notifierHasAdvancedSettings:(const message_center::NotifierId&)id;
75 // Handler when a checkbox is enabled/disabled.
76 - (void)setSettingsNotifier:(message_center::Notifier*)notifier
77 enabled:(BOOL)enabled;
79 // Handler when the learn more link is clicked.
80 - (void)learnMoreClicked:(message_center::Notifier*)notifier;
82 @end
84 // Testing API /////////////////////////////////////////////////////////////////
86 @interface MCSettingsController (TestingAPI)
87 - (NSPopUpButton*)groupDropDownButton;
88 - (NSScrollView*)scrollView;
89 @end
91 #endif // UI_MESSAGE_CENTER_COCOA_SETTINGS_CONTROLLER_H_