| OLD | NEW |
| 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/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "ui/app_list/app_list_constants.h" | 10 #include "ui/app_list/app_list_constants.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 const int kPreferredWidth = 360; | 27 const int kPreferredWidth = 360; |
| 28 const int kPreferredHeight = 48; | 28 const int kPreferredHeight = 48; |
| 29 const int kIconDimension = 24; | 29 const int kIconDimension = 24; |
| 30 const int kBackButtonPadding = 14; | 30 const int kBackButtonPadding = 14; |
| 31 const int kBottomSeparatorPadding = 9; // Non-experimental app list only. | 31 const int kBottomSeparatorPadding = 9; // Non-experimental app list only. |
| 32 const int kBottomSeparatorHeight = 1; | 32 const int kBottomSeparatorHeight = 1; |
| 33 const int kMaxFolderNameWidth = 300; | 33 const int kMaxFolderNameWidth = 300; |
| 34 | 34 |
| 35 const SkColor kHintTextColor = SkColorSetRGB(0xA0, 0xA0, 0xA0); | |
| 36 | |
| 37 } // namespace | 35 } // namespace |
| 38 | 36 |
| 39 class FolderHeaderView::FolderNameView : public views::Textfield { | 37 class FolderHeaderView::FolderNameView : public views::Textfield { |
| 40 public: | 38 public: |
| 41 FolderNameView() { | 39 FolderNameView() { |
| 42 SetBorder(views::Border::CreateEmptyBorder(1, 1, 1, 1)); | 40 SetBorder(views::Border::CreateEmptyBorder(1, 1, 1, 1)); |
| 43 const SkColor kFocusBorderColor = SkColorSetRGB(64, 128, 250); | 41 const SkColor kFocusBorderColor = SkColorSetRGB(64, 128, 250); |
| 44 SetFocusPainter(views::Painter::CreateSolidFocusPainter( | 42 SetFocusPainter(views::Painter::CreateSolidFocusPainter( |
| 45 kFocusBorderColor, | 43 kFocusBorderColor, |
| 46 gfx::Insets(0, 0, 1, 1))); | 44 gfx::Insets(0, 0, 1, 1))); |
| 45 |
| 46 SetTextColor(kFolderTitleColor); |
| 47 } | 47 } |
| 48 | 48 |
| 49 virtual ~FolderNameView() { | 49 virtual ~FolderNameView() { |
| 50 } | 50 } |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 DISALLOW_COPY_AND_ASSIGN(FolderNameView); | 53 DISALLOW_COPY_AND_ASSIGN(FolderNameView); |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 FolderHeaderView::FolderHeaderView(FolderHeaderViewDelegate* delegate) | 56 FolderHeaderView::FolderHeaderView(FolderHeaderViewDelegate* delegate) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 68 back_button_->SetImageAlignment(views::ImageButton::ALIGN_CENTER, | 68 back_button_->SetImageAlignment(views::ImageButton::ALIGN_CENTER, |
| 69 views::ImageButton::ALIGN_MIDDLE); | 69 views::ImageButton::ALIGN_MIDDLE); |
| 70 AddChildView(back_button_); | 70 AddChildView(back_button_); |
| 71 back_button_->SetFocusable(true); | 71 back_button_->SetFocusable(true); |
| 72 back_button_->SetAccessibleName( | 72 back_button_->SetAccessibleName( |
| 73 ui::ResourceBundle::GetSharedInstance().GetLocalizedString( | 73 ui::ResourceBundle::GetSharedInstance().GetLocalizedString( |
| 74 IDS_APP_LIST_FOLDER_CLOSE_FOLDER_ACCESSIBILE_NAME)); | 74 IDS_APP_LIST_FOLDER_CLOSE_FOLDER_ACCESSIBILE_NAME)); |
| 75 | 75 |
| 76 folder_name_view_->SetFontList( | 76 folder_name_view_->SetFontList( |
| 77 rb.GetFontList(ui::ResourceBundle::MediumFont)); | 77 rb.GetFontList(ui::ResourceBundle::MediumFont)); |
| 78 folder_name_view_->set_placeholder_text_color(kHintTextColor); | 78 folder_name_view_->set_placeholder_text_color(kFolderTitleHintTextColor); |
| 79 folder_name_view_->set_placeholder_text(folder_name_placeholder_text_); | 79 folder_name_view_->set_placeholder_text(folder_name_placeholder_text_); |
| 80 folder_name_view_->SetBorder(views::Border::NullBorder()); | 80 folder_name_view_->SetBorder(views::Border::NullBorder()); |
| 81 folder_name_view_->SetBackgroundColor(kContentsBackgroundColor); | 81 folder_name_view_->SetBackgroundColor(kContentsBackgroundColor); |
| 82 folder_name_view_->set_controller(this); | 82 folder_name_view_->set_controller(this); |
| 83 AddChildView(folder_name_view_); | 83 AddChildView(folder_name_view_); |
| 84 } | 84 } |
| 85 | 85 |
| 86 FolderHeaderView::~FolderHeaderView() { | 86 FolderHeaderView::~FolderHeaderView() { |
| 87 if (folder_item_) | 87 if (folder_item_) |
| 88 folder_item_->RemoveObserver(this); | 88 folder_item_->RemoveObserver(this); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 void FolderHeaderView::ButtonPressed(views::Button* sender, | 231 void FolderHeaderView::ButtonPressed(views::Button* sender, |
| 232 const ui::Event& event) { | 232 const ui::Event& event) { |
| 233 delegate_->NavigateBack(folder_item_, event); | 233 delegate_->NavigateBack(folder_item_, event); |
| 234 } | 234 } |
| 235 | 235 |
| 236 void FolderHeaderView::ItemNameChanged() { | 236 void FolderHeaderView::ItemNameChanged() { |
| 237 Update(); | 237 Update(); |
| 238 } | 238 } |
| 239 | 239 |
| 240 } // namespace app_list | 240 } // namespace app_list |
| OLD | NEW |