summaryrefslogtreecommitdiffstats
path: root/chrome/browser/bookmarks
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-09 18:13:23 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-09 18:13:23 +0000
commit76624fdeda4c8409a6bfd8a5f48de00dbceb0760 (patch)
tree22bd8e87cf465edae499dfd6db54ee53372fceb5 /chrome/browser/bookmarks
parentcf3962da7f15177d96837194323141d64f279c81 (diff)
downloadchromium_src-76624fdeda4c8409a6bfd8a5f48de00dbceb0760.zip
chromium_src-76624fdeda4c8409a6bfd8a5f48de00dbceb0760.tar.gz
chromium_src-76624fdeda4c8409a6bfd8a5f48de00dbceb0760.tar.bz2
Allow the NTP to be bookmarked.
BUG=none TEST=Try to bookmark the NTP. Review URL: http://codereview.chromium.org/269028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28564 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/bookmarks')
-rw-r--r--chrome/browser/bookmarks/bookmark_utils.cc18
-rw-r--r--chrome/browser/bookmarks/bookmark_utils.h5
2 files changed, 7 insertions, 16 deletions
diff --git a/chrome/browser/bookmarks/bookmark_utils.cc b/chrome/browser/bookmarks/bookmark_utils.cc
index edc3a46..e64c42d 100644
--- a/chrome/browser/bookmarks/bookmark_utils.cc
+++ b/chrome/browser/bookmarks/bookmark_utils.cc
@@ -611,19 +611,11 @@ void RegisterUserPrefs(PrefService* prefs) {
prefs->RegisterIntegerPref(prefs::kBookmarkTablePathWidth, -1);
}
-bool GetURLAndTitleToBookmark(TabContents* tab_contents,
+void GetURLAndTitleToBookmark(TabContents* tab_contents,
GURL* url,
std::wstring* title) {
- if (!tab_contents || !tab_contents->ShouldDisplayURL())
- return false;
- GURL tab_url = tab_contents->GetURL();
- if (!tab_url.is_valid())
- return false;
- if (url != NULL)
- *url = tab_url;
- if (title != NULL)
- *title = UTF16ToWideHack(tab_contents->GetTitle());
- return true;
+ *url = tab_contents->GetURL();
+ *title = UTF16ToWideHack(tab_contents->GetTitle());
}
const BookmarkNode* CreateBookmarkForAllTabs(Browser* browser) {
@@ -636,8 +628,8 @@ const BookmarkNode* CreateBookmarkForAllTabs(Browser* browser) {
for (int i = 0; i < browser->tab_count(); ++i) {
GURL url;
std::wstring title;
- if (GetURLAndTitleToBookmark(browser->GetTabContentsAt(i), &url, &title))
- model->AddURL(folder, folder->GetChildCount(), title, url);
+ GetURLAndTitleToBookmark(browser->GetTabContentsAt(i), &url, &title);
+ model->AddURL(folder, folder->GetChildCount(), title, url);
}
return folder;
}
diff --git a/chrome/browser/bookmarks/bookmark_utils.h b/chrome/browser/bookmarks/bookmark_utils.h
index 0b5718d..116d41f 100644
--- a/chrome/browser/bookmarks/bookmark_utils.h
+++ b/chrome/browser/bookmarks/bookmark_utils.h
@@ -182,9 +182,8 @@ void RegisterPrefs(PrefService* prefs);
// Register user prefs for BookmarkBar, BookmarkView, ...
void RegisterUserPrefs(PrefService* prefs);
-// Returns whether |tab_contents| can be bookmarked. If it can, |url| and
-// |title| are filled in. Any of the parameters may be NULL.
-bool GetURLAndTitleToBookmark(TabContents* tab_contents,
+// Fills in the URL and title for a bookmark of |tab_contents|.
+void GetURLAndTitleToBookmark(TabContents* tab_contents,
GURL* url,
std::wstring* title);