| Index: ios/chrome/browser/ntp_tiles/most_visited_sites_observer_bridge.h
|
| diff --git a/ios/chrome/browser/ntp_tiles/most_visited_sites_observer_bridge.h b/ios/chrome/browser/ntp_tiles/most_visited_sites_observer_bridge.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8d4df0f0ec3a737fa73731f3212bfc4de2283b75
|
| --- /dev/null
|
| +++ b/ios/chrome/browser/ntp_tiles/most_visited_sites_observer_bridge.h
|
| @@ -0,0 +1,47 @@
|
| +// Copyright 2017 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 IOS_CHROME_BROWSER_NTP_TILES_MOST_VISITED_SITES_OBSERVER_BRIDGE_H_
|
| +#define IOS_CHROME_BROWSER_NTP_TILES_MOST_VISITED_SITES_OBSERVER_BRIDGE_H_
|
| +
|
| +#import <Foundation/Foundation.h>
|
| +
|
| +#include "base/ios/weak_nsobject.h"
|
| +#include "components/ntp_tiles/most_visited_sites.h"
|
| +
|
| +// Observes MostVisitedSites events from Objective-C. To use as a
|
| +// ntp_tiles::MostVisitedSites::Observer, wrap in a
|
| +// MostVisitedSitesObserverBridge.
|
| +@protocol MostVisitedSitesObserving<NSObject>
|
| +
|
| +// Invoked by ntp_tiles::MostVisitedSites::Observer::OnMostVisitedURLsAvailable.
|
| +- (void)onMostVisitedURLsAvailable:
|
| + (const ntp_tiles::NTPTilesVector&)mostVisited;
|
| +
|
| +// Invoked by ntp_tiles::MostVisitedSites::Observer::OnIconMadeAvailable.
|
| +- (void)onIconMadeAvailable:(const GURL&)siteURL;
|
| +
|
| +@end
|
| +
|
| +namespace ntp_tiles {
|
| +
|
| +// Observer for the MostVisitedSites that translates all the callbacks to
|
| +// Objective-C calls.
|
| +class MostVisitedSitesObserverBridge : public MostVisitedSites::Observer {
|
| + public:
|
| + MostVisitedSitesObserverBridge(id<MostVisitedSitesObserving> observer);
|
| + ~MostVisitedSitesObserverBridge() override;
|
| +
|
| + void OnMostVisitedURLsAvailable(const NTPTilesVector& most_visited) override;
|
| + void OnIconMadeAvailable(const GURL& site_url) override;
|
| +
|
| + private:
|
| + base::WeakNSProtocol<id<MostVisitedSitesObserving>> observer_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(MostVisitedSitesObserverBridge);
|
| +};
|
| +
|
| +} // namespace ntp_tiles
|
| +
|
| +#endif // IOS_CHROME_BROWSER_NTP_TILES_MOST_VISITED_SITES_OBSERVER_BRIDGE_H_
|
|
|