Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Side by Side Diff: ui/app_list/views/search_result_page_view.cc

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/search_result_page_view.h" 5 #include "ui/app_list/views/search_result_page_view.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "base/memory/ptr_util.h"
11 #include "ui/app_list/app_list_constants.h" 12 #include "ui/app_list/app_list_constants.h"
12 #include "ui/app_list/app_list_switches.h" 13 #include "ui/app_list/app_list_switches.h"
13 #include "ui/app_list/app_list_view_delegate.h" 14 #include "ui/app_list/app_list_view_delegate.h"
14 #include "ui/app_list/views/app_list_main_view.h" 15 #include "ui/app_list/views/app_list_main_view.h"
15 #include "ui/app_list/views/search_box_view.h" 16 #include "ui/app_list/views/search_box_view.h"
16 #include "ui/app_list/views/search_result_list_view.h" 17 #include "ui/app_list/views/search_result_list_view.h"
17 #include "ui/app_list/views/search_result_tile_item_list_view.h" 18 #include "ui/app_list/views/search_result_tile_item_list_view.h"
18 #include "ui/gfx/shadow_value.h" 19 #include "ui/gfx/shadow_value.h"
19 #include "ui/views/background.h" 20 #include "ui/views/background.h"
20 #include "ui/views/layout/box_layout.h" 21 #include "ui/views/layout/box_layout.h"
21 #include "ui/views/layout/fill_layout.h" 22 #include "ui/views/layout/fill_layout.h"
22 #include "ui/views/shadow_border.h" 23 #include "ui/views/shadow_border.h"
23 24
24 namespace app_list { 25 namespace app_list {
25 26
26 namespace { 27 namespace {
27 28
28 const int kGroupSpacing = 6; 29 const int kGroupSpacing = 6;
29 const int kTopPadding = 8; 30 const int kTopPadding = 8;
30 31
31 // The z-height of the search box and cards in this view. 32 // The z-height of the search box and cards in this view.
32 const int kSearchResultZHeight = 1; 33 const int kSearchResultZHeight = 1;
33 34
34 // A container view that ensures the card background and the shadow are painted 35 // A container view that ensures the card background and the shadow are painted
35 // in the correct order. 36 // in the correct order.
36 class SearchCardView : public views::View { 37 class SearchCardView : public views::View {
37 public: 38 public:
38 explicit SearchCardView(views::View* content_view) { 39 explicit SearchCardView(views::View* content_view) {
39 SetBorder(make_scoped_ptr( 40 SetBorder(base::WrapUnique(
40 new views::ShadowBorder(GetShadowForZHeight(kSearchResultZHeight)))); 41 new views::ShadowBorder(GetShadowForZHeight(kSearchResultZHeight))));
41 SetLayoutManager(new views::FillLayout()); 42 SetLayoutManager(new views::FillLayout());
42 content_view->set_background( 43 content_view->set_background(
43 views::Background::CreateSolidBackground(kCardBackgroundColor)); 44 views::Background::CreateSolidBackground(kCardBackgroundColor));
44 AddChildView(content_view); 45 AddChildView(content_view);
45 } 46 }
46 47
47 ~SearchCardView() override {} 48 ~SearchCardView() override {}
48 }; 49 };
49 50
50 } // namespace 51 } // namespace
51 52
52 SearchResultPageView::SearchResultPageView() : selected_index_(0) { 53 SearchResultPageView::SearchResultPageView() : selected_index_(0) {
53 if (switches::IsExperimentalAppListEnabled()) { 54 if (switches::IsExperimentalAppListEnabled()) {
54 gfx::ShadowValue shadow = GetShadowForZHeight(kSearchResultZHeight); 55 gfx::ShadowValue shadow = GetShadowForZHeight(kSearchResultZHeight);
55 scoped_ptr<views::Border> border(new views::ShadowBorder(shadow)); 56 std::unique_ptr<views::Border> border(new views::ShadowBorder(shadow));
56 57
57 gfx::Insets insets = gfx::Insets(kTopPadding, kExperimentalSearchBoxPadding, 58 gfx::Insets insets = gfx::Insets(kTopPadding, kExperimentalSearchBoxPadding,
58 0, kExperimentalSearchBoxPadding); 59 0, kExperimentalSearchBoxPadding);
59 insets += -border->GetInsets(); 60 insets += -border->GetInsets();
60 61
61 views::BoxLayout* layout = 62 views::BoxLayout* layout =
62 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, kGroupSpacing); 63 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, kGroupSpacing);
63 layout->set_inside_border_insets(insets); 64 layout->set_inside_border_insets(insets);
64 65
65 SetLayoutManager(layout); 66 SetLayoutManager(layout);
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 return switches::IsExperimentalAppListEnabled() 247 return switches::IsExperimentalAppListEnabled()
247 ? kSearchResultZHeight 248 ? kSearchResultZHeight
248 : AppListPage::GetSearchBoxZHeight(); 249 : AppListPage::GetSearchBoxZHeight();
249 } 250 }
250 251
251 void SearchResultPageView::OnHidden() { 252 void SearchResultPageView::OnHidden() {
252 ClearSelectedIndex(); 253 ClearSelectedIndex();
253 } 254 }
254 255
255 } // namespace app_list 256 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/views/search_result_list_view_unittest.cc ('k') | ui/app_list/views/search_result_page_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698