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

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

Issue 2742033002: Update scheme text color in Omnibox only in non-default Security Levels (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | 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 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 SkColor color = location_bar_view_->GetColor( 567 SkColor color = location_bar_view_->GetColor(
568 emphasize ? LocationBarView::TEXT : LocationBarView::DEEMPHASIZED_TEXT); 568 emphasize ? LocationBarView::TEXT : LocationBarView::DEEMPHASIZED_TEXT);
569 if (range.IsValid()) 569 if (range.IsValid())
570 ApplyColor(color, range); 570 ApplyColor(color, range);
571 else 571 else
572 SetColor(color); 572 SetColor(color);
573 } 573 }
574 574
575 void OmniboxViewViews::UpdateSchemeStyle(const gfx::Range& range) { 575 void OmniboxViewViews::UpdateSchemeStyle(const gfx::Range& range) {
576 DCHECK(range.IsValid()); 576 DCHECK(range.IsValid());
577 const SkColor security_color = 577 // Only SECURE and DANGEROUS levels (pages served over HTTPS or flagged by
578 location_bar_view_->GetSecureTextColor(security_level_); 578 // SafeBrowsing) get a special scheme color treatment. If the security level
579 const bool strike = security_level_ == security_state::DANGEROUS; 579 // is NONE or HTTP_SHOW_WARNING, we do not override the text style previously
580 ApplyColor(security_color, range); 580 // applied to the scheme text range by SetEmphasis().
581 ApplyStyle(gfx::DIAGONAL_STRIKE, strike, range); 581 if (security_level_ == security_state::NONE ||
582 security_level_ == security_state::HTTP_SHOW_WARNING)
583 return;
584 ApplyColor(location_bar_view_->GetSecureTextColor(security_level_), range);
585 if (security_level_ == security_state::DANGEROUS)
586 ApplyStyle(gfx::DIAGONAL_STRIKE, true, range);
582 } 587 }
583 588
584 void OmniboxViewViews::EmphasizeURLComponents() { 589 void OmniboxViewViews::EmphasizeURLComponents() {
585 if (!location_bar_view_) 590 if (!location_bar_view_)
586 return; 591 return;
587 592
588 // If the current contents is a URL, force left-to-right rendering at the 593 // If the current contents is a URL, force left-to-right rendering at the
589 // paragraph level. Right-to-left runs are still rendered RTL, but will not 594 // paragraph level. Right-to-left runs are still rendered RTL, but will not
590 // flip the whole URL around. For example (if "ABC" is Hebrew), this will 595 // flip the whole URL around. For example (if "ABC" is Hebrew), this will
591 // render "ABC.com" as "CBA.com", rather than "com.CBA". 596 // render "ABC.com" as "CBA.com", rather than "com.CBA".
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); 1054 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO);
1050 1055
1051 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR); 1056 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR);
1052 1057
1053 // Minor note: We use IDC_ for command id here while the underlying textfield 1058 // Minor note: We use IDC_ for command id here while the underlying textfield
1054 // is using IDS_ for all its command ids. This is because views cannot depend 1059 // is using IDS_ for all its command ids. This is because views cannot depend
1055 // on IDC_ for now. 1060 // on IDC_ for now.
1056 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, 1061 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES,
1057 IDS_EDIT_SEARCH_ENGINES); 1062 IDS_EDIT_SEARCH_ENGINES);
1058 } 1063 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698