Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(345)

Unified Diff: chrome/browser/dom_ui/most_visited_handler.cc

Issue 3061009: Speculative fix for crash in DOMUIThumbnailSource. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: msvc++ caught this Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/dom_ui/most_visited_handler.h ('k') | chrome/browser/dom_ui/new_tab_ui.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/dom_ui/most_visited_handler.cc
diff --git a/chrome/browser/dom_ui/most_visited_handler.cc b/chrome/browser/dom_ui/most_visited_handler.cc
index 401827ae232333272db6b84a8bb72afcc2cfb4e1..93c9d174ba666c3bcbfa62f3be5e76eea1bd0dbf 100644
--- a/chrome/browser/dom_ui/most_visited_handler.cc
+++ b/chrome/browser/dom_ui/most_visited_handler.cc
@@ -33,6 +33,7 @@
#include "chrome/common/notification_type.h"
#include "chrome/common/notification_source.h"
#include "chrome/common/pref_names.h"
+#include "googleurl/src/gurl.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
@@ -45,18 +46,17 @@ const size_t kMostVisitedPages = 8;
// The number of days of history we consider for most visited entries.
const int kMostVisitedScope = 90;
-// Adds the fields in the page to the dictionary.
-void SetMostVisistedPage(DictionaryValue* dict,
- const MostVisitedHandler::MostVisitedPage& page) {
- NewTabUI::SetURLTitleAndDirection(dict, WideToUTF16(page.title), page.url);
- if (!page.favicon_url.is_empty())
- dict->SetString(L"faviconUrl", page.favicon_url.spec());
- if (!page.thumbnail_url.is_empty())
- dict->SetString(L"thumbnailUrl", page.thumbnail_url.spec());
-}
-
} // namespace
+// This struct is used when getting the pre-populated pages in case the user
+// hasn't filled up his most visited pages.
+struct MostVisitedHandler::MostVisitedPage {
+ std::wstring title;
+ GURL url;
+ GURL thumbnail_url;
+ GURL favicon_url;
+};
+
MostVisitedHandler::MostVisitedHandler()
: url_blacklist_(NULL),
pinned_urls_(NULL),
@@ -541,6 +541,18 @@ bool MostVisitedHandler::IsFirstRun() {
}
// static
+void MostVisitedHandler::SetMostVisistedPage(
+ DictionaryValue* dict,
+ const MostVisitedHandler::MostVisitedPage& page) {
+ NewTabUI::SetURLTitleAndDirection(dict, WideToUTF16(page.title), page.url);
+ if (!page.favicon_url.is_empty())
+ dict->SetString(L"faviconUrl", page.favicon_url.spec());
+ if (!page.thumbnail_url.is_empty())
+ dict->SetString(L"thumbnailUrl", page.thumbnail_url.spec());
+}
+
+
+// static
const std::vector<MostVisitedHandler::MostVisitedPage>&
MostVisitedHandler::GetPrePopulatedPages() {
// TODO(arv): This needs to get the data from some configurable place.
« no previous file with comments | « chrome/browser/dom_ui/most_visited_handler.h ('k') | chrome/browser/dom_ui/new_tab_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698