OLD | NEW |
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 "app/resource_bundle.h" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 headline, | 322 headline, |
323 l10n_util::GetStringUTF16( | 323 l10n_util::GetStringUTF16( |
324 IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY), | 324 IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY), |
325 SECTION_INFO_FIRST_VISIT)); | 325 SECTION_INFO_FIRST_VISIT)); |
326 } else { | 326 } else { |
327 sections_.push_back(SectionInfo( | 327 sections_.push_back(SectionInfo( |
328 ICON_STATE_INFO, | 328 ICON_STATE_INFO, |
329 headline, | 329 headline, |
330 l10n_util::GetStringFUTF16( | 330 l10n_util::GetStringFUTF16( |
331 IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY, | 331 IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY, |
332 WideToUTF16(base::TimeFormatShortDate(first_visit))), | 332 base::TimeFormatShortDate(first_visit)), |
333 SECTION_INFO_FIRST_VISIT)); | 333 SECTION_INFO_FIRST_VISIT)); |
334 } | 334 } |
335 observer_->ModelChanged(); | 335 observer_->ModelChanged(); |
336 } | 336 } |
337 | 337 |
338 PageInfoModel::PageInfoModel() : observer_(NULL) { | 338 PageInfoModel::PageInfoModel() : observer_(NULL) { |
339 Init(); | 339 Init(); |
340 } | 340 } |
341 | 341 |
342 void PageInfoModel::Init() { | 342 void PageInfoModel::Init() { |
343 // Loads the icons into the vector. The order must match the SectionStateIcon | 343 // Loads the icons into the vector. The order must match the SectionStateIcon |
344 // enum. | 344 // enum. |
345 icons_.push_back(GetBitmapNamed(IDR_PAGEINFO_GOOD)); | 345 icons_.push_back(GetBitmapNamed(IDR_PAGEINFO_GOOD)); |
346 icons_.push_back(GetBitmapNamed(IDR_PAGEINFO_WARNING_MINOR)); | 346 icons_.push_back(GetBitmapNamed(IDR_PAGEINFO_WARNING_MINOR)); |
347 icons_.push_back(GetBitmapNamed(IDR_PAGEINFO_WARNING_MAJOR)); | 347 icons_.push_back(GetBitmapNamed(IDR_PAGEINFO_WARNING_MAJOR)); |
348 icons_.push_back(GetBitmapNamed(IDR_PAGEINFO_BAD)); | 348 icons_.push_back(GetBitmapNamed(IDR_PAGEINFO_BAD)); |
349 icons_.push_back(GetBitmapNamed(IDR_PAGEINFO_INFO)); | 349 icons_.push_back(GetBitmapNamed(IDR_PAGEINFO_INFO)); |
350 } | 350 } |
351 | 351 |
352 gfx::NativeImage PageInfoModel::GetBitmapNamed(int resource_id) { | 352 gfx::NativeImage PageInfoModel::GetBitmapNamed(int resource_id) { |
353 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 353 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
354 gfx::NativeImage image = rb.GetNativeImageNamed(resource_id); | 354 gfx::NativeImage image = rb.GetNativeImageNamed(resource_id); |
355 #if defined(OS_MACOSX) | 355 #if defined(OS_MACOSX) |
356 // Unlike other platforms, the Mac ResourceBundle does not keep a shared image | 356 // Unlike other platforms, the Mac ResourceBundle does not keep a shared image |
357 // cache. These are released in the dtor. | 357 // cache. These are released in the dtor. |
358 mac_util::NSObjectRetain(image); | 358 mac_util::NSObjectRetain(image); |
359 #endif | 359 #endif |
360 return image; | 360 return image; |
361 } | 361 } |
OLD | NEW |