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

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

Issue 23804002: Make OmniboxEditModel::UpdatePermanentText() fetch the new text itself rather (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 // store existing state before anyone tries to setup the new 195 // store existing state before anyone tries to setup the new
196 // state. Anyhow, it would look something like this. 196 // state. Anyhow, it would look something like this.
197 #if 0 197 #if 0
198 [[field_ window] makeFirstResponder:field_]; 198 [[field_ window] makeFirstResponder:field_];
199 [[field_ currentEditor] setSelectedRange:state->selection]; 199 [[field_ currentEditor] setSelectedRange:state->selection];
200 #endif 200 #endif
201 } 201 }
202 } 202 }
203 203
204 void OmniboxViewMac::Update() { 204 void OmniboxViewMac::Update() {
205 if (model()->UpdatePermanentText( 205 if (model()->UpdatePermanentText()) {
206 controller()->GetToolbarModel()->GetText(true))) {
207 // Restore everything to the baseline look. 206 // Restore everything to the baseline look.
208 RevertAll(); 207 RevertAll();
209 208
210 // TODO(shess): Figure out how this case is used, to make sure 209 // TODO(shess): Figure out how this case is used, to make sure
211 // we're getting the selection and popup right. 210 // we're getting the selection and popup right.
212 } else { 211 } else {
213 // TODO(shess): This corresponds to _win and _gtk, except those 212 // TODO(shess): This corresponds to _win and _gtk, except those
214 // guard it with a test for whether the security level changed. 213 // guard it with a test for whether the security level changed.
215 // But AFAICT, that can only change if the text changed, and that 214 // But AFAICT, that can only change if the text changed, and that
216 // code compares the toolbar model security level with the local 215 // code compares the toolbar model security level with the local
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 940
942 NSUInteger OmniboxViewMac::GetTextLength() const { 941 NSUInteger OmniboxViewMac::GetTextLength() const {
943 return [field_ currentEditor] ? [[[field_ currentEditor] string] length] : 942 return [field_ currentEditor] ? [[[field_ currentEditor] string] length] :
944 [[field_ stringValue] length]; 943 [[field_ stringValue] length];
945 } 944 }
946 945
947 bool OmniboxViewMac::IsCaretAtEnd() const { 946 bool OmniboxViewMac::IsCaretAtEnd() const {
948 const NSRange selection = GetSelectedRange(); 947 const NSRange selection = GetSelectedRange();
949 return NSMaxRange(selection) == GetTextLength(); 948 return NSMaxRange(selection) == GetTextLength();
950 } 949 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698