1868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Copyright (c) 2013 The Chromium Authors. All rights reserved. 2868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 3868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// found in the LICENSE file. 4868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 5868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#ifndef UI_MESSAGE_CENTER_COCOA_SETTINGS_CONTROLLER_H_ 6868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#define UI_MESSAGE_CENTER_COCOA_SETTINGS_CONTROLLER_H_ 7868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 8868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#import <Cocoa/Cocoa.h> 9868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 10eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch#import "base/mac/scoped_nsobject.h" 11868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/memory/scoped_ptr.h" 120529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch#import "ui/message_center/cocoa/opaque_views.h" 130f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)#import "ui/message_center/cocoa/settings_entry_view.h" 14868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "ui/message_center/message_center_export.h" 15868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "ui/message_center/notifier_settings.h" 16868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 17868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)@class MCSettingsController; 18ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch@class MCTrayViewController; 19868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 20868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)namespace message_center { 21868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 22868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Bridge class between C++ and Cocoa world. 23eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdochclass NotifierSettingsObserverMac : public NotifierSettingsObserver { 24868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) public: 25eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch NotifierSettingsObserverMac(MCSettingsController* settings_controller) 26868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) : settings_controller_(settings_controller) {} 27eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch virtual ~NotifierSettingsObserverMac(); 28868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 29eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // Overridden from NotifierSettingsObserver: 30eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch virtual void UpdateIconImage(const NotifierId& notifier_id, 31868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) const gfx::Image& icon) OVERRIDE; 32bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch virtual void NotifierGroupChanged() OVERRIDE; 33cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void NotifierEnabledChanged(const NotifierId& notifier_id, 34cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) bool enabled) OVERRIDE; 35868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 36868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) private: 37868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) MCSettingsController* settings_controller_; // weak, owns this 38868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 39eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch DISALLOW_COPY_AND_ASSIGN(NotifierSettingsObserverMac); 40868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}; 41868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 42868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)} // namespace message_center 43868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 44868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// The view controller responsible for the settings sheet in the center. 45868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)MESSAGE_CENTER_EXPORT 46868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)@interface MCSettingsController : NSViewController { 47868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) @private 48eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch scoped_ptr<message_center::NotifierSettingsObserverMac> observer_; 49868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) message_center::NotifierSettingsProvider* provider_; 50ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch MCTrayViewController* trayViewController_; // Weak. Owns us. 51868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 52868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // The "Settings" text at the top. 53eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch base::scoped_nsobject<NSTextField> settingsText_; 54868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 55868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // The smaller text below the "Settings" text. 56eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch base::scoped_nsobject<NSTextField> detailsText_; 57868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 58ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch // The profile switcher. 590529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch base::scoped_nsobject<MCDropDown> groupDropDownButton_; 60ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch 61868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // Container for all the checkboxes. 62eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch base::scoped_nsobject<NSScrollView> scrollView_; 63868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 64868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) std::vector<message_center::Notifier*> notifiers_; 65868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)} 66868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 67868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Designated initializer. 68ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch- (id)initWithProvider:(message_center::NotifierSettingsProvider*)provider 69ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch trayViewController:(MCTrayViewController*)trayViewController; 70868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 710f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)// Returns whether |provider_| has an advanced settings handler for the given 720f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)// notifier; i.e. we should show the "Learn More" button. 730f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)- (BOOL)notifierHasAdvancedSettings:(const message_center::NotifierId&)id; 740f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) 750f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)// Handler when a checkbox is enabled/disabled. 760f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)- (void)setSettingsNotifier:(message_center::Notifier*)notifier 770f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) enabled:(BOOL)enabled; 780f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) 790f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)// Handler when the learn more link is clicked. 800f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)- (void)learnMoreClicked:(message_center::Notifier*)notifier; 810f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) 82868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)@end 83868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 84868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Testing API ///////////////////////////////////////////////////////////////// 85868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 86868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)@interface MCSettingsController (TestingAPI) 87ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch- (NSPopUpButton*)groupDropDownButton; 88868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)- (NSScrollView*)scrollView; 89868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)@end 90868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 91868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#endif // UI_MESSAGE_CENTER_COCOA_SETTINGS_CONTROLLER_H_ 92