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

Side by Side Diff: chrome/browser/page_info_model.cc

Issue 3560004: Refactor the code for loading icons into the PageInfoModel. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: cleanup Created 10 years, 2 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
« no previous file with comments | « chrome/browser/page_info_model.h ('k') | chrome/browser/views/page_info_bubble_view.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/page_info_model.h" 5 #include "chrome/browser/page_info_model.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/resource_bundle.h"
10 #include "base/command_line.h" 11 #include "base/command_line.h"
11 #include "base/i18n/time_formatting.h" 12 #include "base/i18n/time_formatting.h"
12 #include "base/string_number_conversions.h" 13 #include "base/string_number_conversions.h"
13 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
14 #include "chrome/browser/cert_store.h" 15 #include "chrome/browser/cert_store.h"
15 #include "chrome/browser/prefs/pref_service.h" 16 #include "chrome/browser/prefs/pref_service.h"
16 #include "chrome/browser/profile.h" 17 #include "chrome/browser/profile.h"
17 #include "chrome/browser/ssl/ssl_manager.h" 18 #include "chrome/browser/ssl/ssl_manager.h"
18 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
19 #include "chrome/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
20 #include "grit/generated_resources.h" 21 #include "grit/generated_resources.h"
22 #include "grit/theme_resources.h"
21 #include "net/base/cert_status_flags.h" 23 #include "net/base/cert_status_flags.h"
22 #include "net/base/ssl_connection_status_flags.h" 24 #include "net/base/ssl_connection_status_flags.h"
23 #include "net/base/ssl_cipher_suite_names.h" 25 #include "net/base/ssl_cipher_suite_names.h"
24 #include "net/base/x509_certificate.h" 26 #include "net/base/x509_certificate.h"
25 27
28 #if defined(OS_MACOSX)
29 #include "base/mac_util.h"
30 #endif
31
26 PageInfoModel::PageInfoModel(Profile* profile, 32 PageInfoModel::PageInfoModel(Profile* profile,
27 const GURL& url, 33 const GURL& url,
28 const NavigationEntry::SSLStatus& ssl, 34 const NavigationEntry::SSLStatus& ssl,
29 bool show_history, 35 bool show_history,
30 PageInfoModelObserver* observer) 36 PageInfoModelObserver* observer)
31 : observer_(observer) { 37 : observer_(observer) {
32 SectionInfoState state = SECTION_STATE_OK; 38 Init();
39
40 SectionStateIcon icon_id = ICON_STATE_OK;
33 string16 headline; 41 string16 headline;
34 string16 description; 42 string16 description;
35 scoped_refptr<net::X509Certificate> cert; 43 scoped_refptr<net::X509Certificate> cert;
36 44
37 // Identity section. 45 // Identity section.
38 string16 subject_name(UTF8ToUTF16(url.host())); 46 string16 subject_name(UTF8ToUTF16(url.host()));
39 bool empty_subject_name = false; 47 bool empty_subject_name = false;
40 if (subject_name.empty()) { 48 if (subject_name.empty()) {
41 subject_name.assign( 49 subject_name.assign(
42 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY)); 50 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY));
(...skipping 24 matching lines...) Expand all
67 description += ASCIIToUTF16("\n\n"); 75 description += ASCIIToUTF16("\n\n");
68 if (cert_status & net::CERT_STATUS_UNABLE_TO_CHECK_REVOCATION) { 76 if (cert_status & net::CERT_STATUS_UNABLE_TO_CHECK_REVOCATION) {
69 description += l10n_util::GetStringUTF16( 77 description += l10n_util::GetStringUTF16(
70 IDS_PAGE_INFO_SECURITY_TAB_UNABLE_TO_CHECK_REVOCATION); 78 IDS_PAGE_INFO_SECURITY_TAB_UNABLE_TO_CHECK_REVOCATION);
71 } else if (cert_status & net::CERT_STATUS_NO_REVOCATION_MECHANISM) { 79 } else if (cert_status & net::CERT_STATUS_NO_REVOCATION_MECHANISM) {
72 description += l10n_util::GetStringUTF16( 80 description += l10n_util::GetStringUTF16(
73 IDS_PAGE_INFO_SECURITY_TAB_NO_REVOCATION_MECHANISM); 81 IDS_PAGE_INFO_SECURITY_TAB_NO_REVOCATION_MECHANISM);
74 } else { 82 } else {
75 NOTREACHED() << "Need to specify string for this warning"; 83 NOTREACHED() << "Need to specify string for this warning";
76 } 84 }
77 state = SECTION_STATE_WARNING_MINOR; 85 icon_id = ICON_STATE_WARNING_MINOR;
78 } else if ((ssl.cert_status() & net::CERT_STATUS_IS_EV) != 0) { 86 } else if ((ssl.cert_status() & net::CERT_STATUS_IS_EV) != 0) {
79 // EV HTTPS page. 87 // EV HTTPS page.
80 DCHECK(!cert->subject().organization_names.empty()); 88 DCHECK(!cert->subject().organization_names.empty());
81 headline = 89 headline =
82 l10n_util::GetStringFUTF16(IDS_PAGE_INFO_EV_IDENTITY_TITLE, 90 l10n_util::GetStringFUTF16(IDS_PAGE_INFO_EV_IDENTITY_TITLE,
83 UTF8ToUTF16(cert->subject().organization_names[0]), 91 UTF8ToUTF16(cert->subject().organization_names[0]),
84 UTF8ToUTF16(url.host())); 92 UTF8ToUTF16(url.host()));
85 // An EV Cert is required to have a city (localityName) and country but 93 // An EV Cert is required to have a city (localityName) and country but
86 // state is "if any". 94 // state is "if any".
87 DCHECK(!cert->subject().locality_name.empty()); 95 DCHECK(!cert->subject().locality_name.empty());
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 issuer_name.assign(l10n_util::GetStringUTF16( 132 issuer_name.assign(l10n_util::GetStringUTF16(
125 IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY)); 133 IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY));
126 } 134 }
127 description.assign(l10n_util::GetStringFUTF16( 135 description.assign(l10n_util::GetStringFUTF16(
128 IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY, issuer_name)); 136 IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY, issuer_name));
129 } 137 }
130 } else { 138 } else {
131 // HTTP or HTTPS with errors (not warnings). 139 // HTTP or HTTPS with errors (not warnings).
132 description.assign(l10n_util::GetStringUTF16( 140 description.assign(l10n_util::GetStringUTF16(
133 IDS_PAGE_INFO_SECURITY_TAB_INSECURE_IDENTITY)); 141 IDS_PAGE_INFO_SECURITY_TAB_INSECURE_IDENTITY));
134 state = ssl.security_style() == SECURITY_STYLE_UNAUTHENTICATED ? 142 icon_id = ssl.security_style() == SECURITY_STYLE_UNAUTHENTICATED ?
135 SECTION_STATE_WARNING_MAJOR : SECTION_STATE_ERROR; 143 ICON_STATE_WARNING_MAJOR : ICON_STATE_ERROR;
136 } 144 }
137 sections_.push_back(SectionInfo( 145 sections_.push_back(SectionInfo(
138 state, 146 icon_id,
139 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_IDENTITY_TITLE), 147 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_IDENTITY_TITLE),
140 headline, 148 headline,
141 description, 149 description,
142 SECTION_INFO_IDENTITY)); 150 SECTION_INFO_IDENTITY));
143 151
144 // Connection section. 152 // Connection section.
145 // We consider anything less than 80 bits encryption to be weak encryption. 153 // We consider anything less than 80 bits encryption to be weak encryption.
146 // TODO(wtc): Bug 1198735: report mixed/unsafe content for unencrypted and 154 // TODO(wtc): Bug 1198735: report mixed/unsafe content for unencrypted and
147 // weakly encrypted connections. 155 // weakly encrypted connections.
148 state = SECTION_STATE_OK; 156 icon_id = ICON_STATE_OK;
149 headline.clear(); 157 headline.clear();
150 description.clear(); 158 description.clear();
151 if (ssl.security_bits() < 0) { 159 if (ssl.security_bits() < 0) {
152 // Security strength is unknown. Say nothing. 160 // Security strength is unknown. Say nothing.
153 state = SECTION_STATE_ERROR; 161 icon_id = ICON_STATE_ERROR;
154 } else if (ssl.security_bits() == 0) { 162 } else if (ssl.security_bits() == 0) {
155 state = ssl.security_style() == SECURITY_STYLE_UNAUTHENTICATED ? 163 icon_id = ssl.security_style() == SECURITY_STYLE_UNAUTHENTICATED ?
156 SECTION_STATE_WARNING_MAJOR : SECTION_STATE_ERROR; 164 ICON_STATE_WARNING_MAJOR : ICON_STATE_ERROR;
157 description.assign(l10n_util::GetStringFUTF16( 165 description.assign(l10n_util::GetStringFUTF16(
158 IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, 166 IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT,
159 subject_name)); 167 subject_name));
160 } else if (ssl.security_bits() < 80) { 168 } else if (ssl.security_bits() < 80) {
161 state = SECTION_STATE_ERROR; 169 icon_id = ICON_STATE_ERROR;
162 description.assign(l10n_util::GetStringFUTF16( 170 description.assign(l10n_util::GetStringFUTF16(
163 IDS_PAGE_INFO_SECURITY_TAB_WEAK_ENCRYPTION_CONNECTION_TEXT, 171 IDS_PAGE_INFO_SECURITY_TAB_WEAK_ENCRYPTION_CONNECTION_TEXT,
164 subject_name)); 172 subject_name));
165 } else { 173 } else {
166 description.assign(l10n_util::GetStringFUTF16( 174 description.assign(l10n_util::GetStringFUTF16(
167 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_CONNECTION_TEXT, 175 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_CONNECTION_TEXT,
168 subject_name, 176 subject_name,
169 base::IntToString16(ssl.security_bits()))); 177 base::IntToString16(ssl.security_bits())));
170 if (ssl.displayed_insecure_content() || ssl.ran_insecure_content()) { 178 if (ssl.displayed_insecure_content() || ssl.ran_insecure_content()) {
171 // The old SSL dialog only had good and bad state, so for the old 179 // The old SSL dialog only had good and bad state, so for the old
172 // implementation we raise an error on finding mixed content. The new 180 // implementation we raise an error on finding mixed content. The new
173 // SSL info bubble has a warning state for displaying insecure content, 181 // SSL info bubble has a warning state for displaying insecure content,
174 // so we check. The command line check will go away once we eliminate 182 // so we check. The command line check will go away once we eliminate
175 // the old dialogs. 183 // the old dialogs.
176 const CommandLine* command_line(CommandLine::ForCurrentProcess()); 184 const CommandLine* command_line(CommandLine::ForCurrentProcess());
177 if (command_line->HasSwitch(switches::kEnableNewPageInfoBubble) && 185 if (command_line->HasSwitch(switches::kEnableNewPageInfoBubble) &&
178 !ssl.ran_insecure_content()) { 186 !ssl.ran_insecure_content()) {
179 state = SECTION_STATE_WARNING_MINOR; 187 icon_id = ICON_STATE_WARNING_MINOR;
180 } else { 188 } else {
181 state = SECTION_STATE_ERROR; 189 icon_id = ICON_STATE_ERROR;
182 } 190 }
183 description.assign(l10n_util::GetStringFUTF16( 191 description.assign(l10n_util::GetStringFUTF16(
184 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_SENTENCE_LINK, 192 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_SENTENCE_LINK,
185 description, 193 description,
186 l10n_util::GetStringUTF16(ssl.ran_insecure_content() ? 194 l10n_util::GetStringUTF16(ssl.ran_insecure_content() ?
187 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_ERROR : 195 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_ERROR :
188 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_WARNING))); 196 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_WARNING)));
189 } 197 }
190 } 198 }
191 199
(...skipping 22 matching lines...) Expand all
214 description += l10n_util::GetStringFUTF16( 222 description += l10n_util::GetStringFUTF16(
215 IDS_PAGE_INFO_SECURITY_TAB_COMPRESSION_DETAILS, 223 IDS_PAGE_INFO_SECURITY_TAB_COMPRESSION_DETAILS,
216 ASCIIToUTF16(compression)); 224 ASCIIToUTF16(compression));
217 } else { 225 } else {
218 description += l10n_util::GetStringUTF16( 226 description += l10n_util::GetStringUTF16(
219 IDS_PAGE_INFO_SECURITY_TAB_NO_COMPRESSION); 227 IDS_PAGE_INFO_SECURITY_TAB_NO_COMPRESSION);
220 } 228 }
221 229
222 if (did_fallback) { 230 if (did_fallback) {
223 // For now, only SSLv3 fallback will trigger a warning icon. 231 // For now, only SSLv3 fallback will trigger a warning icon.
224 state = SECTION_STATE_ERROR; 232 icon_id = ICON_STATE_ERROR;
225 description += ASCIIToUTF16("\n\n"); 233 description += ASCIIToUTF16("\n\n");
226 description += l10n_util::GetStringUTF16( 234 description += l10n_util::GetStringUTF16(
227 IDS_PAGE_INFO_SECURITY_TAB_FALLBACK_MESSAGE); 235 IDS_PAGE_INFO_SECURITY_TAB_FALLBACK_MESSAGE);
228 } 236 }
229 if (no_renegotiation) { 237 if (no_renegotiation) {
230 description += ASCIIToUTF16("\n\n"); 238 description += ASCIIToUTF16("\n\n");
231 description += l10n_util::GetStringUTF16( 239 description += l10n_util::GetStringUTF16(
232 IDS_PAGE_INFO_SECURITY_TAB_RENEGOTIATION_MESSAGE); 240 IDS_PAGE_INFO_SECURITY_TAB_RENEGOTIATION_MESSAGE);
233 } 241 }
234 } 242 }
235 243
236 if (!description.empty()) { 244 if (!description.empty()) {
237 sections_.push_back(SectionInfo( 245 sections_.push_back(SectionInfo(
238 state, 246 icon_id,
239 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_CONNECTION_TITLE), 247 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_CONNECTION_TITLE),
240 headline, 248 headline,
241 description, 249 description,
242 SECTION_INFO_CONNECTION)); 250 SECTION_INFO_CONNECTION));
243 } 251 }
244 252
245 // Request the number of visits. 253 // Request the number of visits.
246 HistoryService* history = profile->GetHistoryService( 254 HistoryService* history = profile->GetHistoryService(
247 Profile::EXPLICIT_ACCESS); 255 Profile::EXPLICIT_ACCESS);
248 if (show_history && history) { 256 if (show_history && history) {
249 history->GetVisitCountToHost( 257 history->GetVisitCountToHost(
250 url, 258 url,
251 &request_consumer_, 259 &request_consumer_,
252 NewCallback(this, &PageInfoModel::OnGotVisitCountToHost)); 260 NewCallback(this, &PageInfoModel::OnGotVisitCountToHost));
253 } 261 }
254 } 262 }
255 263
256 PageInfoModel::~PageInfoModel() { 264 PageInfoModel::~PageInfoModel() {
265 #if defined(OS_MACOSX)
266 // Release the NSImages.
267 for (std::vector<ImageType>::iterator it = icons_.begin();
268 it != icons_.end(); ++it) {
269 mac_util::NSObjectRelease(*it);
270 }
271 #endif
257 } 272 }
258 273
259 int PageInfoModel::GetSectionCount() { 274 int PageInfoModel::GetSectionCount() {
260 return sections_.size(); 275 return sections_.size();
261 } 276 }
262 277
263 PageInfoModel::SectionInfo PageInfoModel::GetSectionInfo(int index) { 278 PageInfoModel::SectionInfo PageInfoModel::GetSectionInfo(int index) {
264 DCHECK(index < static_cast<int>(sections_.size())); 279 DCHECK(index < static_cast<int>(sections_.size()));
265 return sections_[index]; 280 return sections_[index];
266 } 281 }
267 282
283 PageInfoModel::ImageType PageInfoModel::GetIconImage(SectionStateIcon icon_id) {
284 if (icon_id == ICON_NONE)
285 return NULL;
286 // TODO(rsesek): Remove once the window is replaced with the bubble.
287 const CommandLine* command_line(CommandLine::ForCurrentProcess());
288 if (!command_line->HasSwitch(switches::kEnableNewPageInfoBubble) &&
289 icon_id != ICON_STATE_OK) {
290 return icons_[ICON_STATE_WARNING_MAJOR];
291 }
292 // The buble uses new, various icons.
293 return icons_[icon_id];
294 }
295
268 void PageInfoModel::OnGotVisitCountToHost(HistoryService::Handle handle, 296 void PageInfoModel::OnGotVisitCountToHost(HistoryService::Handle handle,
269 bool found_visits, 297 bool found_visits,
270 int count, 298 int count,
271 base::Time first_visit) { 299 base::Time first_visit) {
272 if (!found_visits) { 300 if (!found_visits) {
273 // This indicates an error, such as the page wasn't http/https; do nothing. 301 // This indicates an error, such as the page wasn't http/https; do nothing.
274 return; 302 return;
275 } 303 }
276 304
277 bool visited_before_today = false; 305 bool visited_before_today = false;
278 if (count) { 306 if (count) {
279 base::Time today = base::Time::Now().LocalMidnight(); 307 base::Time today = base::Time::Now().LocalMidnight();
280 base::Time first_visit_midnight = first_visit.LocalMidnight(); 308 base::Time first_visit_midnight = first_visit.LocalMidnight();
281 visited_before_today = (first_visit_midnight < today); 309 visited_before_today = (first_visit_midnight < today);
282 } 310 }
283 311
284 // We only show the Site Information heading for the new dialogs. 312 // We only show the Site Information heading for the new dialogs.
285 string16 title; 313 string16 title;
286 const CommandLine* command_line(CommandLine::ForCurrentProcess()); 314 const CommandLine* command_line(CommandLine::ForCurrentProcess());
287 if (command_line->HasSwitch(switches::kEnableNewPageInfoBubble)) 315 bool as_bubble = command_line->HasSwitch(switches::kEnableNewPageInfoBubble);
316 if (as_bubble)
288 title = l10n_util::GetStringUTF16(IDS_PAGE_INFO_SITE_INFO_TITLE); 317 title = l10n_util::GetStringUTF16(IDS_PAGE_INFO_SITE_INFO_TITLE);
289 318
290 if (!visited_before_today) { 319 if (!visited_before_today) {
291 sections_.push_back(SectionInfo( 320 sections_.push_back(SectionInfo(
292 SECTION_STATE_ERROR, 321 ICON_STATE_WARNING_MAJOR,
293 l10n_util::GetStringUTF16( 322 l10n_util::GetStringUTF16(
294 IDS_PAGE_INFO_SECURITY_TAB_PERSONAL_HISTORY_TITLE), 323 IDS_PAGE_INFO_SECURITY_TAB_PERSONAL_HISTORY_TITLE),
295 title, 324 title,
296 l10n_util::GetStringUTF16( 325 l10n_util::GetStringUTF16(
297 IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY), 326 IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY),
298 SECTION_INFO_FIRST_VISIT)); 327 SECTION_INFO_FIRST_VISIT));
299 } else { 328 } else {
300 sections_.push_back(SectionInfo( 329 sections_.push_back(SectionInfo(
301 SECTION_STATE_OK, 330 // TODO(rsesek): Remove once the window is replaced with the bubble.
331 as_bubble ? ICON_STATE_INFO : ICON_STATE_OK,
302 l10n_util::GetStringUTF16( 332 l10n_util::GetStringUTF16(
303 IDS_PAGE_INFO_SECURITY_TAB_PERSONAL_HISTORY_TITLE), 333 IDS_PAGE_INFO_SECURITY_TAB_PERSONAL_HISTORY_TITLE),
304 title, 334 title,
305 l10n_util::GetStringFUTF16( 335 l10n_util::GetStringFUTF16(
306 IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY, 336 IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY,
307 WideToUTF16(base::TimeFormatShortDate(first_visit))), 337 WideToUTF16(base::TimeFormatShortDate(first_visit))),
308 SECTION_INFO_FIRST_VISIT)); 338 SECTION_INFO_FIRST_VISIT));
309 } 339 }
310 observer_->ModelChanged(); 340 observer_->ModelChanged();
311 } 341 }
312 342
313 // static 343 // static
314 void PageInfoModel::RegisterPrefs(PrefService* prefs) { 344 void PageInfoModel::RegisterPrefs(PrefService* prefs) {
315 prefs->RegisterDictionaryPref(prefs::kPageInfoWindowPlacement); 345 prefs->RegisterDictionaryPref(prefs::kPageInfoWindowPlacement);
316 } 346 }
317 347
318 PageInfoModel::PageInfoModel() { 348 PageInfoModel::PageInfoModel() {
349 Init();
319 } 350 }
351
352 void PageInfoModel::Init() {
353 // Loads the icons into the vector. The order must match the SectionStateIcon
354 // enum.
355 icons_.push_back(GetBitmapNamed(IDR_PAGEINFO_GOOD));
356 icons_.push_back(GetBitmapNamed(IDR_PAGEINFO_WARNING_MINOR));
357 icons_.push_back(GetBitmapNamed(IDR_PAGEINFO_WARNING_MAJOR));
358 icons_.push_back(GetBitmapNamed(IDR_PAGEINFO_BAD));
359 icons_.push_back(GetBitmapNamed(IDR_PAGEINFO_INFO));
360 }
361
362 PageInfoModel::ImageType PageInfoModel::GetBitmapNamed(int resource_id) {
363 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
364 #if defined(OS_MACOSX)
365 // Unlike other platforms, the Mac ResourceBundle does not keep a shared image
366 // cache. These are released in the dtor.
367 ImageType image = rb.GetNSImageNamed(resource_id);
368 mac_util::NSObjectRetain(image);
369 return image;
370 #elif defined(USE_X11) && !defined(TOOLKIT_VIEWS)
371 return rb.GetPixbufNamed(resource_id);
372 #else
373 return rb.GetBitmapNamed(resource_id);
374 #endif
375 }
OLDNEW
« no previous file with comments | « chrome/browser/page_info_model.h ('k') | chrome/browser/views/page_info_bubble_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698