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

Unified Diff: chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.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 mac typos and fixed unit test 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc
diff --git a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc
index 2bf2306bef27973301cb74b0ba12aa10ad5379dd..7c7c447af52c057273e48aeb65fd18964f7cad99 100644
--- a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc
+++ b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc
@@ -36,6 +36,7 @@
#include "chrome/common/chrome_notification_types.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/web_contents.h"
+#include "extensions/common/constants.h"
#include "googleurl/src/gurl.h"
#include "grit/generated_resources.h"
#include "net/base/escape.h"
@@ -1651,25 +1652,25 @@ void OmniboxViewGtk::EmphasizeURLComponents() {
url_parse::Component scheme, host;
string16 text(GetText());
AutocompleteInput::ParseForEmphasizeComponents(text, &scheme, &host);
- const bool emphasize = model()->CurrentTextIsURL() && (host.len > 0);
// Set the baseline emphasis.
GtkTextIter start, end;
GetTextBufferBounds(&start, &end);
gtk_text_buffer_remove_all_tags(text_buffer_, &start, &end);
- if (emphasize) {
- gtk_text_buffer_apply_tag(text_buffer_, faded_text_tag_, &start, &end);
-
+ bool grey_out_url = text.substr(scheme.begin, scheme.len) ==
+ UTF8ToUTF16(extensions::kExtensionScheme);
+ bool grey_base = model()->CurrentTextIsURL() &&
+ (host.is_nonempty() || grey_out_url);
+ gtk_text_buffer_apply_tag(
+ text_buffer_, grey_base ? faded_text_tag_ : normal_text_tag_ , &start,
+ &end);
+
+ if (grey_base && !grey_out_url) {
// We've found a host name, give it more emphasis.
- gtk_text_buffer_get_iter_at_line_index(text_buffer_, &start, 0,
- GetUTF8Offset(text,
- host.begin));
- gtk_text_buffer_get_iter_at_line_index(text_buffer_, &end, 0,
- GetUTF8Offset(text,
- host.end()));
-
- gtk_text_buffer_apply_tag(text_buffer_, normal_text_tag_, &start, &end);
- } else {
+ gtk_text_buffer_get_iter_at_line_index(
+ text_buffer_, &start, 0, GetUTF8Offset(text, host.begin));
+ gtk_text_buffer_get_iter_at_line_index(
+ text_buffer_, &end, 0, GetUTF8Offset(text, host.end()));
gtk_text_buffer_apply_tag(text_buffer_, normal_text_tag_, &start, &end);
}
« no previous file with comments | « chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm ('k') | chrome/browser/ui/toolbar/toolbar_model_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698