Commit b6d0d3c3 authored by msramek's avatar msramek Committed by Commit bot

Add an infrastructure to query history.google.com about other forms of browsing history.

The Clear Browsing Data dialog UI will provide a notice informing the
user that history.google.com stores other forms of browsing history
(such as the search history).

We will only show the notice to those users for whom it is valid. This
will be determined by Sync status, and by a JSON response from
history.google.com [not yet implemented].

See https://docs.google.com/document/d/1ZMDSAd44KmzKhqXPjobZOf9rZezs6VqiBnqpDD0auCU/
for the background.

To communicate between backends (ProfileSyncService, HistoryService) and
frontends on all platforms, we need to put this logic to a component
(especially because of iOS). We create a new component "browsing_data_ui".

BUG=595332

Review URL: https://codereview.chromium.org/1806873002

Cr-Commit-Position: refs/heads/master@{#381804}
parent fbb82800
# Copyright 2016 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.
{
'targets': [
{
# GN version: //components/browsing_data_ui
'target_name': 'browsing_data_ui',
'type': 'static_library',
'dependencies': [
'browser_sync_browser',
'history_core_browser',
],
'include_dirs': [
'..',
],
'sources': [
# Note: sources list duplicated in GN build.
'browsing_data_ui/history_notice_utils.cc',
'browsing_data_ui/history_notice_utils.h',
],
},
],
}
# Copyright 2016 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.
static_library("browsing_data_ui") {
sources = [
"history_notice_utils.cc",
"history_notice_utils.h",
]
deps = [
"//components/browser_sync/browser",
"//components/history/core/browser",
]
}
include_rules = [
"+components/history/core/browser",
"+components/browser_sync/browser",
]
msarda@chromium.org
msramek@chromium.org
// Copyright 2016 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 "components/browsing_data_ui/history_notice_utils.h"
#include "components/browser_sync/browser/profile_sync_service.h"
#include "components/history/core/browser/web_history_service.h"
namespace browsing_data_ui {
bool ShouldShowNoticeAboutOtherFormsOfBrowsingHistory(
const ProfileSyncService* sync_service,
const history::WebHistoryService* history_service) {
return sync_service &&
sync_service->IsUsingSecondaryPassphrase() &&
history_service &&
history_service->HasOtherFormsOfBrowsingHistory();
}
} // namespace browsing_data_ui
// Copyright 2016 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 COMPONENTS_BROWSING_DATA_UI_HISTORY_NOTICE_UTILS_H_
#define COMPONENTS_BROWSING_DATA_UI_HISTORY_NOTICE_UTILS_H_
class ProfileSyncService;
namespace history {
class WebHistoryService;
}
namespace browsing_data_ui {
// Whether the Clear Browsing Data UI should show a notice about the existence
// of other forms of browsing history stored in user's account.
bool ShouldShowNoticeAboutOtherFormsOfBrowsingHistory(
const ProfileSyncService* sync_service,
const history::WebHistoryService* history_service);
} // namespace browsing_data_ui
#endif // COMPONENTS_BROWSING_DATA_UI_HISTORY_NOTICE_UTILS_H_
......@@ -15,6 +15,7 @@
'autofill.gypi',
'bookmarks.gypi',
'browser_sync.gypi',
'browsing_data_ui.gypi',
'bubble.gypi',
'captive_portal.gypi',
'certificate_reporting.gypi',
......
......@@ -437,6 +437,12 @@ size_t WebHistoryService::GetNumberOfPendingAudioHistoryRequests() {
return pending_audio_history_requests_.size();
}
bool WebHistoryService::HasOtherFormsOfBrowsingHistory() const {
// TODO(msramek): Query history.google.com for existence of other forms of
// browsing history. In the meantime, assume that there isn't.
return false;
}
// static
void WebHistoryService::QueryHistoryCompletionCallback(
const WebHistoryService::QueryWebHistoryCallback& callback,
......
......@@ -114,6 +114,9 @@ class WebHistoryService : public KeyedService {
// Used for tests.
size_t GetNumberOfPendingAudioHistoryRequests();
// Whether there are other forms of browsing history stored on the server.
bool HasOtherFormsOfBrowsingHistory() const;
protected:
// This function is pulled out for testing purposes. Caller takes ownership of
// the new Request.
......
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