Index: ui/app_list/views/contents_view.cc |
diff --git a/ui/app_list/views/contents_view.cc b/ui/app_list/views/contents_view.cc |
index 80df04b7628ebd54bb14ff86c8915ce658bfe3e7..71c0af55fcc367edfb5b25703c1f7415b1212a89 100644 |
--- a/ui/app_list/views/contents_view.cc |
+++ b/ui/app_list/views/contents_view.cc |
@@ -16,6 +16,7 @@ |
#include "ui/app_list/views/apps_container_view.h" |
#include "ui/app_list/views/apps_grid_view.h" |
#include "ui/app_list/views/contents_switcher_view.h" |
+#include "ui/app_list/views/search_box_view.h" |
#include "ui/app_list/views/search_result_list_view.h" |
#include "ui/app_list/views/start_page_view.h" |
#include "ui/events/event.h" |
@@ -80,9 +81,6 @@ void ContentsView::InitNamedPages(AppListModel* model, |
page_before_search_ = initial_page_index; |
pagination_model_.SelectPage(initial_page_index, false); |
- |
- // Needed to update the main search box visibility. |
- ActivePageChanged(false); |
} |
void ContentsView::CancelDrag() { |
@@ -216,7 +214,7 @@ void ContentsView::UpdatePageBounds() { |
// Move |current_page| from 0 to its origin. Move |target_page| from its |
// origin to 0. |
- gfx::Rect on_screen(GetContentsBounds()); |
+ gfx::Rect on_screen(GetDefaultContentsBounds()); |
Matt Giuca
2014/10/24 03:21:40
like it.
calamity
2014/10/24 06:13:08
Acknowledged.
|
gfx::Rect current_page_origin(GetOffscreenPageBounds(current_page)); |
gfx::Rect target_page_origin(GetOffscreenPageBounds(target_page)); |
gfx::Rect current_page_rect( |
@@ -266,7 +264,26 @@ int ContentsView::AddLauncherPage(views::View* view, |
return page_index; |
} |
-gfx::Size ContentsView::GetPreferredSize() const { |
+gfx::Rect ContentsView::GetDefaultSearchBoxBounds() const { |
+ gfx::Rect search_box_bounds( |
+ 0, |
+ 0, |
+ GetDefaultContentsSize().width(), |
+ app_list_main_view_->search_box_view()->GetPreferredSize().height()); |
+ if (switches::IsExperimentalAppListEnabled()) { |
+ search_box_bounds.set_y(kExperimentalWindowPadding); |
+ search_box_bounds.Inset(kExperimentalWindowPadding, 0); |
+ } |
+ return search_box_bounds; |
+} |
+ |
+gfx::Rect ContentsView::GetDefaultContentsBounds() const { |
+ gfx::Rect bounds(gfx::Point(0, GetDefaultSearchBoxBounds().bottom()), |
+ GetDefaultContentsSize()); |
+ return bounds; |
+} |
+ |
+gfx::Size ContentsView::GetDefaultContentsSize() const { |
const gfx::Size container_size = |
apps_container_view_->apps_grid_view()->GetPreferredSize(); |
const gfx::Size results_size = search_results_view_ |
@@ -278,6 +295,14 @@ gfx::Size ContentsView::GetPreferredSize() const { |
return gfx::Size(width, height); |
} |
+gfx::Size ContentsView::GetPreferredSize() const { |
+ gfx::Rect search_box_bounds = GetDefaultSearchBoxBounds(); |
+ gfx::Rect default_contents_bounds = GetDefaultContentsBounds(); |
+ return gfx::Size( |
Matt Giuca
2014/10/24 03:21:40
default_contents_bounds.Union(search_box_bounds);
calamity
2014/10/24 06:13:08
Nope. search_box_bounds doesn't have 0, 0 origin.
|
+ std::max(search_box_bounds.right(), default_contents_bounds.right()), |
+ std::max(search_box_bounds.bottom(), default_contents_bounds.bottom())); |
+} |
+ |
void ContentsView::Layout() { |
// Immediately finish all current animations. |
pagination_model_.FinishAnimation(); |
@@ -285,7 +310,7 @@ void ContentsView::Layout() { |
// Move the current view onto the screen, and all other views off screen to |
// the left. (Since we are not animating, we don't need to be careful about |
// which side we place the off-screen views onto.) |
- gfx::Rect rect(GetContentsBounds()); |
+ gfx::Rect rect(GetDefaultContentsBounds()); |
if (rect.IsEmpty()) |
return; |