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

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

Issue 10582009: mac: Remove star.pdf in favor of star.png (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 6 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 | « chrome/app/theme/star_lit.pdf ('k') | chrome/chrome_dll.gypi » ('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/property_bag.h" 9 #include "base/property_bag.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 static_cast<NSInteger>(component.len)); 128 static_cast<NSInteger>(component.len));
129 } 129 }
130 130
131 } // namespace 131 } // namespace
132 132
133 // static 133 // static
134 NSImage* OmniboxViewMac::ImageForResource(int resource_id) { 134 NSImage* OmniboxViewMac::ImageForResource(int resource_id) {
135 NSString* image_name = nil; 135 NSString* image_name = nil;
136 136
137 switch(resource_id) { 137 switch(resource_id) {
138 // From the autocomplete popup, or the star icon at the RHS of the
139 // text field.
140 case IDR_STAR: image_name = @"star.pdf"; break;
141 case IDR_STAR_LIT: image_name = @"star_lit.pdf"; break;
142
143 // Values from |AutocompleteMatch::TypeToIcon()|. 138 // Values from |AutocompleteMatch::TypeToIcon()|.
144 case IDR_OMNIBOX_SEARCH: 139 case IDR_OMNIBOX_SEARCH:
145 image_name = @"omnibox_search.pdf"; break; 140 image_name = @"omnibox_search.pdf"; break;
146 case IDR_OMNIBOX_HTTP: 141 case IDR_OMNIBOX_HTTP:
147 image_name = @"omnibox_http.pdf"; break; 142 image_name = @"omnibox_http.pdf"; break;
148 case IDR_OMNIBOX_EXTENSION_APP: 143 case IDR_OMNIBOX_EXTENSION_APP:
149 image_name = @"omnibox_extension_app.pdf"; break; 144 image_name = @"omnibox_extension_app.pdf"; break;
150 145
151 // Values from |ToolbarModel::GetIcon()|. 146 // Values from |ToolbarModel::GetIcon()|.
152 case IDR_OMNIBOX_HTTPS_VALID: 147 case IDR_OMNIBOX_HTTPS_VALID:
153 image_name = @"omnibox_https_valid.pdf"; break; 148 image_name = @"omnibox_https_valid.pdf"; break;
154 case IDR_OMNIBOX_HTTPS_WARNING: 149 case IDR_OMNIBOX_HTTPS_WARNING:
155 image_name = @"omnibox_https_warning.pdf"; break; 150 image_name = @"omnibox_https_warning.pdf"; break;
156 case IDR_OMNIBOX_HTTPS_INVALID: 151 case IDR_OMNIBOX_HTTPS_INVALID:
157 image_name = @"omnibox_https_invalid.pdf"; break; 152 image_name = @"omnibox_https_invalid.pdf"; break;
158 } 153 }
159 154
160 if (image_name) { 155 if (image_name) {
161 if (NSImage* image = gfx::GetCachedImageWithName(image_name)) { 156 if (NSImage* image = gfx::GetCachedImageWithName(image_name)) {
162 return image; 157 return image;
163 } else { 158 } else {
164 NOTREACHED() 159 NOTREACHED()
165 << "Missing image for " << base::SysNSStringToUTF8(image_name); 160 << "Missing image for " << base::SysNSStringToUTF8(image_name);
166 } 161 }
167 } 162 }
168 163
169 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 164 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
170 return rb.GetNativeImageNamed(resource_id); 165 return rb.GetNativeImageNamed(resource_id);
Nico 2012/06/18 22:46:50 The fall-through down here ends up loading the ima
171 } 166 }
172 167
173 OmniboxViewMac::OmniboxViewMac(AutocompleteEditController* controller, 168 OmniboxViewMac::OmniboxViewMac(AutocompleteEditController* controller,
174 ToolbarModel* toolbar_model, 169 ToolbarModel* toolbar_model,
175 Profile* profile, 170 Profile* profile,
176 CommandUpdater* command_updater, 171 CommandUpdater* command_updater,
177 AutocompleteTextField* field) 172 AutocompleteTextField* field)
178 : model_(new AutocompleteEditModel(this, controller, profile)), 173 : model_(new AutocompleteEditModel(this, controller, profile)),
179 popup_view_(new OmniboxPopupViewMac(this, model_.get(), profile, field)), 174 popup_view_(new OmniboxPopupViewMac(this, model_.get(), profile, field)),
180 controller_(controller), 175 controller_(controller),
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 1116
1122 void OmniboxViewMac::PlaceCaretAt(NSUInteger pos) { 1117 void OmniboxViewMac::PlaceCaretAt(NSUInteger pos) {
1123 DCHECK(pos <= GetTextLength()); 1118 DCHECK(pos <= GetTextLength());
1124 SetSelectedRange(NSMakeRange(pos, pos)); 1119 SetSelectedRange(NSMakeRange(pos, pos));
1125 } 1120 }
1126 1121
1127 bool OmniboxViewMac::IsCaretAtEnd() const { 1122 bool OmniboxViewMac::IsCaretAtEnd() const {
1128 const NSRange selection = GetSelectedRange(); 1123 const NSRange selection = GetSelectedRange();
1129 return selection.length == 0 && selection.location == GetTextLength(); 1124 return selection.length == 0 && selection.location == GetTextLength();
1130 } 1125 }
OLDNEW
« no previous file with comments | « chrome/app/theme/star_lit.pdf ('k') | chrome/chrome_dll.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698