chromium/chrome/browser/ui/bookmarks/bookmark_stats.h

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_STATS_H_
#define CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_STATS_H_

#include "base/time/time.h"
#include "components/profile_metrics/browser_profile_type.h"

class Profile;

namespace bookmarks {
class BookmarkNode;
struct BookmarkNodeData;
}  // namespace bookmarks

// This enum is used for the Bookmarks.EntryPoint histogram.
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class BookmarkEntryPoint {};

// This enum is used for the Bookmarks.LaunchLocation histogram.
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class BookmarkLaunchLocation {};

// Captures information related to a bookmark's launch event. Used for metrics
// collection.
struct BookmarkLaunchAction {};
std::ostream& operator<<(std::ostream& out, const BookmarkLaunchAction& action);

// Records the launch of a bookmark for UMA purposes.
void RecordBookmarkLaunch(BookmarkLaunchLocation location,
                          profile_metrics::BrowserProfileType profile_type);

// Records the user launching all bookmarks in a folder (via middle-click, etc.)
// for UMA purposes.
void RecordBookmarkFolderLaunch(BookmarkLaunchLocation location);

// Records the user opening a folder of bookmarks for UMA purposes.
void RecordBookmarkFolderOpen(BookmarkLaunchLocation location);

// Records the user opening the apps page for UMA purposes.
void RecordBookmarkAppsPageOpen(BookmarkLaunchLocation location);

// Records that the user edited or renamed a bookmark.
void RecordBookmarkEdited(BookmarkLaunchLocation location);

// Records that the user removed a bookmark.
void RecordBookmarkRemoved(BookmarkLaunchLocation location);

// Records the user adding a bookmark via star action, drag and drop, via
// Bookmark this tab... and Bookmark all tabs... buttons. For the Bookmark
// open tabs... the action is recorded only once and not as many times as
// count of tabs that were bookmarked.
void RecordBookmarksAdded(const Profile* profile);

// Records the user bookmarking all tabs, along with the open tabs count.
void RecordBookmarkAllTabsWithTabsCount(const Profile* profile, int count);

// Records that a bookmark or bookmarks were dropped. Determines the type of
// drop operation based on the data and parent node.
void RecordBookmarkDropped(const bookmarks::BookmarkNodeData& data,
                           const bookmarks::BookmarkNode* parent_node,
                           bool is_reorder);

#endif  // CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_STATS_H_