| OLD | NEW |
| 1 // Copyright (c) 2006-2008 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/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" | |
| 10 | |
| 11 PageUsageData::PageUsageData(history::URLID id) | 9 PageUsageData::PageUsageData(history::URLID id) |
| 12 : id_(id), | 10 : 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) { | 11 score_(0.0) { |
| 20 } | 12 } |
| 21 | 13 |
| 22 PageUsageData::~PageUsageData() { | 14 PageUsageData::~PageUsageData() { |
| 23 delete thumbnail_; | |
| 24 delete favicon_; | |
| 25 } | |
| 26 | |
| 27 void PageUsageData::SetThumbnail(SkBitmap* img) { | |
| 28 if (thumbnail_ && thumbnail_ != img) | |
| 29 delete thumbnail_; | |
| 30 | |
| 31 thumbnail_ = img; | |
| 32 thumbnail_set_ = true; | |
| 33 } | |
| 34 | |
| 35 void PageUsageData::SetFavicon(SkBitmap* img) { | |
| 36 if (favicon_ && favicon_ != img) | |
| 37 delete favicon_; | |
| 38 favicon_ = img; | |
| 39 favicon_set_ = true; | |
| 40 } | 15 } |
| 41 | 16 |
| 42 // static | 17 // static |
| 43 bool PageUsageData::Predicate(const PageUsageData* lhs, | 18 bool PageUsageData::Predicate(const PageUsageData* lhs, |
| 44 const PageUsageData* rhs) { | 19 const PageUsageData* rhs) { |
| 45 return lhs->GetScore() > rhs->GetScore(); | 20 return lhs->GetScore() > rhs->GetScore(); |
| 46 } | 21 } |
| OLD | NEW |