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

Unified Diff: ui/app_list/search/history.cc

Issue 645853013: Remove some platform specific stuff from views. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 2 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 | « ui/app_list/search/history.h ('k') | ui/app_list/search/history_data.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/search/history.cc
diff --git a/ui/app_list/search/history.cc b/ui/app_list/search/history.cc
deleted file mode 100644
index 6c540246ff7b220f0b554406d77502a7b91eba59..0000000000000000000000000000000000000000
--- a/ui/app_list/search/history.cc
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2013 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 "ui/app_list/search/history.h"
-
-#include "base/strings/string_util.h"
-#include "base/strings/utf_string_conversions.h"
-#include "ui/app_list/search/history_data.h"
-#include "ui/app_list/search/history_data_store.h"
-#include "ui/app_list/search/tokenized_string.h"
-
-namespace app_list {
-
-namespace {
-
-// Normalize the given string by joining all its tokens with a space.
-std::string NormalizeString(const std::string& utf8) {
- TokenizedString tokenized(base::UTF8ToUTF16(utf8));
- return base::UTF16ToUTF8(JoinString(tokenized.tokens(), ' '));
-}
-
-} // namespace
-
-History::History(scoped_refptr<HistoryDataStore> store)
- : store_(store), data_loaded_(false) {
- const size_t kMaxQueryEntries = 1000;
- const size_t kMaxSecondaryQueries = 5;
-
- data_.reset(
- new HistoryData(store_.get(), kMaxQueryEntries, kMaxSecondaryQueries));
- data_->AddObserver(this);
-}
-
-History::~History() {
- data_->RemoveObserver(this);
-}
-
-bool History::IsReady() const {
- return data_loaded_;
-}
-
-void History::AddLaunchEvent(const std::string& query,
- const std::string& result_id) {
- DCHECK(IsReady());
- data_->Add(NormalizeString(query), result_id);
-}
-
-scoped_ptr<KnownResults> History::GetKnownResults(
- const std::string& query) const {
- DCHECK(IsReady());
- return data_->GetKnownResults(NormalizeString(query)).Pass();
-}
-
-void History::OnHistoryDataLoadedFromStore() {
- data_loaded_ = true;
-}
-
-} // namespace app_list
« no previous file with comments | « ui/app_list/search/history.h ('k') | ui/app_list/search/history_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698