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

Unified Diff: chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm

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: No longer involves toolbar model 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/cocoa/omnibox/omnibox_view_mac.mm
diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm
index b2d44dfffd1b3322b37b344429c5089a91aa77bd..af5d95266b6df8a63c7a527d5673c23da19aa029 100644
--- a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm
+++ b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm
@@ -23,6 +23,7 @@
#include "chrome/browser/ui/omnibox/omnibox_popup_model.h"
#include "chrome/browser/ui/toolbar/toolbar_model.h"
#include "content/public/browser/web_contents.h"
+#include "extensions/common/constants.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
#import "third_party/mozilla/NSPasteboard+Utils.h"
@@ -448,13 +449,17 @@ void OmniboxViewMac::ApplyTextAttributes(const string16& display_text,
url_parse::Component scheme, host;
AutocompleteInput::ParseForEmphasizeComponents(
display_text, &scheme, &host);
- const bool emphasize = model()->CurrentTextIsURL() && (host.len > 0);
- if (emphasize) {
+ bool grey_out_url = GetText().substr(scheme.begin, scheme.len) ==
Peter Kasting 2013/04/11 23:10:40 Use |display_text| here instead of GetText().
Patrick Riordan 2013/04/11 23:27:38 Done. Sorry. This patch set was sloppy.
+ UTF8toUTF16(extensions::kExtensionScheme);
+ if (model()->currentTextIsURL() &&
+ (host.is_nonempty() || grey_out_url)) {
[as addAttribute:NSForegroundColorAttributeName value:BaseTextColor()
range:as_entire_string];
- [as addAttribute:NSForegroundColorAttributeName value:HostTextColor()
+ if (grey_out_url) {
Peter Kasting 2013/04/11 23:10:40 Isn't this conditional backwards?
Patrick Riordan 2013/04/11 23:27:38 Done.
+ [as addAttribute:NSForegroundColorAttributeName value:HostTextColor()
range:ComponentToNSRange(host)];
+ }
}
// TODO(shess): GTK has this as a member var, figure out why.

Powered by Google App Engine
This is Rietveld 408576698