OLD | NEW |
---|---|
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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
563 SkColor color = location_bar_view_->GetColor( | 563 SkColor color = location_bar_view_->GetColor( |
564 emphasize ? LocationBarView::TEXT : LocationBarView::DEEMPHASIZED_TEXT); | 564 emphasize ? LocationBarView::TEXT : LocationBarView::DEEMPHASIZED_TEXT); |
565 if (range.IsValid()) | 565 if (range.IsValid()) |
566 ApplyColor(color, range); | 566 ApplyColor(color, range); |
567 else | 567 else |
568 SetColor(color); | 568 SetColor(color); |
569 } | 569 } |
570 | 570 |
571 void OmniboxViewViews::UpdateSchemeStyle(const gfx::Range& range) { | 571 void OmniboxViewViews::UpdateSchemeStyle(const gfx::Range& range) { |
572 DCHECK(range.IsValid()); | 572 DCHECK(range.IsValid()); |
573 const SkColor security_color = | 573 // Only SECURE and DANGEROUS levels (pages served over HTTPS or flagged by |
574 location_bar_view_->GetSecureTextColor(security_level_); | 574 // SafeBrowsing) get a special scheme color treatment. If the security level |
575 const bool strike = security_level_ == security_state::DANGEROUS; | 575 // is NONE or HTTP_SHOW_WARNING, we do not override the text style previously |
576 ApplyColor(security_color, range); | 576 // applied to the scheme text range by SetEmphasis(). |
577 ApplyStyle(gfx::DIAGONAL_STRIKE, strike, range); | 577 if (security_level_ == security_state::NONE || |
578 security_level_ == security_state::HTTP_SHOW_WARNING) | |
Peter Kasting
2017/03/09 06:02:42
The addition of HTTP_SHOW_WARNING here is a views
| |
579 return; | |
580 ApplyColor(location_bar_view_->GetSecureTextColor(security_level_), range); | |
581 if (security_level_ == security_state::DANGEROUS) | |
582 ApplyStyle(gfx::DIAGONAL_STRIKE, true, range); | |
578 } | 583 } |
579 | 584 |
580 void OmniboxViewViews::EmphasizeURLComponents() { | 585 void OmniboxViewViews::EmphasizeURLComponents() { |
581 if (!location_bar_view_) | 586 if (!location_bar_view_) |
582 return; | 587 return; |
583 | 588 |
584 // If the current contents is a URL, force left-to-right rendering at the | 589 // If the current contents is a URL, force left-to-right rendering at the |
585 // paragraph level. Right-to-left runs are still rendered RTL, but will not | 590 // paragraph level. Right-to-left runs are still rendered RTL, but will not |
586 // flip the whole URL around. For example (if "ABC" is Hebrew), this will | 591 // flip the whole URL around. For example (if "ABC" is Hebrew), this will |
587 // render "ABC.com" as "CBA.com", rather than "com.CBA". | 592 // render "ABC.com" as "CBA.com", rather than "com.CBA". |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1053 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); | 1058 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); |
1054 | 1059 |
1055 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR); | 1060 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR); |
1056 | 1061 |
1057 // Minor note: We use IDC_ for command id here while the underlying textfield | 1062 // Minor note: We use IDC_ for command id here while the underlying textfield |
1058 // is using IDS_ for all its command ids. This is because views cannot depend | 1063 // is using IDS_ for all its command ids. This is because views cannot depend |
1059 // on IDC_ for now. | 1064 // on IDC_ for now. |
1060 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, | 1065 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, |
1061 IDS_EDIT_SEARCH_ENGINES); | 1066 IDS_EDIT_SEARCH_ENGINES); |
1062 } | 1067 } |
OLD | NEW |