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

Unified Diff: chrome/browser/webdata/keyword_web_data_service.h

Issue 355573008: Split keyword related parts of WebDataService as KeywordWebDataService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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 | « chrome/browser/webdata/OWNERS ('k') | chrome/browser/webdata/keyword_web_data_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/webdata/keyword_web_data_service.h
diff --git a/chrome/browser/webdata/web_data_service.h b/chrome/browser/webdata/keyword_web_data_service.h
similarity index 28%
copy from chrome/browser/webdata/web_data_service.h
copy to chrome/browser/webdata/keyword_web_data_service.h
index d63e810be550438dbcbdc41c1f2c50d220826a9f..3659b09392164e010b0922707caa50f298cc3ff4 100644
--- a/chrome/browser/webdata/web_data_service.h
+++ b/chrome/browser/webdata/keyword_web_data_service.h
@@ -1,81 +1,23 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2014 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.
-// Chromium settings and storage represent user-selected preferences and
-// information and MUST not be extracted, overwritten or modified except
-// through Chromium defined APIs.
+#ifndef CHROME_BROWSER_WEBDATA_KEYWORD_WEB_DATA_SERVICE_H__
+#define CHROME_BROWSER_WEBDATA_KEYWORD_WEB_DATA_SERVICE_H__
-#ifndef CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__
-#define CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__
-
-#include <map>
-#include <string>
-#include <vector>
-
-#include "base/callback_forward.h"
-#include "base/files/file_path.h"
-#include "base/location.h"
#include "base/memory/ref_counted.h"
-#include "base/sequenced_task_runner_helpers.h"
#include "chrome/browser/webdata/keyword_table.h"
-#include "components/search_engines/template_url.h"
#include "components/search_engines/template_url_id.h"
-#include "components/webdata/common/web_data_results.h"
#include "components/webdata/common/web_data_service_base.h"
-#include "components/webdata/common/web_data_service_consumer.h"
#include "components/webdata/common/web_database.h"
-struct DefaultWebIntentService;
-class GURL;
-#if defined(OS_WIN)
-struct IE7PasswordInfo;
-#endif
-class Profile;
-class SkBitmap;
-class WebDatabaseService;
-
namespace base {
-class Thread;
-}
-
-namespace content {
-class BrowserContext;
-}
-
-namespace webkit_glue {
-struct WebIntentServiceData;
+class MessageLoopProxy;
}
-////////////////////////////////////////////////////////////////////////////////
-//
-// WebDataService is a generic data repository for meta data associated with
-// web pages. All data is retrieved and archived in an asynchronous way.
-//
-// All requests return a handle. The handle can be used to cancel the request.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-
-////////////////////////////////////////////////////////////////////////////////
-//
-// WebDataService results
-//
-////////////////////////////////////////////////////////////////////////////////
-
-typedef base::Callback<scoped_ptr<WDTypedResult>(void)> ResultTask;
-
-// Result from GetWebAppImages.
-struct WDAppImagesResult {
- WDAppImagesResult();
- ~WDAppImagesResult();
-
- // True if SetWebAppHasAllImages(true) was invoked.
- bool has_all_images;
-
- // The images, may be empty.
- std::vector<SkBitmap> images;
-};
+class WDTypedResult;
+class WebDatabaseService;
+struct TemplateURLData;
struct WDKeywordsResult {
WDKeywordsResult();
@@ -91,9 +33,9 @@ struct WDKeywordsResult {
class WebDataServiceConsumer;
-class WebDataService : public WebDataServiceBase {
+class KeywordWebDataService : public WebDataServiceBase {
public:
- // Instantiate this to turn on keyword batch mode on the provided |service|
+ // Instantiate this to turn on batch mode on the provided |service|
// until the scoper is destroyed. When batch mode is on, calls to any of the
// three keyword table modification functions below will result in locally
// queueing the operation; on setting this back to false, all the
@@ -103,29 +45,20 @@ class WebDataService : public WebDataServiceBase {
// If multiple scopers are in-scope simultaneously, batch mode will only be
// exited when all are destroyed. If |service| is NULL, the object will do
// nothing.
- class KeywordBatchModeScoper {
+ class BatchModeScoper {
public:
- explicit KeywordBatchModeScoper(WebDataService* service);
- ~KeywordBatchModeScoper();
+ explicit BatchModeScoper(KeywordWebDataService* service);
+ ~BatchModeScoper();
private:
- WebDataService* service_;
+ KeywordWebDataService* service_;
- DISALLOW_COPY_AND_ASSIGN(KeywordBatchModeScoper);
+ DISALLOW_COPY_AND_ASSIGN(BatchModeScoper);
};
- // Retrieve a WebDataService for the given context.
- static scoped_refptr<WebDataService> FromBrowserContext(
- content::BrowserContext* context);
-
- WebDataService(scoped_refptr<WebDatabaseService> wdbs,
- const ProfileErrorCallback& callback);
-
- //////////////////////////////////////////////////////////////////////////////
- //
- // Keywords
- //
- //////////////////////////////////////////////////////////////////////////////
+ KeywordWebDataService(scoped_refptr<WebDatabaseService> wdbs,
+ scoped_refptr<base::MessageLoopProxy> ui_thread,
+ const ProfileErrorCallback& callback);
// As the database processes requests at a later date, all deletion is
// done on the background thread.
@@ -148,69 +81,18 @@ class WebDataService : public WebDataServiceBase {
// Sets the version of the builtin keywords.
void SetBuiltinKeywordVersion(int version);
- //////////////////////////////////////////////////////////////////////////////
- //
- // Web Apps
- //
- //////////////////////////////////////////////////////////////////////////////
-
- // Sets the image for the specified web app. A web app can have any number of
- // images, but only one at a particular size. If there was an image for the
- // web app at the size of the given image it is replaced.
- void SetWebAppImage(const GURL& app_url, const SkBitmap& image);
-
- // Sets whether all the images have been downloaded for the specified web app.
- void SetWebAppHasAllImages(const GURL& app_url, bool has_all_images);
-
- // Removes all images for the specified web app.
- void RemoveWebApp(const GURL& app_url);
-
- // Fetches the images and whether all images have been downloaded for the
- // specified web app.
- Handle GetWebAppImages(const GURL& app_url, WebDataServiceConsumer* consumer);
-
-#if defined(OS_WIN)
- //////////////////////////////////////////////////////////////////////////////
- //
- // IE7/8 Password Access (used by PasswordStoreWin - do not use elsewhere)
- //
- //////////////////////////////////////////////////////////////////////////////
-
- // Adds |info| to the list of imported passwords from ie7/ie8.
- void AddIE7Login(const IE7PasswordInfo& info);
-
- // Removes |info| from the list of imported passwords from ie7/ie8.
- void RemoveIE7Login(const IE7PasswordInfo& info);
-
- // Get the login matching the information in |info|. |consumer| will be
- // notified when the request is done. The result is of type
- // WDResult<IE7PasswordInfo>.
- // If there is no match, the fields of the IE7PasswordInfo will be empty.
- Handle GetIE7Login(const IE7PasswordInfo& info,
- WebDataServiceConsumer* consumer);
-#endif // defined(OS_WIN)
-
protected:
- // For unit tests, passes a null callback.
- WebDataService();
-
- virtual ~WebDataService();
+ virtual ~KeywordWebDataService();
private:
- // Called by the KeywordBatchModeScoper (see comments there).
- void AdjustKeywordBatchModeLevel(bool entering_batch_mode);
+ // Called by the BatchModeScoper (see comments there).
+ void AdjustBatchModeLevel(bool entering_batch_mode);
//////////////////////////////////////////////////////////////////////////////
//
// The following methods are only invoked on the DB thread.
//
//////////////////////////////////////////////////////////////////////////////
-
- //////////////////////////////////////////////////////////////////////////////
- //
- // Keywords.
- //
- //////////////////////////////////////////////////////////////////////////////
WebDatabase::State PerformKeywordOperationsImpl(
const KeywordTable::Operations& operations,
WebDatabase* db);
@@ -219,64 +101,10 @@ class WebDataService : public WebDataServiceBase {
WebDatabase* db);
WebDatabase::State SetBuiltinKeywordVersionImpl(int version, WebDatabase* db);
- //////////////////////////////////////////////////////////////////////////////
- //
- // Web Apps.
- //
- //////////////////////////////////////////////////////////////////////////////
-
- WebDatabase::State SetWebAppImageImpl(const GURL& app_url,
- const SkBitmap& image, WebDatabase* db);
- WebDatabase::State SetWebAppHasAllImagesImpl(const GURL& app_url,
- bool has_all_images, WebDatabase* db);
- WebDatabase::State RemoveWebAppImpl(const GURL& app_url, WebDatabase* db);
- scoped_ptr<WDTypedResult> GetWebAppImagesImpl(
- const GURL& app_url, WebDatabase* db);
-
-#if defined(ENABLE_WEB_INTENTS)
- //////////////////////////////////////////////////////////////////////////////
- //
- // Web Intents.
- //
- //////////////////////////////////////////////////////////////////////////////
- WebDatabase::State AddWebIntentServiceImpl(
- const webkit_glue::WebIntentServiceData& service);
- WebDatabase::State RemoveWebIntentServiceImpl(
- const webkit_glue::WebIntentServiceData& service);
- scoped_ptr<WDTypedResult> GetWebIntentServicesImpl(
- const base::string16& action);
- scoped_ptr<WDTypedResult> GetWebIntentServicesForURLImpl(
- const base::string16& service_url);
- scoped_ptr<WDTypedResult> GetAllWebIntentServicesImpl();
- WebDatabase::State AddDefaultWebIntentServiceImpl(
- const DefaultWebIntentService& service);
- WebDatabase::State RemoveDefaultWebIntentServiceImpl(
- const DefaultWebIntentService& service);
- WebDatabase::State RemoveWebIntentServiceDefaultsImpl(
- const GURL& service_url);
- scoped_ptr<WDTypedResult> GetDefaultWebIntentServicesForActionImpl(
- const base::string16& action);
- scoped_ptr<WDTypedResult> GetAllDefaultWebIntentServicesImpl();
-#endif
-
-#if defined(OS_WIN)
- //////////////////////////////////////////////////////////////////////////////
- //
- // Password manager.
- //
- //////////////////////////////////////////////////////////////////////////////
- WebDatabase::State AddIE7LoginImpl(
- const IE7PasswordInfo& info, WebDatabase* db);
- WebDatabase::State RemoveIE7LoginImpl(
- const IE7PasswordInfo& info, WebDatabase* db);
- scoped_ptr<WDTypedResult> GetIE7LoginImpl(
- const IE7PasswordInfo& info, WebDatabase* db);
-#endif // defined(OS_WIN)
-
- size_t keyword_batch_mode_level_;
+ size_t batch_mode_level_;
KeywordTable::Operations queued_keyword_operations_;
- DISALLOW_COPY_AND_ASSIGN(WebDataService);
+ DISALLOW_COPY_AND_ASSIGN(KeywordWebDataService);
};
-#endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__
+#endif // CHROME_BROWSER_WEBDATA_KEYWORD_WEB_DATA_SERVICE_H__
« no previous file with comments | « chrome/browser/webdata/OWNERS ('k') | chrome/browser/webdata/keyword_web_data_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698