| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/history/page_usage_data.h" | 5 #include "chrome/browser/history/page_usage_data.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "third_party/skia/include/core/SkBitmap.h" | 9 #include "third_party/skia/include/core/SkBitmap.h" |
| 10 | 10 |
| 11 PageUsageData::PageUsageData(history::URLID id) |
| 12 : id_(id), |
| 13 thumbnail_(NULL), |
| 14 thumbnail_set_(false), |
| 15 thumbnail_pending_(false), |
| 16 favicon_(NULL), |
| 17 favicon_set_(false), |
| 18 favicon_pending_(false), |
| 19 score_(0.0) { |
| 20 } |
| 21 |
| 11 PageUsageData::~PageUsageData() { | 22 PageUsageData::~PageUsageData() { |
| 12 delete thumbnail_; | 23 delete thumbnail_; |
| 13 delete favicon_; | 24 delete favicon_; |
| 14 } | 25 } |
| 15 | 26 |
| 16 void PageUsageData::SetThumbnail(SkBitmap* img) { | 27 void PageUsageData::SetThumbnail(SkBitmap* img) { |
| 17 if (thumbnail_ && thumbnail_ != img) | 28 if (thumbnail_ && thumbnail_ != img) |
| 18 delete thumbnail_; | 29 delete thumbnail_; |
| 19 | 30 |
| 20 thumbnail_ = img; | 31 thumbnail_ = img; |
| 21 thumbnail_set_ = true; | 32 thumbnail_set_ = true; |
| 22 } | 33 } |
| 23 | 34 |
| 24 void PageUsageData::SetFavIcon(SkBitmap* img) { | 35 void PageUsageData::SetFavIcon(SkBitmap* img) { |
| 25 if (favicon_ && favicon_ != img) | 36 if (favicon_ && favicon_ != img) |
| 26 delete favicon_; | 37 delete favicon_; |
| 27 favicon_ = img; | 38 favicon_ = img; |
| 28 favicon_set_ = true; | 39 favicon_set_ = true; |
| 29 } | 40 } |
| 30 | 41 |
| 31 // static | 42 // static |
| 32 bool PageUsageData::Predicate(const PageUsageData* lhs, | 43 bool PageUsageData::Predicate(const PageUsageData* lhs, |
| 33 const PageUsageData* rhs) { | 44 const PageUsageData* rhs) { |
| 34 return lhs->GetScore() > rhs->GetScore(); | 45 return lhs->GetScore() > rhs->GetScore(); |
| 35 } | 46 } |
| OLD | NEW |