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

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

Issue 8590003: chrome: Remove 11 exit time destructors and 4 static initializers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: no gyp changes :-( Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/string_util.h" 9 #include "base/string_util.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 const AutocompleteEditModel::State model_state; 97 const AutocompleteEditModel::State model_state;
98 const bool has_focus; 98 const bool has_focus;
99 const NSRange selection; 99 const NSRange selection;
100 }; 100 };
101 101
102 // Returns a lazily initialized property bag accessor for saving our 102 // Returns a lazily initialized property bag accessor for saving our
103 // state in a TabContents. When constructed |accessor| generates a 103 // state in a TabContents. When constructed |accessor| generates a
104 // globally-unique id used to index into the per-tab PropertyBag used 104 // globally-unique id used to index into the per-tab PropertyBag used
105 // to store the state data. 105 // to store the state data.
106 PropertyAccessor<OmniboxViewMacState>* GetStateAccessor() { 106 PropertyAccessor<OmniboxViewMacState>* GetStateAccessor() {
107 static PropertyAccessor<OmniboxViewMacState> accessor; 107 CR_DEFINE_STATIC_LOCAL(PropertyAccessor<OmniboxViewMacState>, accessor, ());
108 return &accessor; 108 return &accessor;
109 } 109 }
110 110
111 // Accessors for storing and getting the state from the tab. 111 // Accessors for storing and getting the state from the tab.
112 void StoreStateToTab(TabContents* tab, 112 void StoreStateToTab(TabContents* tab,
113 const OmniboxViewMacState& state) { 113 const OmniboxViewMacState& state) {
114 GetStateAccessor()->SetProperty(tab->property_bag(), state); 114 GetStateAccessor()->SetProperty(tab->property_bag(), state);
115 } 115 }
116 const OmniboxViewMacState* GetStateFromTab(const TabContents* tab) { 116 const OmniboxViewMacState* GetStateFromTab(const TabContents* tab) {
117 return GetStateAccessor()->GetProperty(tab->property_bag()); 117 return GetStateAccessor()->GetProperty(tab->property_bag());
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 1121
1122 void OmniboxViewMac::PlaceCaretAt(NSUInteger pos) { 1122 void OmniboxViewMac::PlaceCaretAt(NSUInteger pos) {
1123 DCHECK(pos <= GetTextLength()); 1123 DCHECK(pos <= GetTextLength());
1124 SetSelectedRange(NSMakeRange(pos, pos)); 1124 SetSelectedRange(NSMakeRange(pos, pos));
1125 } 1125 }
1126 1126
1127 bool OmniboxViewMac::IsCaretAtEnd() const { 1127 bool OmniboxViewMac::IsCaretAtEnd() const {
1128 const NSRange selection = GetSelectedRange(); 1128 const NSRange selection = GetSelectedRange();
1129 return selection.length == 0 && selection.location == GetTextLength(); 1129 return selection.length == 0 && selection.location == GetTextLength();
1130 } 1130 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698