OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/possible_url_model.h" | 5 #include "chrome/browser/possible_url_model.h" |
6 | 6 |
7 #include "app/gfx/codec/png_codec.h" | 7 #include "app/gfx/codec/png_codec.h" |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
10 #include "app/table_model_observer.h" | 10 #include "app/table_model_observer.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 void PossibleURLModel::Reload(Profile *profile) { | 40 void PossibleURLModel::Reload(Profile *profile) { |
41 profile_ = profile; | 41 profile_ = profile; |
42 consumer_.CancelAllRequests(); | 42 consumer_.CancelAllRequests(); |
43 HistoryService* hs = | 43 HistoryService* hs = |
44 profile->GetHistoryService(Profile::EXPLICIT_ACCESS); | 44 profile->GetHistoryService(Profile::EXPLICIT_ACCESS); |
45 if (hs) { | 45 if (hs) { |
46 history::QueryOptions options; | 46 history::QueryOptions options; |
47 options.end_time = Time::Now(); | 47 options.end_time = Time::Now(); |
48 options.begin_time = | 48 options.begin_time = |
49 options.end_time - TimeDelta::FromDays(kPossibleURLTimeScope); | 49 options.end_time - TimeDelta::FromDays(kPossibleURLTimeScope); |
50 options.most_recent_visit_only = true; | |
51 options.max_count = 50; | 50 options.max_count = 50; |
52 | 51 |
53 hs->QueryHistory(std::wstring(), options, &consumer_, | 52 hs->QueryHistory(std::wstring(), options, &consumer_, |
54 NewCallback(this, &PossibleURLModel::OnHistoryQueryComplete)); | 53 NewCallback(this, &PossibleURLModel::OnHistoryQueryComplete)); |
55 } | 54 } |
56 } | 55 } |
57 | 56 |
58 void PossibleURLModel::OnHistoryQueryComplete(HistoryService::Handle h, | 57 void PossibleURLModel::OnHistoryQueryComplete(HistoryService::Handle h, |
59 history::QueryResults* result) { | 58 history::QueryResults* result) { |
60 results_.resize(result->size()); | 59 results_.resize(result->size()); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 // The decoder will leave our bitmap empty on error. | 177 // The decoder will leave our bitmap empty on error. |
179 gfx::PNGCodec::Decode(data->front(), data->size(), | 178 gfx::PNGCodec::Decode(data->front(), data->size(), |
180 &(fav_icon_map_[index])); | 179 &(fav_icon_map_[index])); |
181 | 180 |
182 // Notify the observer. | 181 // Notify the observer. |
183 if (!fav_icon_map_[index].isNull() && observer_) | 182 if (!fav_icon_map_[index].isNull() && observer_) |
184 observer_->OnItemsChanged(static_cast<int>(index), 1); | 183 observer_->OnItemsChanged(static_cast<int>(index), 1); |
185 } | 184 } |
186 } | 185 } |
187 } | 186 } |
OLD | NEW |