Commit 94bad661 authored by sczs's avatar sczs Committed by Commit Bot

[ios] Creates history services on HistoryCoordinator.

- Implements the changes from crrev/c/991253 to the new HistoryCoordinator.

Bug: 805190
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I5b7f47e1f5a706fb15e6833a4c0c01efe8f1ff96
Reviewed-on: https://chromium-review.googlesource.com/994131Reviewed-by: default avataredchin <edchin@chromium.org>
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547965}
parent f15b9c97
......@@ -4,9 +4,17 @@
#include "ios/chrome/browser/ui/history/history_coordinator.h"
#include <memory>
#include "components/browser_sync/profile_sync_service.h"
#include "components/history/core/browser/browsing_history_service.h"
#include "components/keyed_service/core/service_access_type.h"
#include "components/strings/grit/components_strings.h"
#include "ios/chrome/browser/history/history_service_factory.h"
#include "ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory.h"
#import "ios/chrome/browser/ui/history/history_table_container_view_controller.h"
#include "ios/chrome/browser/ui/history/history_table_view_controller.h"
#include "ios/chrome/browser/ui/history/ios_browsing_history_driver.h"
#import "ios/chrome/browser/ui/util/form_sheet_navigation_controller.h"
#include "ui/base/l10n/l10n_util.h"
......@@ -14,7 +22,12 @@
#error "This file requires ARC support."
#endif
@interface HistoryCoordinator ()
@interface HistoryCoordinator () {
// Provides dependencies and funnels callbacks from BrowsingHistoryService.
std::unique_ptr<IOSBrowsingHistoryDriver> _browsingHistoryDriver;
// Abstraction to communicate with HistoryService and WebHistoryService.
std::unique_ptr<history::BrowsingHistoryService> _browsingHistoryService;
}
// ViewController being managed by this Coordinator.
@property(nonatomic, strong)
HistoryTableContainerViewController* historyContainerViewController;
......@@ -32,6 +45,17 @@
historyTableViewController.browserState = self.browserState;
historyTableViewController.loader = self.loader;
// Initialize and configure HistoryServices.
_browsingHistoryDriver = std::make_unique<IOSBrowsingHistoryDriver>(
self.browserState, historyTableViewController);
_browsingHistoryService = std::make_unique<history::BrowsingHistoryService>(
_browsingHistoryDriver.get(),
ios::HistoryServiceFactory::GetForBrowserState(
self.browserState, ServiceAccessType::EXPLICIT_ACCESS),
IOSChromeProfileSyncServiceFactory::GetForBrowserState(
self.browserState));
historyTableViewController.historyService = _browsingHistoryService.get();
// Initialize and configure HistoryContainerViewController.
self.historyContainerViewController =
[[HistoryTableContainerViewController alloc]
......
......@@ -7,6 +7,8 @@
#import "ios/chrome/browser/ui/table_view/chrome_table_view_controller.h"
#include "ios/chrome/browser/ui/history/history_consumer.h"
namespace ios {
class ChromeBrowserState;
}
......@@ -14,9 +16,13 @@ class ChromeBrowserState;
@protocol UrlLoader;
// ChromeTableViewController for displaying history items.
@interface HistoryTableViewController : ChromeTableViewController
@interface HistoryTableViewController
: ChromeTableViewController<HistoryConsumer>
// The ViewController's BrowserState.
@property(nonatomic, assign) ios::ChromeBrowserState* browserState;
// Abstraction to communicate with HistoryService and WebHistoryService.
// Not owned by HistoryTableViewController.
@property(nonatomic, assign) history::BrowsingHistoryService* historyService;
// The UrlLoader used by this ViewController.
@property(nonatomic, weak) id<UrlLoader> loader;
@end
......
......@@ -10,5 +10,26 @@
@implementation HistoryTableViewController
@synthesize browserState = _browserState;
@synthesize historyService = _historyService;
@synthesize loader = _loader;
#pragma mark - HistoryConsumer
- (void)
historyQueryWasCompletedWithResults:
(const std::vector<history::BrowsingHistoryService::HistoryEntry>&)results
queryResultsInfo:(const history::BrowsingHistoryService::
QueryResultsInfo&)queryResultsInfo
continuationClosure:(base::OnceClosure)continuationClosure {
// TODO(crbug.com/805190): Implement HistoryConsumer.
}
- (void)historyWasDeleted {
// TODO(crbug.com/805190): Implement HistoryConsumer.
}
- (void)showNoticeAboutOtherFormsOfBrowsingHistory:(BOOL)shouldShowNotice {
// TODO(crbug.com/805190): Implement HistoryConsumer.
}
@end
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