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

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

Issue 12463042: Shows chrome-extension urls and greys out the whole url. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed comment nits Created 7 years, 8 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
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 "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 // should emphasize. To check for a URL, rather than using the type returned 814 // should emphasize. To check for a URL, rather than using the type returned
815 // by Parse(), ask the model, which will check the desired page transition for 815 // by Parse(), ask the model, which will check the desired page transition for
816 // this input. This can tell us whether an UNKNOWN input string is going to 816 // this input. This can tell us whether an UNKNOWN input string is going to
817 // be treated as a search or a navigation, and is the same method the Paste 817 // be treated as a search or a navigation, and is the same method the Paste
818 // And Go system uses. 818 // And Go system uses.
819 url_parse::Component scheme, host; 819 url_parse::Component scheme, host;
820 AutocompleteInput::ParseForEmphasizeComponents(text(), &scheme, &host); 820 AutocompleteInput::ParseForEmphasizeComponents(text(), &scheme, &host);
821 const bool emphasize = model()->CurrentTextIsURL() && (host.len > 0); 821 const bool emphasize = model()->CurrentTextIsURL() && (host.len > 0);
822 SetColor(location_bar_view_->GetColor(security_level_, 822 SetColor(location_bar_view_->GetColor(security_level_,
823 emphasize ? LocationBarView::DEEMPHASIZED_TEXT : LocationBarView::TEXT)); 823 emphasize ? LocationBarView::DEEMPHASIZED_TEXT : LocationBarView::TEXT));
824 if (emphasize) { 824 if (emphasize && !toolbar_model()->ShouldGreyOutURL()) {
825 ApplyColor( 825 ApplyColor(
826 location_bar_view_->GetColor(security_level_, LocationBarView::TEXT), 826 location_bar_view_->GetColor(security_level_, LocationBarView::TEXT),
827 ui::Range(host.begin, host.end())); 827 ui::Range(host.begin, host.end()));
828 } 828 }
829 829
830 // Emphasize the scheme for security UI display purposes (if necessary). 830 // Emphasize the scheme for security UI display purposes (if necessary).
831 // Note that we check CurrentTextIsURL() because if we're replacing search 831 // Note that we check CurrentTextIsURL() because if we're replacing search
832 // URLs with search terms, we may have a non-URL even when the user is not 832 // URLs with search terms, we may have a non-URL even when the user is not
833 // editing; and in some cases, e.g. for "site:foo.com" searches, the parser 833 // editing; and in some cases, e.g. for "site:foo.com" searches, the parser
834 // may have incorrectly identified a qualifier as a scheme. 834 // may have incorrectly identified a qualifier as a scheme.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 const string16 text(GetClipboardText()); 866 const string16 text(GetClipboardText());
867 if (!text.empty()) { 867 if (!text.empty()) {
868 // Record this paste, so we can do different behavior. 868 // Record this paste, so we can do different behavior.
869 model()->on_paste(); 869 model()->on_paste();
870 // Force a Paste operation to trigger the text_changed code in 870 // Force a Paste operation to trigger the text_changed code in
871 // OnAfterPossibleChange(), even if identical contents are pasted. 871 // OnAfterPossibleChange(), even if identical contents are pasted.
872 text_before_change_.clear(); 872 text_before_change_.clear();
873 ReplaceSelection(text); 873 ReplaceSelection(text);
874 } 874 }
875 } 875 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698