feat: Add OtherItemsProxy TouchBar item (#22270)

* feat: Add OtherItemsProxy touchbar item

* review!
This commit is contained in:
Erick Zhao 2020-02-24 00:55:06 -08:00 committed by GitHub
parent 8cc0435d9c
commit 1848e3f658
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 83 additions and 29 deletions

View file

@ -64,6 +64,8 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
(const std::vector<gin_helper::PersistentDictionary>&)dicts {
NSMutableArray* identifiers = [NSMutableArray array];
bool has_other_items_proxy = false;
if (@available(macOS 10.12.2, *)) {
for (const auto& item : dicts) {
std::string type;
@ -80,6 +82,9 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
} else {
identifier = NSTouchBarItemIdentifierFixedSpaceSmall;
}
} else if (type == "other_items_proxy") {
identifier = NSTouchBarItemIdentifierOtherItemsProxy;
has_other_items_proxy = true;
} else {
identifier = [self identifierFromID:item_id type:type];
}
@ -90,7 +95,8 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
}
}
}
[identifiers addObject:NSTouchBarItemIdentifierOtherItemsProxy];
if (!has_other_items_proxy)
[identifiers addObject:NSTouchBarItemIdentifierOtherItemsProxy];
}
return identifiers;