| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef UI_MESSAGE_CENTER_COCOA_SETTINGS_CONTROLLER_H_ | |
| 6 #define UI_MESSAGE_CENTER_COCOA_SETTINGS_CONTROLLER_H_ | |
| 7 | |
| 8 #import <Cocoa/Cocoa.h> | |
| 9 | |
| 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" | |
| 16 | |
| 17 @class MCSettingsController; | |
| 18 @class MCTrayViewController; | |
| 19 | |
| 20 namespace message_center { | |
| 21 | |
| 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(); | |
| 28 | |
| 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; | |
| 35 | |
| 36 private: | |
| 37 MCSettingsController* settings_controller_; // weak, owns this | |
| 38 | |
| 39 DISALLOW_COPY_AND_ASSIGN(NotifierSettingsObserverMac); | |
| 40 }; | |
| 41 | |
| 42 } // namespace message_center | |
| 43 | |
| 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. | |
| 51 | |
| 52 // The "Settings" text at the top. | |
| 53 base::scoped_nsobject<NSTextField> settingsText_; | |
| 54 | |
| 55 // The smaller text below the "Settings" text. | |
| 56 base::scoped_nsobject<NSTextField> detailsText_; | |
| 57 | |
| 58 // The profile switcher. | |
| 59 base::scoped_nsobject<MCDropDown> groupDropDownButton_; | |
| 60 | |
| 61 // Container for all the checkboxes. | |
| 62 base::scoped_nsobject<NSScrollView> scrollView_; | |
| 63 | |
| 64 std::vector<message_center::Notifier*> notifiers_; | |
| 65 } | |
| 66 | |
| 67 // Designated initializer. | |
| 68 - (id)initWithProvider:(message_center::NotifierSettingsProvider*)provider | |
| 69 trayViewController:(MCTrayViewController*)trayViewController; | |
| 70 | |
| 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; | |
| 74 | |
| 75 // Handler when a checkbox is enabled/disabled. | |
| 76 - (void)setSettingsNotifier:(message_center::Notifier*)notifier | |
| 77 enabled:(BOOL)enabled; | |
| 78 | |
| 79 // Handler when the learn more link is clicked. | |
| 80 - (void)learnMoreClicked:(message_center::Notifier*)notifier; | |
| 81 | |
| 82 @end | |
| 83 | |
| 84 // Testing API ///////////////////////////////////////////////////////////////// | |
| 85 | |
| 86 @interface MCSettingsController (TestingAPI) | |
| 87 - (NSPopUpButton*)groupDropDownButton; | |
| 88 - (NSScrollView*)scrollView; | |
| 89 @end | |
| 90 | |
| 91 #endif // UI_MESSAGE_CENTER_COCOA_SETTINGS_CONTROLLER_H_ | |
| OLD | NEW |