Commit 01549ced authored by jiayl@chromium.org's avatar jiayl@chromium.org

UI adjustments for the HIDE button in the screen share notification window.

The link is not underlined and there is 10px padding between the link and the right edge.

BUG=354893

NOTRY=true

Review URL: https://codereview.chromium.org/208643004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260290 0039d316-1c4b-4281-b951-d872f2087c98
parent d50dd9d9
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
const CGFloat kMinimumWidth = 460; const CGFloat kMinimumWidth = 460;
const CGFloat kMaximumWidth = 1000; const CGFloat kMaximumWidth = 1000;
const CGFloat kHorizontalMargin = 10; const CGFloat kHorizontalMargin = 10;
const CGFloat kPadding = 5; const CGFloat kPaddingVertical = 5;
const CGFloat kPaddingLeft = 10; const CGFloat kPaddingHorizontal = 10;
const CGFloat kWindowCornerRadius = 2; const CGFloat kWindowCornerRadius = 2;
const CGFloat kWindowAlphaValue = 0.85; const CGFloat kWindowAlphaValue = 0.85;
...@@ -140,9 +140,14 @@ scoped_ptr<ScreenCaptureNotificationUI> ScreenCaptureNotificationUI::Create( ...@@ -140,9 +140,14 @@ scoped_ptr<ScreenCaptureNotificationUI> ScreenCaptureNotificationUI::Create(
[stopButton_ sizeToFit]; [stopButton_ sizeToFit];
[content addSubview:stopButton_]; [content addSubview:stopButton_];
minimizeButton_.reset( base::scoped_nsobject<HyperlinkButtonCell> cell(
[[HyperlinkButtonCell buttonWithString:l10n_util::GetNSString( [[HyperlinkButtonCell alloc]
IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON)] retain]); initTextCell:l10n_util::GetNSString(
IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON)]);
[cell setShouldUnderline:NO];
minimizeButton_.reset([[NSButton alloc] initWithFrame:NSZeroRect]);
[minimizeButton_ setCell:cell.get()];
[minimizeButton_ sizeToFit]; [minimizeButton_ sizeToFit];
[minimizeButton_ setTarget:self]; [minimizeButton_ setTarget:self];
[minimizeButton_ setAction:@selector(minimize:)]; [minimizeButton_ setAction:@selector(minimize:)];
...@@ -150,20 +155,21 @@ scoped_ptr<ScreenCaptureNotificationUI> ScreenCaptureNotificationUI::Create( ...@@ -150,20 +155,21 @@ scoped_ptr<ScreenCaptureNotificationUI> ScreenCaptureNotificationUI::Create(
CGFloat buttonsWidth = NSWidth([stopButton_ frame]) + kHorizontalMargin + CGFloat buttonsWidth = NSWidth([stopButton_ frame]) + kHorizontalMargin +
NSWidth([minimizeButton_ frame]); NSWidth([minimizeButton_ frame]);
CGFloat totalHeight = kPadding + NSHeight([stopButton_ frame]) + kPadding; CGFloat totalHeight =
kPaddingVertical + NSHeight([stopButton_ frame]) + kPaddingVertical;
// Create grip icon. // Create grip icon.
base::scoped_nsobject<WindowGripView> gripView([[WindowGripView alloc] init]); base::scoped_nsobject<WindowGripView> gripView([[WindowGripView alloc] init]);
[content addSubview:gripView]; [content addSubview:gripView];
CGFloat gripWidth = NSWidth([gripView frame]); CGFloat gripWidth = NSWidth([gripView frame]);
CGFloat gripHeight = NSHeight([gripView frame]); CGFloat gripHeight = NSHeight([gripView frame]);
[gripView [gripView setFrameOrigin:NSMakePoint(kPaddingHorizontal,
setFrameOrigin:NSMakePoint(kPaddingLeft, (totalHeight - gripHeight) / 2)]; (totalHeight - gripHeight) / 2)];
// Create text label. // Create text label.
int maximumWidth = int maximumWidth =
std::min(kMaximumWidth, NSWidth([[NSScreen mainScreen] visibleFrame])); std::min(kMaximumWidth, NSWidth([[NSScreen mainScreen] visibleFrame]));
int maxLabelWidth = maximumWidth - kPaddingLeft - kPadding - int maxLabelWidth = maximumWidth - kPaddingHorizontal * 2 -
kHorizontalMargin * 2 - gripWidth - buttonsWidth; kHorizontalMargin * 2 - gripWidth - buttonsWidth;
gfx::FontList font_list; gfx::FontList font_list;
base::string16 elidedText = base::string16 elidedText =
...@@ -179,26 +185,26 @@ scoped_ptr<ScreenCaptureNotificationUI> ScreenCaptureNotificationUI::Create( ...@@ -179,26 +185,26 @@ scoped_ptr<ScreenCaptureNotificationUI> ScreenCaptureNotificationUI::Create(
[statusTextField setFont:font_list.GetPrimaryFont().GetNativeFont()]; [statusTextField setFont:font_list.GetPrimaryFont().GetNativeFont()];
[statusTextField sizeToFit]; [statusTextField sizeToFit];
[statusTextField setFrameOrigin:NSMakePoint( [statusTextField setFrameOrigin:NSMakePoint(
kPaddingLeft + kHorizontalMargin + gripWidth, kPaddingHorizontal + kHorizontalMargin + gripWidth,
(totalHeight - NSHeight([statusTextField frame])) / 2)]; (totalHeight - NSHeight([statusTextField frame])) / 2)];
[content addSubview:statusTextField]; [content addSubview:statusTextField];
// Resize content view to fit controls. // Resize content view to fit controls.
CGFloat minimumLableWidth = kMinimumWidth - kPaddingLeft - kPadding - CGFloat minimumLableWidth = kMinimumWidth - kPaddingHorizontal * 2 -
kHorizontalMargin * 2 - gripWidth - buttonsWidth; kHorizontalMargin * 2 - gripWidth - buttonsWidth;
CGFloat lableWidth = CGFloat lableWidth =
std::max(NSWidth([statusTextField frame]), minimumLableWidth); std::max(NSWidth([statusTextField frame]), minimumLableWidth);
CGFloat totalWidth = kPaddingLeft + kPadding + kHorizontalMargin * 2 + CGFloat totalWidth = kPaddingHorizontal * 2 + kHorizontalMargin * 2 +
gripWidth + lableWidth + buttonsWidth; gripWidth + lableWidth + buttonsWidth;
[content setFrame:NSMakeRect(0, 0, totalWidth, totalHeight)]; [content setFrame:NSMakeRect(0, 0, totalWidth, totalHeight)];
// Move the buttons to the right place. // Move the buttons to the right place.
NSPoint buttonOrigin = NSPoint buttonOrigin = NSMakePoint(
NSMakePoint(totalWidth - kPadding - buttonsWidth, kPadding); totalWidth - kPaddingHorizontal - buttonsWidth, kPaddingVertical);
[stopButton_ setFrameOrigin:buttonOrigin]; [stopButton_ setFrameOrigin:buttonOrigin];
[minimizeButton_ setFrameOrigin:NSMakePoint( [minimizeButton_ setFrameOrigin:NSMakePoint(
totalWidth - kPadding - NSWidth([minimizeButton_ frame]), totalWidth - kPaddingHorizontal - NSWidth([minimizeButton_ frame]),
(totalHeight - NSHeight([minimizeButton_ frame])) / 2)]; (totalHeight - NSHeight([minimizeButton_ frame])) / 2)];
if (base::i18n::IsRTL()) { if (base::i18n::IsRTL()) {
......
...@@ -33,9 +33,9 @@ namespace { ...@@ -33,9 +33,9 @@ namespace {
const int kMinimumWidth = 460; const int kMinimumWidth = 460;
const int kMaximumWidth = 1000; const int kMaximumWidth = 1000;
const int kHorizontalMargin = 10; const int kHorizontalMargin = 10;
const int kPadding = 5;
const int kPaddingLeft = 10;
const float kWindowAlphaValue = 0.85f; const float kWindowAlphaValue = 0.85f;
const int kPaddingVertical = 5;
const int kPaddingHorizontal = 10;
namespace { namespace {
...@@ -156,6 +156,7 @@ ScreenCaptureNotificationUIViews::ScreenCaptureNotificationUIViews( ...@@ -156,6 +156,7 @@ ScreenCaptureNotificationUIViews::ScreenCaptureNotificationUIViews(
hide_link_ = new views::Link( hide_link_ = new views::Link(
l10n_util::GetStringUTF16(IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON)); l10n_util::GetStringUTF16(IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON));
hide_link_->set_listener(this); hide_link_->set_listener(this);
hide_link_->SetUnderline(false);
AddChildView(hide_link_); AddChildView(hide_link_);
} }
...@@ -280,7 +281,10 @@ views::NonClientFrameView* ...@@ -280,7 +281,10 @@ views::NonClientFrameView*
ScreenCaptureNotificationUIViews::CreateNonClientFrameView( ScreenCaptureNotificationUIViews::CreateNonClientFrameView(
views::Widget* widget) { views::Widget* widget) {
views::BubbleFrameView* frame = new views::BubbleFrameView( views::BubbleFrameView* frame = new views::BubbleFrameView(
gfx::Insets(kPadding, kPaddingLeft, kPadding, kPadding)); gfx::Insets(kPaddingVertical,
kPaddingHorizontal,
kPaddingVertical,
kPaddingHorizontal));
SkColor color = widget->GetNativeTheme()->GetSystemColor( SkColor color = widget->GetNativeTheme()->GetSystemColor(
ui::NativeTheme::kColorId_DialogBackground); ui::NativeTheme::kColorId_DialogBackground);
frame->SetBubbleBorder(scoped_ptr<views::BubbleBorder>( frame->SetBubbleBorder(scoped_ptr<views::BubbleBorder>(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment