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

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

Issue 2480813003: Reduce views::Border creation verbosity by promoting factory functions (Closed)
Patch Set: fix bad merge Created 4 years, 1 month 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
« no previous file with comments | « ui/app_list/views/apps_grid_view.cc ('k') | ui/app_list/views/search_box_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/folder_header_view.h" 5 #include "ui/app_list/views/folder_header_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 18 matching lines...) Expand all
29 const int kPreferredWidth = 360; 29 const int kPreferredWidth = 360;
30 const int kPreferredHeight = 48; 30 const int kPreferredHeight = 48;
31 const int kBottomSeparatorHeight = 1; 31 const int kBottomSeparatorHeight = 1;
32 const int kMaxFolderNameWidth = 300; 32 const int kMaxFolderNameWidth = 300;
33 33
34 } // namespace 34 } // namespace
35 35
36 class FolderHeaderView::FolderNameView : public views::Textfield { 36 class FolderHeaderView::FolderNameView : public views::Textfield {
37 public: 37 public:
38 FolderNameView() { 38 FolderNameView() {
39 SetBorder(views::Border::CreateEmptyBorder(1, 1, 1, 1)); 39 SetBorder(views::CreateEmptyBorder(1, 1, 1, 1));
40 SetTextColor(kFolderTitleColor); 40 SetTextColor(kFolderTitleColor);
41 } 41 }
42 42
43 ~FolderNameView() override {} 43 ~FolderNameView() override {}
44 44
45 private: 45 private:
46 DISALLOW_COPY_AND_ASSIGN(FolderNameView); 46 DISALLOW_COPY_AND_ASSIGN(FolderNameView);
47 }; 47 };
48 48
49 FolderHeaderView::FolderHeaderView(FolderHeaderViewDelegate* delegate) 49 FolderHeaderView::FolderHeaderView(FolderHeaderViewDelegate* delegate)
50 : folder_item_(nullptr), 50 : folder_item_(nullptr),
51 folder_name_view_(new FolderNameView), 51 folder_name_view_(new FolderNameView),
52 folder_name_placeholder_text_( 52 folder_name_placeholder_text_(
53 ui::ResourceBundle::GetSharedInstance().GetLocalizedString( 53 ui::ResourceBundle::GetSharedInstance().GetLocalizedString(
54 IDS_APP_LIST_FOLDER_NAME_PLACEHOLDER)), 54 IDS_APP_LIST_FOLDER_NAME_PLACEHOLDER)),
55 delegate_(delegate), 55 delegate_(delegate),
56 folder_name_visible_(true) { 56 folder_name_visible_(true) {
57 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 57 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
58 folder_name_view_->SetFontList( 58 folder_name_view_->SetFontList(
59 rb.GetFontList(ui::ResourceBundle::MediumFont)); 59 rb.GetFontList(ui::ResourceBundle::MediumFont));
60 folder_name_view_->set_placeholder_text_color(kFolderTitleHintTextColor); 60 folder_name_view_->set_placeholder_text_color(kFolderTitleHintTextColor);
61 folder_name_view_->set_placeholder_text(folder_name_placeholder_text_); 61 folder_name_view_->set_placeholder_text(folder_name_placeholder_text_);
62 folder_name_view_->SetBorder(views::Border::NullBorder()); 62 folder_name_view_->SetBorder(views::NullBorder());
63 folder_name_view_->SetBackgroundColor(kContentsBackgroundColor); 63 folder_name_view_->SetBackgroundColor(kContentsBackgroundColor);
64 folder_name_view_->set_controller(this); 64 folder_name_view_->set_controller(this);
65 AddChildView(folder_name_view_); 65 AddChildView(folder_name_view_);
66 } 66 }
67 67
68 FolderHeaderView::~FolderHeaderView() { 68 FolderHeaderView::~FolderHeaderView() {
69 if (folder_item_) 69 if (folder_item_)
70 folder_item_->RemoveObserver(this); 70 folder_item_->RemoveObserver(this);
71 } 71 }
72 72
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 void FolderHeaderView::ButtonPressed(views::Button* sender, 211 void FolderHeaderView::ButtonPressed(views::Button* sender,
212 const ui::Event& event) { 212 const ui::Event& event) {
213 delegate_->NavigateBack(folder_item_, event); 213 delegate_->NavigateBack(folder_item_, event);
214 } 214 }
215 215
216 void FolderHeaderView::ItemNameChanged() { 216 void FolderHeaderView::ItemNameChanged() {
217 Update(); 217 Update();
218 } 218 }
219 219
220 } // namespace app_list 220 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/views/apps_grid_view.cc ('k') | ui/app_list/views/search_box_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698