Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: chrome/browser/ui/cocoa/media_picker/desktop_media_picker_controller.mm

Issue 2890233003: Dynamically Adjust Screen Item Size According To Item Count (Closed)
Patch Set: Add Size Detection At Init Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/media_picker/desktop_media_picker_controller.mm
diff --git a/chrome/browser/ui/cocoa/media_picker/desktop_media_picker_controller.mm b/chrome/browser/ui/cocoa/media_picker/desktop_media_picker_controller.mm
index 5a660e5ae02eb48254335505ca4a96028680c17b..614b0eb82925e95bcf0ff5954f788f0b75fa467c 100644
--- a/chrome/browser/ui/cocoa/media_picker/desktop_media_picker_controller.mm
+++ b/chrome/browser/ui/cocoa/media_picker/desktop_media_picker_controller.mm
@@ -40,6 +40,8 @@ const CGFloat kThumbnailWidth = 150;
const CGFloat kThumbnailHeight = 150;
const CGFloat kSingleScreenWidth = 300;
const CGFloat kSingleScreenHeight = 300;
+const CGFloat kMultipleScreenWidth = 220;
+const CGFloat kMultipleScreenHeight = 220;
const CGFloat kFramePadding = 20;
const CGFloat kControlSpacing = 10;
const CGFloat kExcessButtonPadding = 6;
@@ -279,9 +281,12 @@ NSString* const kTitleId = @"title";
- (void)createSourceViewsAtOrigin:(NSPoint)origin {
if (screenList_) {
- screenBrowser_.reset([[self
- createImageBrowserWithSize:NSMakeSize(kSingleScreenWidth,
- kSingleScreenHeight)] retain]);
+ const bool is_single = screenList_->GetSourceCount() <= 1;
+ const CGFloat width = is_single ? kSingleScreenWidth : kMultipleScreenWidth;
+ const CGFloat height =
+ is_single ? kSingleScreenHeight : kMultipleScreenHeight;
+ screenBrowser_.reset(
+ [[self createImageBrowserWithSize:NSMakeSize(width, height)] retain]);
}
if (windowList_) {
@@ -601,7 +606,17 @@ NSString* const kTitleId = @"title";
// For screen source, if there is only one source, we can omit the label
// "Entire Screen", because it is redundant with tab label "Your Entire
// Screen".
- [item setTitleHidden:browser == screenBrowser_ && [items count] == 1];
+ if (browser == screenBrowser_) {
+ if ([items count] > 1) {
+ [item setTitleHidden:NO];
+ [screenBrowser_
+ setCellSize:NSMakeSize(kMultipleScreenWidth, kMultipleScreenHeight)];
tapted 2017/05/22 23:54:01 is this still needed? I don't think it should be h
qiangchen 2017/05/23 17:10:14 The list is dynamically updated in another thread,
+ } else {
+ [item setTitleHidden:YES];
+ [screenBrowser_
+ setCellSize:NSMakeSize(kSingleScreenWidth, kSingleScreenHeight)];
+ }
+ }
return item;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698