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

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_result_view.cc

Issue 2573383002: Refresh appearance of omnibox results when native theme changes. (Closed)
Patch Set: Created 4 years 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 | « chrome/browser/ui/views/omnibox/omnibox_result_view.h ('k') | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // For WinDDK ATL compatibility, these ATL headers must come first. 5 // For WinDDK ATL compatibility, these ATL headers must come first.
6 #include "build/build_config.h" 6 #include "build/build_config.h"
7 7
8 #if defined(OS_WIN) 8 #if defined(OS_WIN)
9 #include <atlbase.h> // NOLINT 9 #include <atlbase.h> // NOLINT
10 #include <atlwin.h> // NOLINT 10 #include <atlwin.h> // NOLINT
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 } 294 }
295 295
296 void OmniboxResultView::GetAccessibleNodeData(ui::AXNodeData* node_data) { 296 void OmniboxResultView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
297 node_data->SetName(match_.answer 297 node_data->SetName(match_.answer
298 ? l10n_util::GetStringFUTF16( 298 ? l10n_util::GetStringFUTF16(
299 IDS_OMNIBOX_ACCESSIBLE_ANSWER, match_.contents, 299 IDS_OMNIBOX_ACCESSIBLE_ANSWER, match_.contents,
300 match_.answer->second_line().AccessibleText()) 300 match_.answer->second_line().AccessibleText())
301 : match_.contents); 301 : match_.contents);
302 } 302 }
303 303
304 void OmniboxResultView::OnNativeThemeChanged(const ui::NativeTheme* theme) {
305 Invalidate();
306 SchedulePaint();
307 }
308
304 //////////////////////////////////////////////////////////////////////////////// 309 ////////////////////////////////////////////////////////////////////////////////
305 // OmniboxResultView, protected: 310 // OmniboxResultView, protected:
306 311
307 OmniboxResultView::ResultViewState OmniboxResultView::GetState() const { 312 OmniboxResultView::ResultViewState OmniboxResultView::GetState() const {
308 if (model_->IsSelectedIndex(model_index_)) 313 if (model_->IsSelectedIndex(model_index_))
309 return SELECTED; 314 return SELECTED;
310 return model_->IsHoveredIndex(model_index_) ? HOVERED : NORMAL; 315 return model_->IsHoveredIndex(model_index_) ? HOVERED : NORMAL;
311 } 316 }
312 317
313 int OmniboxResultView::GetTextHeight() const { 318 int OmniboxResultView::GetTextHeight() const {
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 destination->AppendText(text); 770 destination->AppendText(text);
766 const TextStyle& text_style = GetTextStyle(text_type); 771 const TextStyle& text_style = GetTextStyle(text_type);
767 // TODO(dschuyler): follow up on the problem of different font sizes within 772 // TODO(dschuyler): follow up on the problem of different font sizes within
768 // one RenderText. Maybe with destination->SetFontList(...). 773 // one RenderText. Maybe with destination->SetFontList(...).
769 destination->ApplyWeight( 774 destination->ApplyWeight(
770 is_bold ? gfx::Font::Weight::BOLD : gfx::Font::Weight::NORMAL, range); 775 is_bold ? gfx::Font::Weight::BOLD : gfx::Font::Weight::NORMAL, range);
771 destination->ApplyColor( 776 destination->ApplyColor(
772 GetNativeTheme()->GetSystemColor(text_style.colors[GetState()]), range); 777 GetNativeTheme()->GetSystemColor(text_style.colors[GetState()]), range);
773 destination->ApplyBaselineStyle(text_style.baseline, range); 778 destination->ApplyBaselineStyle(text_style.baseline, range);
774 } 779 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_result_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698