| 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 "ash/ime/infolist_window.h" | 5 #include "ash/ime/infolist_window.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/ime/candidate_window_constants.h" | 10 #include "ash/ime/candidate_window_constants.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 public: | 87 public: |
| 88 InfolistEntryView(const ui::InfolistEntry& entry, | 88 InfolistEntryView(const ui::InfolistEntry& entry, |
| 89 const gfx::FontList& title_font_list, | 89 const gfx::FontList& title_font_list, |
| 90 const gfx::FontList& description_font_list); | 90 const gfx::FontList& description_font_list); |
| 91 virtual ~InfolistEntryView(); | 91 virtual ~InfolistEntryView(); |
| 92 | 92 |
| 93 void SetEntry(const ui::InfolistEntry& entry); | 93 void SetEntry(const ui::InfolistEntry& entry); |
| 94 | 94 |
| 95 private: | 95 private: |
| 96 // views::View implementation. | 96 // views::View implementation. |
| 97 virtual gfx::Size GetPreferredSize() OVERRIDE; | 97 virtual gfx::Size GetPreferredSize() const OVERRIDE; |
| 98 | 98 |
| 99 void UpdateBackground(); | 99 void UpdateBackground(); |
| 100 | 100 |
| 101 ui::InfolistEntry entry_; | 101 ui::InfolistEntry entry_; |
| 102 | 102 |
| 103 // The title label. Owned by views hierarchy. | 103 // The title label. Owned by views hierarchy. |
| 104 views::Label* title_label_; | 104 views::Label* title_label_; |
| 105 | 105 |
| 106 // The description label. Owned by views hierarchy. | 106 // The description label. Owned by views hierarchy. |
| 107 views::Label* description_label_; | 107 views::Label* description_label_; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 136 void InfolistEntryView::SetEntry(const ui::InfolistEntry& entry) { | 136 void InfolistEntryView::SetEntry(const ui::InfolistEntry& entry) { |
| 137 if (entry_ == entry) | 137 if (entry_ == entry) |
| 138 return; | 138 return; |
| 139 | 139 |
| 140 entry_ = entry; | 140 entry_ = entry; |
| 141 title_label_->SetText(entry_.title); | 141 title_label_->SetText(entry_.title); |
| 142 description_label_->SetText(entry_.body); | 142 description_label_->SetText(entry_.body); |
| 143 UpdateBackground(); | 143 UpdateBackground(); |
| 144 } | 144 } |
| 145 | 145 |
| 146 gfx::Size InfolistEntryView::GetPreferredSize() { | 146 gfx::Size InfolistEntryView::GetPreferredSize() const { |
| 147 return gfx::Size(kInfolistEntryWidth, GetHeightForWidth(kInfolistEntryWidth)); | 147 return gfx::Size(kInfolistEntryWidth, GetHeightForWidth(kInfolistEntryWidth)); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void InfolistEntryView::UpdateBackground() { | 150 void InfolistEntryView::UpdateBackground() { |
| 151 if (entry_.highlighted) { | 151 if (entry_.highlighted) { |
| 152 set_background( | 152 set_background( |
| 153 views::Background::CreateSolidBackground(GetNativeTheme()->GetSystemColor( | 153 views::Background::CreateSolidBackground(GetNativeTheme()->GetSystemColor( |
| 154 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused))); | 154 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused))); |
| 155 SetBorder(views::Border::CreateSolidBorder( | 155 SetBorder(views::Border::CreateSolidBorder( |
| 156 1, | 156 1, |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 show_hide_timer_.Stop(); | 269 show_hide_timer_.Stop(); |
| 270 GetWidget()->Close(); | 270 GetWidget()->Close(); |
| 271 } | 271 } |
| 272 | 272 |
| 273 void InfolistWindow::WindowClosing() { | 273 void InfolistWindow::WindowClosing() { |
| 274 show_hide_timer_.Stop(); | 274 show_hide_timer_.Stop(); |
| 275 } | 275 } |
| 276 | 276 |
| 277 } // namespace ime | 277 } // namespace ime |
| 278 } // namespace ash | 278 } // namespace ash |
| OLD | NEW |