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

Side by Side Diff: chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm

Issue 287543002: Remove origin chip v1 and "hide on input" v2 behavior. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 7 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 | Annotate | Revision Log
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/cocoa/omnibox/omnibox_view_mac.h" 5 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h"
6 6
7 #include <Carbon/Carbon.h> // kVK_Return 7 #include <Carbon/Carbon.h> // kVK_Return
8 8
9 #include "base/mac/foundation_util.h" 9 #include "base/mac/foundation_util.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 // store existing state before anyone tries to setup the new 202 // store existing state before anyone tries to setup the new
203 // state. Anyhow, it would look something like this. 203 // state. Anyhow, it would look something like this.
204 #if 0 204 #if 0
205 [[field_ window] makeFirstResponder:field_]; 205 [[field_ window] makeFirstResponder:field_];
206 [[field_ currentEditor] setSelectedRange:state->selection]; 206 [[field_ currentEditor] setSelectedRange:state->selection];
207 #endif 207 #endif
208 } 208 }
209 } 209 }
210 210
211 void OmniboxViewMac::Update() { 211 void OmniboxViewMac::Update() {
212 if (chrome::ShouldDisplayOriginChipV2()) { 212 if (chrome::ShouldDisplayOriginChip()) {
213 NSDictionary* placeholder_attributes = @{ 213 NSDictionary* placeholder_attributes = @{
214 NSFontAttributeName : GetFieldFont(gfx::Font::NORMAL), 214 NSFontAttributeName : GetFieldFont(gfx::Font::NORMAL),
215 NSForegroundColorAttributeName : [NSColor disabledControlTextColor] 215 NSForegroundColorAttributeName : [NSColor disabledControlTextColor]
216 }; 216 };
217 base::scoped_nsobject<NSMutableAttributedString> placeholder_text( 217 base::scoped_nsobject<NSMutableAttributedString> placeholder_text(
218 [[NSMutableAttributedString alloc] 218 [[NSMutableAttributedString alloc]
219 initWithString:base::SysUTF16ToNSString(GetHintText()) 219 initWithString:base::SysUTF16ToNSString(GetHintText())
220 attributes:placeholder_attributes]); 220 attributes:placeholder_attributes]);
221 [[field_ cell] setPlaceholderAttributedString:placeholder_text]; 221 [[field_ cell] setPlaceholderAttributedString:placeholder_text];
222 } 222 }
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 1013
1014 NSUInteger OmniboxViewMac::GetTextLength() const { 1014 NSUInteger OmniboxViewMac::GetTextLength() const {
1015 return [field_ currentEditor] ? [[[field_ currentEditor] string] length] : 1015 return [field_ currentEditor] ? [[[field_ currentEditor] string] length] :
1016 [[field_ stringValue] length]; 1016 [[field_ stringValue] length];
1017 } 1017 }
1018 1018
1019 bool OmniboxViewMac::IsCaretAtEnd() const { 1019 bool OmniboxViewMac::IsCaretAtEnd() const {
1020 const NSRange selection = GetSelectedRange(); 1020 const NSRange selection = GetSelectedRange();
1021 return NSMaxRange(selection) == GetTextLength(); 1021 return NSMaxRange(selection) == GetTextLength();
1022 } 1022 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/location_icon_decoration.mm ('k') | chrome/browser/ui/omnibox/omnibox_edit_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698