Store ordered settings in AtomTouchBar

This commit is contained in:
Kevin Sawicki 2017-03-01 15:26:10 -08:00
parent 5f9e9d4b36
commit 708ed9d1cd
4 changed files with 15 additions and 18 deletions

View file

@ -353,7 +353,7 @@ bool ScopedDisableResize::disable_resize_ = false;
- (void)setShell:(atom::NativeWindowMac*)shell;
- (void)setEnableLargerThanScreen:(bool)enable;
- (void)enableWindowButtonsOffset;
- (void)resetTouchBar;
- (void)resetTouchBar:(const std::vector<mate::PersistentDictionary>&)settings;
- (void)refreshTouchBarItem:(const std::string&)item_id;
@end
@ -368,7 +368,10 @@ bool ScopedDisableResize::disable_resize_ = false;
enable_larger_than_screen_ = enable;
}
- (void)resetTouchBar {
- (void)resetTouchBar:(const std::vector<mate::PersistentDictionary>&)settings {
atom_touch_bar_.reset([[AtomTouchBar alloc] initWithDelegate:self
window:shell_
settings:settings]);
self.touchBar = nil;
}
@ -377,8 +380,7 @@ bool ScopedDisableResize::disable_resize_ = false;
}
- (NSTouchBar*)makeTouchBar {
atom_touch_bar_.reset([[AtomTouchBar alloc] initWithDelegate:self window:shell_]);
return [atom_touch_bar_ makeTouchBarFromSettings:shell_->GetTouchBarItems()];
return [atom_touch_bar_ makeTouchBar];
}
- (nullable NSTouchBarItem*)touchBar:(NSTouchBar*)touchBar
@ -1374,18 +1376,13 @@ void NativeWindowMac::SetVibrancy(const std::string& type) {
void NativeWindowMac::SetTouchBar(
const std::vector<mate::PersistentDictionary>& items) {
touch_bar_items_ = items;
[window_ resetTouchBar];
[window_ resetTouchBar:items];
}
void NativeWindowMac::RefreshTouchBarItem(const std::string& item_id) {
[window_ refreshTouchBarItem:item_id];
}
std::vector<mate::PersistentDictionary> NativeWindowMac::GetTouchBarItems() {
return touch_bar_items_;
}
void NativeWindowMac::OnInputEvent(const blink::WebInputEvent& event) {
switch (event.type) {
case blink::WebInputEvent::GestureScrollBegin: