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

Unified Diff: chrome/browser/history/android/android_history_types.cc

Issue 584013002: Componentize history_types.{cc,h} and android_history_types.{cc,h} (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 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
Index: chrome/browser/history/android/android_history_types.cc
diff --git a/chrome/browser/history/android/android_history_types.cc b/chrome/browser/history/android/android_history_types.cc
deleted file mode 100644
index b58724918f0f847c42cfbc594f204fcdcf5aeae8..0000000000000000000000000000000000000000
--- a/chrome/browser/history/android/android_history_types.cc
+++ /dev/null
@@ -1,143 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/history/android/android_history_types.h"
-
-namespace history {
-
-namespace {
-// The column name defined in android.provider.Browser.BookmarkColumns
-const char* const kAndroidBookmarkColumn[] = {
- "_id",
- "url",
- "title",
- "created",
- "date",
- "visits",
- "favicon",
- "bookmark",
- "raw_url",
-};
-
-// The column name defined in android.provider.Browser.SearchColumns
-const char* const kAndroidSearchColumn[] = {
- "_id",
- "search",
- "date",
-};
-
-class BookmarkIDMapping : public std::map<std::string,
- HistoryAndBookmarkRow::ColumnID> {
- public:
- BookmarkIDMapping() {
- COMPILE_ASSERT(arraysize(kAndroidBookmarkColumn) <=
- HistoryAndBookmarkRow::COLUMN_END,
- Array_size_must_not_exceed_enum);
- for (size_t i = 0; i < arraysize(kAndroidBookmarkColumn); ++i) {
- (*this)[kAndroidBookmarkColumn[i]] =
- static_cast<HistoryAndBookmarkRow::ColumnID>(i);
- }
- }
-};
-
-// The mapping from Android column name to ColumnID; It is initialized
-// once it used.
-BookmarkIDMapping* g_bookmark_id_mapping = NULL;
-
-class SearchIDMapping : public std::map<std::string,
- SearchRow::ColumnID> {
- public:
- SearchIDMapping() {
- COMPILE_ASSERT(arraysize(kAndroidSearchColumn) <= SearchRow::COLUMN_END,
- Array_size_must_not_exceed_enum);
- for (size_t i = 0; i < arraysize(kAndroidSearchColumn); ++i) {
- (*this)[kAndroidSearchColumn[i]] =
- static_cast<SearchRow::ColumnID>(i);
- }
- }
-};
-
-// The mapping from Android column name to ColumnID; It is initialized
-// once it used.
-SearchIDMapping* g_search_id_mapping = NULL;
-
-} // namespace
-
-HistoryAndBookmarkRow::HistoryAndBookmarkRow()
- : id_(0),
- created_(base::Time()),
- last_visit_time_(base::Time()),
- visit_count_(0),
- is_bookmark_(false),
- parent_id_(0),
- url_id_(0) {
-}
-
-HistoryAndBookmarkRow::~HistoryAndBookmarkRow() {
-}
-
-std::string HistoryAndBookmarkRow::GetAndroidName(ColumnID id) {
- return kAndroidBookmarkColumn[id];
-}
-
-HistoryAndBookmarkRow::ColumnID HistoryAndBookmarkRow::GetColumnID(
- const std::string& name) {
- if (!g_bookmark_id_mapping)
- g_bookmark_id_mapping = new BookmarkIDMapping();
-
- BookmarkIDMapping::const_iterator i = g_bookmark_id_mapping->find(name);
- if (i == g_bookmark_id_mapping->end())
- return HistoryAndBookmarkRow::COLUMN_END;
- else
- return i->second;
-}
-
-SearchRow::SearchRow()
- : id_(0),
- keyword_id_(0) {
-}
-
-SearchRow::~SearchRow() {
-}
-
-std::string SearchRow::GetAndroidName(ColumnID id) {
- return kAndroidSearchColumn[id];
-}
-
-SearchRow::ColumnID SearchRow::GetColumnID(
- const std::string& name) {
- if (!g_search_id_mapping)
- g_search_id_mapping = new SearchIDMapping();
-
- SearchIDMapping::const_iterator i = g_search_id_mapping->find(name);
- if (i == g_search_id_mapping->end())
- return SearchRow:: COLUMN_END;
- else
- return i->second;
-}
-
-AndroidURLRow::AndroidURLRow()
- : id(0),
- url_id(0) {
-}
-
-AndroidURLRow::~AndroidURLRow() {
-}
-
-SearchTermRow::SearchTermRow()
- : id(0) {
-}
-
-SearchTermRow::~SearchTermRow() {
-}
-
-AndroidStatement::AndroidStatement(sql::Statement* statement, int favicon_index)
- : statement_(statement),
- favicon_index_(favicon_index) {
-}
-
-AndroidStatement::~AndroidStatement() {
-}
-
-} // namespace history.

Powered by Google App Engine
This is Rietveld 408576698