| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/app_list/views/start_page_view.h" | 5 #include "ui/app_list/views/start_page_view.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "content/public/browser/web_contents.h" | 8 #include "content/public/browser/web_contents.h" |
| 9 #include "ui/app_list/app_list_constants.h" | 9 #include "ui/app_list/app_list_constants.h" |
| 10 #include "ui/app_list/app_list_item.h" | 10 #include "ui/app_list/app_list_item.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // The view containing the start page WebContents and the BarPlaceholder. | 87 // The view containing the start page WebContents and the BarPlaceholder. |
| 88 AddChildView(instant_container_); | 88 AddChildView(instant_container_); |
| 89 views::BoxLayout* instant_layout_manager = new views::BoxLayout( | 89 views::BoxLayout* instant_layout_manager = new views::BoxLayout( |
| 90 views::BoxLayout::kVertical, 0, 0, kInstantContainerSpacing); | 90 views::BoxLayout::kVertical, 0, 0, kInstantContainerSpacing); |
| 91 instant_layout_manager->set_main_axis_alignment( | 91 instant_layout_manager->set_main_axis_alignment( |
| 92 views::BoxLayout::MAIN_AXIS_ALIGNMENT_END); | 92 views::BoxLayout::MAIN_AXIS_ALIGNMENT_END); |
| 93 instant_container_->SetLayoutManager(instant_layout_manager); | 93 instant_container_->SetLayoutManager(instant_layout_manager); |
| 94 | 94 |
| 95 content::WebContents* start_page_web_contents = | 95 content::WebContents* start_page_web_contents = |
| 96 view_delegate->GetStartPageContents(); | 96 view_delegate->GetStartPageContents(); |
| 97 views::WebView* web_view = | 97 views::WebView* web_view = new views::WebView( |
| 98 new views::WebView(start_page_web_contents->GetBrowserContext()); | 98 start_page_web_contents ? start_page_web_contents->GetBrowserContext() |
| 99 : NULL); |
| 99 web_view->SetPreferredSize(gfx::Size(kWebViewWidth, kWebViewHeight)); | 100 web_view->SetPreferredSize(gfx::Size(kWebViewWidth, kWebViewHeight)); |
| 100 web_view->SetWebContents(start_page_web_contents); | 101 web_view->SetWebContents(start_page_web_contents); |
| 101 | 102 |
| 102 instant_container_->AddChildView(web_view); | 103 instant_container_->AddChildView(web_view); |
| 103 instant_container_->AddChildView(new BarPlaceholderButton(this)); | 104 instant_container_->AddChildView(new BarPlaceholderButton(this)); |
| 104 | 105 |
| 105 // The view containing the start page tiles. | 106 // The view containing the start page tiles. |
| 106 AddChildView(tiles_container_); | 107 AddChildView(tiles_container_); |
| 107 views::BoxLayout* tiles_layout_manager = | 108 views::BoxLayout* tiles_layout_manager = |
| 108 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, kTileSpacing); | 109 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, kTileSpacing); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 const ui::Event& event) { | 144 const ui::Event& event) { |
| 144 app_list_main_view_->OnStartPageSearchButtonPressed(); | 145 app_list_main_view_->OnStartPageSearchButtonPressed(); |
| 145 instant_container_->SetVisible(false); | 146 instant_container_->SetVisible(false); |
| 146 } | 147 } |
| 147 | 148 |
| 148 void StartPageView::OnProfilesChanged() { | 149 void StartPageView::OnProfilesChanged() { |
| 149 Reset(); | 150 Reset(); |
| 150 } | 151 } |
| 151 | 152 |
| 152 } // namespace app_list | 153 } // namespace app_list |
| OLD | NEW |