Commit 246205e6 authored by sadrul's avatar sadrul Committed by Commit bot

mandoline/omnibox: Add some opacity.

Add a black translucent background for the omnibox app.

BUG=487423

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

Cr-Commit-Position: refs/heads/master@{#330130}
parent 3f977d1e
...@@ -59,9 +59,11 @@ void OmniboxImpl::OnEmbed(mojo::View* root, ...@@ -59,9 +59,11 @@ void OmniboxImpl::OnEmbed(mojo::View* root,
edit_->set_controller(this); edit_->set_controller(this);
} }
const int kOpacity = 0xC0;
views::WidgetDelegateView* widget_delegate = new views::WidgetDelegateView; views::WidgetDelegateView* widget_delegate = new views::WidgetDelegateView;
widget_delegate->GetContentsView()->set_background( widget_delegate->GetContentsView()->set_background(
views::Background::CreateSolidBackground(0xFFDDDDDD)); views::Background::CreateSolidBackground(
SkColorSetA(0xDDDDDD, kOpacity)));
widget_delegate->GetContentsView()->AddChildView(edit_); widget_delegate->GetContentsView()->AddChildView(edit_);
widget_delegate->GetContentsView()->SetLayoutManager(this); widget_delegate->GetContentsView()->SetLayoutManager(this);
...@@ -74,8 +76,11 @@ void OmniboxImpl::OnEmbed(mojo::View* root, ...@@ -74,8 +76,11 @@ void OmniboxImpl::OnEmbed(mojo::View* root,
new NativeWidgetViewManager(widget, app_impl_->shell(), root); new NativeWidgetViewManager(widget, app_impl_->shell(), root);
params.delegate = widget_delegate; params.delegate = widget_delegate;
params.bounds = root->bounds().To<gfx::Rect>(); params.bounds = root->bounds().To<gfx::Rect>();
params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
widget->Init(params); widget->Init(params);
widget->Show(); widget->Show();
widget->GetCompositor()->SetBackgroundColor(
SkColorSetA(SK_ColorBLACK, kOpacity));
root->SetFocus(); root->SetFocus();
edit_->SetText(url_.To<base::string16>()); edit_->SetText(url_.To<base::string16>());
edit_->SelectAll(false); edit_->SelectAll(false);
......
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