Commit e69d9e34 authored by Xing Liu's avatar Xing Liu Committed by Commit Bot

Upboarding: Setup code directory for search tiles project.

This CL sets up the directory for query tiles upboarding project. Also
added an interface for image loader system.

Bug: 1058534
Change-Id: Id4f60ba590d5da155a30087b3db8f1e3389b55e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2088492Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Reviewed-by: default avatarShakti Sahu <shaktisahu@chromium.org>
Reviewed-by: default avatarMin Qin <qinmin@chromium.org>
Reviewed-by: default avatarHesen Zhang <hesen@chromium.org>
Commit-Queue: Xing Liu <xingliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747807}
parent be971e55
...@@ -2976,6 +2976,7 @@ jumbo_static_library("browser") { ...@@ -2976,6 +2976,7 @@ jumbo_static_library("browser") {
"//chrome/browser/notifications/scheduler/public", "//chrome/browser/notifications/scheduler/public",
"//chrome/browser/offline_pages/prefetch/notifications", "//chrome/browser/offline_pages/prefetch/notifications",
"//chrome/browser/share", "//chrome/browser/share",
"//chrome/browser/upboarding",
"//chrome/browser/updates", "//chrome/browser/updates",
"//chrome/services/media_gallery_util/public/cpp", "//chrome/services/media_gallery_util/public/cpp",
"//components/autofill_assistant/browser", "//components/autofill_assistant/browser",
......
# Copyright 2020 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.
group("upboarding") {
deps = [ "//chrome/browser/upboarding/query_tiles" ]
}
dtrainor@chromium.org
hesen@chromium.org
qinmin@chromium.org
shaktisahu@chromium.org
xingliu@chromium.org
# Copyright 2020 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.
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
source_set("query_tiles") {
deps = [ "//chrome/browser/upboarding/query_tiles/internal" ]
}
# Copyright 2020 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.
source_set("internal") {
visibility = [
":*",
"//chrome/browser/upboarding/query_tiles:*",
]
sources = [
"image_loader.cc",
"image_loader.h",
]
deps = [
"//base",
"//skia",
"//url",
]
}
// Copyright 2020 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/upboarding/query_tiles/internal/image_loader.h"
namespace upboarding {
ImageLoader::ImageLoader() = default;
ImageLoader::~ImageLoader() = default;
} // namespace upboarding
// Copyright 2020 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.
#ifndef CHROME_BROWSER_UPBOARDING_QUERY_TILES_INTERNAL_IMAGE_LOADER_H_
#define CHROME_BROWSER_UPBOARDING_QUERY_TILES_INTERNAL_IMAGE_LOADER_H_
#include <memory>
#include <string>
#include "base/callback.h"
#include "base/macros.h"
#include "url/gurl.h"
class SkBitmap;
namespace upboarding {
// Loads image for query tiles. The image will be fetched from a URL and cached
// on disk.
class ImageLoader {
public:
using UpdateCallback = base::OnceCallback<bool>;
using DeleteCallback = base::OnceCallback<bool>;
using BitmapCallback = base::OnceCallback<std::unique_ptr<SkBitmap>>;
using Id = std::string;
ImageLoader();
virtual ~ImageLoader();
// Updates the image cache for a specific tile. If the URL is changed, we will
// immediately fetch the image, then invoke the callback.
virtual void Update(const Id& id,
const GURL& url,
UpdateCallback callback) = 0;
// Deletes an image cache for a specific tile.
virtual void Delete(const Id& id, DeleteCallback callback) = 0;
// Gets the bitmap for a specific tile. Callback will be invoked after
// reading the data from disk or the fetch is done.
void GetBitmap(const Id& id, BitmapCallback callback);
private:
DISALLOW_COPY_AND_ASSIGN(ImageLoader);
};
} // namespace upboarding
#endif // CHROME_BROWSER_UPBOARDING_QUERY_TILES_INTERNAL_IMAGE_LOADER_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment