Index: athena/home/athena_start_page_view.cc |
diff --git a/athena/home/athena_start_page_view.cc b/athena/home/athena_start_page_view.cc |
index f15e46b4b5b42eb2576eef78e26bf4839b93c2fb..42262820e0927ea4d4199493ffc13fa270f754c8 100644 |
--- a/athena/home/athena_start_page_view.cc |
+++ b/athena/home/athena_start_page_view.cc |
@@ -40,7 +40,10 @@ const int kWebViewWidth = 500; |
const int kWebViewHeight = 105; |
const int kSearchBoxBorderWidth = 1; |
const int kSearchBoxCornerRadius = 2; |
-const int kSearchBoxWidth = 490; |
+ |
+// The search box spans horizontally over the 6 icons (3 apps icon and 3 control |
+// icons) with margins. |
oshima
2014/08/29 17:47:18
can you update the comment as discussed offline?
Jun Mukai
2014/08/29 18:36:29
Done.
|
+const int kSearchBoxWidth = kIconSize * 6 + kIconMargin * 7; |
const int kSearchBoxHeight = 40; |
class PlaceHolderButton : public views::ImageButton, |
@@ -257,7 +260,10 @@ AthenaStartPageView::LayoutData AthenaStartPageView::CreateBottomBounds( |
state.controls.set_x(width - kIconMargin - state.controls.width()); |
state.controls.set_y(kIconMargin); |
- state.search_box.set_size(search_box_container_->size()); |
+ int search_box_max_width = |
+ state.controls.x() - state.icons.right() - kIconMargin * 2; |
+ state.search_box.set_width(std::min(search_box_max_width, kSearchBoxWidth)); |
+ state.search_box.set_height(search_box_container_->height()); |
state.search_box.set_x((width - state.search_box.width()) / 2); |
state.search_box.set_y((kHomeCardHeight - state.search_box.height()) / 2); |
@@ -270,7 +276,7 @@ AthenaStartPageView::LayoutData AthenaStartPageView::CreateCenteredBounds( |
int width) { |
LayoutData state; |
- state.search_box.set_size(search_box_container_->size()); |
+ state.search_box.set_size(search_box_container_->GetPreferredSize()); |
state.search_box.set_x((width - state.search_box.width()) / 2); |
state.search_box.set_y(logo_->bounds().bottom() + kInstantContainerSpacing); |