| OLD | NEW |
| 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/page_info_model.h" | 5 #include "chrome/browser/page_info_model.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 // Request the number of visits. | 280 // Request the number of visits. |
| 281 HistoryService* history = profile->GetHistoryService( | 281 HistoryService* history = profile->GetHistoryService( |
| 282 Profile::EXPLICIT_ACCESS); | 282 Profile::EXPLICIT_ACCESS); |
| 283 if (show_history && history) { | 283 if (show_history && history) { |
| 284 history->GetVisibleVisitCountToHost( | 284 history->GetVisibleVisitCountToHost( |
| 285 url, | 285 url, |
| 286 &request_consumer_, | 286 &request_consumer_, |
| 287 base::Bind(&PageInfoModel::OnGotVisitCountToHost, | 287 base::Bind(&PageInfoModel::OnGotVisitCountToHost, |
| 288 base::Unretained(this))); | 288 base::Unretained(this))); |
| 289 } | 289 } |
| 290 |
| 291 if (ssl.cert_id) { |
| 292 certificate_label_ = l10n_util::GetStringUTF16( |
| 293 IDS_PAGEINFO_CERT_INFO_BUTTON); |
| 294 } |
| 290 } | 295 } |
| 291 | 296 |
| 292 PageInfoModel::~PageInfoModel() {} | 297 PageInfoModel::~PageInfoModel() {} |
| 293 | 298 |
| 294 int PageInfoModel::GetSectionCount() { | 299 int PageInfoModel::GetSectionCount() { |
| 295 return sections_.size(); | 300 return sections_.size(); |
| 296 } | 301 } |
| 297 | 302 |
| 298 PageInfoModel::SectionInfo PageInfoModel::GetSectionInfo(int index) { | 303 PageInfoModel::SectionInfo PageInfoModel::GetSectionInfo(int index) { |
| 299 DCHECK(index < static_cast<int>(sections_.size())); | 304 DCHECK(index < static_cast<int>(sections_.size())); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 ICON_STATE_INFO, | 342 ICON_STATE_INFO, |
| 338 headline, | 343 headline, |
| 339 l10n_util::GetStringFUTF16( | 344 l10n_util::GetStringFUTF16( |
| 340 IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY, | 345 IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY, |
| 341 base::TimeFormatShortDate(first_visit)), | 346 base::TimeFormatShortDate(first_visit)), |
| 342 SECTION_INFO_FIRST_VISIT)); | 347 SECTION_INFO_FIRST_VISIT)); |
| 343 } | 348 } |
| 344 observer_->OnPageInfoModelChanged(); | 349 observer_->OnPageInfoModelChanged(); |
| 345 } | 350 } |
| 346 | 351 |
| 352 string16 PageInfoModel::GetCertificateLabel() const { |
| 353 return certificate_label_; |
| 354 } |
| 355 |
| 347 PageInfoModel::PageInfoModel() : observer_(NULL) { | 356 PageInfoModel::PageInfoModel() : observer_(NULL) { |
| 348 Init(); | 357 Init(); |
| 349 } | 358 } |
| 350 | 359 |
| 351 void PageInfoModel::Init() { | 360 void PageInfoModel::Init() { |
| 352 // Loads the icons into the vector. The order must match the SectionStateIcon | 361 // Loads the icons into the vector. The order must match the SectionStateIcon |
| 353 // enum. | 362 // enum. |
| 354 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 363 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 355 icons_.push_back(&rb.GetNativeImageNamed(IDR_PAGEINFO_GOOD)); | 364 icons_.push_back(&rb.GetNativeImageNamed(IDR_PAGEINFO_GOOD)); |
| 356 icons_.push_back(&rb.GetNativeImageNamed(IDR_PAGEINFO_WARNING_MINOR)); | 365 icons_.push_back(&rb.GetNativeImageNamed(IDR_PAGEINFO_WARNING_MINOR)); |
| 357 icons_.push_back(&rb.GetNativeImageNamed(IDR_PAGEINFO_WARNING_MAJOR)); | 366 icons_.push_back(&rb.GetNativeImageNamed(IDR_PAGEINFO_WARNING_MAJOR)); |
| 358 icons_.push_back(&rb.GetNativeImageNamed(IDR_PAGEINFO_BAD)); | 367 icons_.push_back(&rb.GetNativeImageNamed(IDR_PAGEINFO_BAD)); |
| 359 icons_.push_back(&rb.GetNativeImageNamed(IDR_PAGEINFO_INFO)); | 368 icons_.push_back(&rb.GetNativeImageNamed(IDR_PAGEINFO_INFO)); |
| 360 icons_.push_back(&rb.GetNativeImageNamed(IDR_PRODUCT_LOGO_26)); | 369 icons_.push_back(&rb.GetNativeImageNamed(IDR_PRODUCT_LOGO_26)); |
| 361 } | 370 } |
| OLD | NEW |