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

Unified Diff: components/offline_pages/core/downloads/download_ui_adapter.cc

Issue 2489443002: Move all components/offline_pages/ files into component/offline_pages/core (Closed)
Patch Set: rebase Created 4 years 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: components/offline_pages/core/downloads/download_ui_adapter.cc
diff --git a/components/offline_pages/downloads/download_ui_adapter.cc b/components/offline_pages/core/downloads/download_ui_adapter.cc
similarity index 84%
rename from components/offline_pages/downloads/download_ui_adapter.cc
rename to components/offline_pages/core/downloads/download_ui_adapter.cc
index df7be3489f6bca4d4498821a4729b23d6b1efd25..92707e235ead5dc3e5ddb788ef1a6032cd4a8aa2 100644
--- a/components/offline_pages/downloads/download_ui_adapter.cc
+++ b/components/offline_pages/core/downloads/download_ui_adapter.cc
@@ -2,17 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "components/offline_pages/downloads/download_ui_adapter.h"
+#include "components/offline_pages/core/downloads/download_ui_adapter.h"
#include "base/bind.h"
#include "base/guid.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/threading/thread_task_runner_handle.h"
-#include "components/offline_pages/client_namespace_constants.h"
-#include "components/offline_pages/client_policy_controller.h"
-#include "components/offline_pages/downloads/download_ui_item.h"
-#include "components/offline_pages/offline_page_model.h"
+#include "components/offline_pages/core/client_namespace_constants.h"
+#include "components/offline_pages/core/client_policy_controller.h"
+#include "components/offline_pages/core/downloads/download_ui_item.h"
+#include "components/offline_pages/core/offline_page_model.h"
namespace offline_pages {
@@ -30,10 +30,9 @@ DownloadUIAdapter::DownloadUIAdapter(OfflinePageModel* model)
: model_(model),
state_(State::NOT_LOADED),
observers_count_(0),
- weak_ptr_factory_(this) {
-}
+ weak_ptr_factory_(this) {}
-DownloadUIAdapter::~DownloadUIAdapter() { }
+DownloadUIAdapter::~DownloadUIAdapter() {}
// static
DownloadUIAdapter* DownloadUIAdapter::FromOfflinePageModel(
@@ -59,9 +58,9 @@ void DownloadUIAdapter::AddObserver(Observer* observer) {
// Don't just invoke it from here to avoid reentrancy in the client.
if (state_ == State::LOADED) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::Bind(&DownloadUIAdapter::NotifyItemsLoaded,
- weak_ptr_factory_.GetWeakPtr(),
- base::Unretained(observer)));
+ FROM_HERE,
+ base::Bind(&DownloadUIAdapter::NotifyItemsLoaded,
+ weak_ptr_factory_.GetWeakPtr(), base::Unretained(observer)));
}
}
@@ -82,13 +81,12 @@ void DownloadUIAdapter::OfflinePageModelLoaded(OfflinePageModel* model) {
void DownloadUIAdapter::OfflinePageModelChanged(OfflinePageModel* model) {
DCHECK(model == model_);
- model_->GetAllPages(
- base::Bind(&DownloadUIAdapter::OnOfflinePagesChanged,
- weak_ptr_factory_.GetWeakPtr()));
+ model_->GetAllPages(base::Bind(&DownloadUIAdapter::OnOfflinePagesChanged,
+ weak_ptr_factory_.GetWeakPtr()));
}
-void DownloadUIAdapter::OfflinePageDeleted(
- int64_t offline_id, const ClientId& client_id) {
+void DownloadUIAdapter::OfflinePageDeleted(int64_t offline_id,
+ const ClientId& client_id) {
if (!IsVisibleInUI(client_id))
return;
std::string guid = client_id.id;
@@ -107,8 +105,8 @@ std::vector<const DownloadUIItem*> DownloadUIAdapter::GetAllItems() const {
return result;
}
-const DownloadUIItem*
- DownloadUIAdapter::GetItem(const std::string& guid) const {
+const DownloadUIItem* DownloadUIAdapter::GetItem(
+ const std::string& guid) const {
DownloadUIItems::const_iterator it = items_.find(guid);
if (it == items_.end())
return nullptr;
@@ -128,8 +126,7 @@ void DownloadUIAdapter::DeleteItem(const std::string& guid) {
weak_ptr_factory_.GetWeakPtr()));
}
-int64_t DownloadUIAdapter::GetOfflineIdByGuid(
- const std::string& guid) const {
+int64_t DownloadUIAdapter::GetOfflineIdByGuid(const std::string& guid) const {
// TODO(dimich): when requests are also in the cache, filter them out.
// Requests do not yet have offline ID.
DownloadUIItems::const_iterator it = items_.find(guid);
@@ -143,9 +140,8 @@ int64_t DownloadUIAdapter::GetOfflineIdByGuid(
void DownloadUIAdapter::LoadCache() {
// TODO(dimich): Add fetching from RequestQueue as well.
state_ = State::LOADING;
- model_->GetAllPages(
- base::Bind(&DownloadUIAdapter::OnOfflinePagesLoaded,
- weak_ptr_factory_.GetWeakPtr()));
+ model_->GetAllPages(base::Bind(&DownloadUIAdapter::OnOfflinePagesLoaded,
+ weak_ptr_factory_.GetWeakPtr()));
}
void DownloadUIAdapter::ClearCache() {

Powered by Google App Engine
This is Rietveld 408576698