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

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

Issue 120503005: Merge NativeTextfieldViews into views::Textfield. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix touch drag and drop unit test. Created 6 years, 11 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 | Annotate | Revision Log
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 "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "grit/ui_resources.h" 8 #include "grit/ui_resources.h"
9 #include "grit/ui_strings.h" 9 #include "grit/ui_strings.h"
10 #include "ui/app_list/app_list_constants.h" 10 #include "ui/app_list/app_list_constants.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 back_button_(new views::ImageButton(this)), 61 back_button_(new views::ImageButton(this)),
62 folder_name_view_(new FolderNameView), 62 folder_name_view_(new FolderNameView),
63 delegate_(delegate) { 63 delegate_(delegate) {
64 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 64 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
65 back_button_->SetImage(views::ImageButton::STATE_NORMAL, 65 back_button_->SetImage(views::ImageButton::STATE_NORMAL,
66 rb.GetImageSkiaNamed(IDR_APP_LIST_FOLDER_BACK_NORMAL)); 66 rb.GetImageSkiaNamed(IDR_APP_LIST_FOLDER_BACK_NORMAL));
67 back_button_->SetImageAlignment(views::ImageButton::ALIGN_CENTER, 67 back_button_->SetImageAlignment(views::ImageButton::ALIGN_CENTER,
68 views::ImageButton::ALIGN_MIDDLE); 68 views::ImageButton::ALIGN_MIDDLE);
69 AddChildView(back_button_); 69 AddChildView(back_button_);
70 70
71 folder_name_view_->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); 71 folder_name_view_->SetFontList(
72 rb.GetFontList(ui::ResourceBundle::MediumFont));
72 folder_name_view_->set_placeholder_text_color(kHintTextColor); 73 folder_name_view_->set_placeholder_text_color(kHintTextColor);
73 folder_name_view_->set_placeholder_text( 74 folder_name_view_->set_placeholder_text(
74 rb.GetLocalizedString(IDS_APP_LIST_FOLDER_NAME_PLACEHOLDER)); 75 rb.GetLocalizedString(IDS_APP_LIST_FOLDER_NAME_PLACEHOLDER));
75 folder_name_view_->RemoveBorder(); 76 folder_name_view_->RemoveBorder();
76 folder_name_view_->SetBackgroundColor(kContentsBackgroundColor); 77 folder_name_view_->SetBackgroundColor(kContentsBackgroundColor);
77 folder_name_view_->SetController(this); 78 folder_name_view_->SetController(this);
78 AddChildView(folder_name_view_); 79 AddChildView(folder_name_view_);
79 } 80 }
80 81
81 FolderHeaderView::~FolderHeaderView() { 82 FolderHeaderView::~FolderHeaderView() {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 canvas->FillRect(rect, kTopSeparatorColor); 140 canvas->FillRect(rect, kTopSeparatorColor);
140 } 141 }
141 142
142 void FolderHeaderView::ContentsChanged(views::Textfield* sender, 143 void FolderHeaderView::ContentsChanged(views::Textfield* sender,
143 const base::string16& new_contents) { 144 const base::string16& new_contents) {
144 // Temporarily remove from observer to ignore data change caused by us. 145 // Temporarily remove from observer to ignore data change caused by us.
145 if (!folder_item_) 146 if (!folder_item_)
146 return; 147 return;
147 148
148 folder_item_->RemoveObserver(this); 149 folder_item_->RemoveObserver(this);
149 std::string name = base::UTF16ToUTF8(folder_name_view_->text()); 150 std::string name = base::UTF16ToUTF8(folder_name_view_->GetText());
150 folder_item_->SetTitleAndFullName(name, name); 151 folder_item_->SetTitleAndFullName(name, name);
151 folder_item_->AddObserver(this); 152 folder_item_->AddObserver(this);
152 } 153 }
153 154
154 void FolderHeaderView::ButtonPressed(views::Button* sender, 155 void FolderHeaderView::ButtonPressed(views::Button* sender,
155 const ui::Event& event) { 156 const ui::Event& event) {
156 delegate_->NavigateBack(folder_item_, event); 157 delegate_->NavigateBack(folder_item_, event);
157 } 158 }
158 159
159 void FolderHeaderView::ItemIconChanged() { 160 void FolderHeaderView::ItemIconChanged() {
160 } 161 }
161 162
162 void FolderHeaderView::ItemTitleChanged() { 163 void FolderHeaderView::ItemTitleChanged() {
163 Update(); 164 Update();
164 } 165 }
165 166
166 void FolderHeaderView::ItemHighlightedChanged() { 167 void FolderHeaderView::ItemHighlightedChanged() {
167 } 168 }
168 169
169 void FolderHeaderView::ItemIsInstallingChanged() { 170 void FolderHeaderView::ItemIsInstallingChanged() {
170 } 171 }
171 172
172 void FolderHeaderView::ItemPercentDownloadedChanged() { 173 void FolderHeaderView::ItemPercentDownloadedChanged() {
173 } 174 }
174 175
175 } // namespace app_list 176 } // namespace app_list
176 177
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698