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

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

Issue 10867038: A simple version of search term replacement for testing . (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added whitespace Created 8 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
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/property_bag.h" 9 #include "base/property_bag.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 OmniboxViewMacState state(model()->GetStateForTabSwitch(), hasFocus, range); 190 OmniboxViewMacState state(model()->GetStateForTabSwitch(), hasFocus, range);
191 StoreStateToTab(tab, state); 191 StoreStateToTab(tab, state);
192 } 192 }
193 193
194 void OmniboxViewMac::Update(const WebContents* tab_for_state_restoring) { 194 void OmniboxViewMac::Update(const WebContents* tab_for_state_restoring) {
195 // TODO(shess): It seems like if the tab is non-NULL, then this code 195 // TODO(shess): It seems like if the tab is non-NULL, then this code
196 // shouldn't need to be called at all. When coded that way, I find 196 // shouldn't need to be called at all. When coded that way, I find
197 // that the field isn't always updated correctly. Figure out why 197 // that the field isn't always updated correctly. Figure out why
198 // this is. Maybe this method should be refactored into more 198 // this is. Maybe this method should be refactored into more
199 // specific cases. 199 // specific cases.
200 bool user_visible = model()->UpdatePermanentText(toolbar_model()->GetText()); 200 bool user_visible =
201 model()->UpdatePermanentText(toolbar_model()->GetText(true));
201 202
202 if (tab_for_state_restoring) { 203 if (tab_for_state_restoring) {
203 RevertAll(); 204 RevertAll();
204 205
205 const OmniboxViewMacState* state = GetStateFromTab(tab_for_state_restoring); 206 const OmniboxViewMacState* state = GetStateFromTab(tab_for_state_restoring);
206 if (state) { 207 if (state) {
207 // Should restore the user's text via SetUserText(). 208 // Should restore the user's text via SetUserText().
208 model()->RestoreState(state->model_state); 209 model()->RestoreState(state->model_state);
209 210
210 // Restore focus and selection if they were present when the tab 211 // Restore focus and selection if they were present when the tab
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 NSUInteger OmniboxViewMac::GetTextLength() const { 985 NSUInteger OmniboxViewMac::GetTextLength() const {
985 return ([field_ currentEditor] ? 986 return ([field_ currentEditor] ?
986 [[[field_ currentEditor] string] length] : 987 [[[field_ currentEditor] string] length] :
987 [[field_ stringValue] length]) - suggest_text_length_; 988 [[field_ stringValue] length]) - suggest_text_length_;
988 } 989 }
989 990
990 bool OmniboxViewMac::IsCaretAtEnd() const { 991 bool OmniboxViewMac::IsCaretAtEnd() const {
991 const NSRange selection = GetSelectedRange(); 992 const NSRange selection = GetSelectedRange();
992 return selection.length == 0 && selection.location == GetTextLength(); 993 return selection.length == 0 && selection.location == GetTextLength();
993 } 994 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm ('k') | chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698