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

Side by Side Diff: ios/chrome/browser/ntp_tiles/most_visited_sites_observer_bridge.h

Issue 2791253002: Create an Obj-C bridge for MostVisitedSitesObserver (Closed)
Patch Set: Move files to ios/ Created 3 years, 8 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef IOS_CHROME_BROWSER_NTP_TILES_MOST_VISITED_SITES_OBSERVER_BRIDGE_H_
6 #define IOS_CHROME_BROWSER_NTP_TILES_MOST_VISITED_SITES_OBSERVER_BRIDGE_H_
7
8 #import <Foundation/Foundation.h>
9
10 #include "base/ios/weak_nsobject.h"
11 #include "components/ntp_tiles/most_visited_sites.h"
12
13 // Observes MostVisitedSites events from Objective-C. To use as a
14 // ntp_tiles::MostVisitedSites::Observer, wrap in a
15 // MostVisitedSitesObserverBridge.
16 @protocol MostVisitedSitesObserving<NSObject>
17
18 // Invoked by ntp_tiles::MostVisitedSites::Observer::OnMostVisitedURLsAvailable.
19 - (void)onMostVisitedURLsAvailable:
20 (const ntp_tiles::NTPTilesVector&)mostVisited;
21
22 // Invoked by ntp_tiles::MostVisitedSites::Observer::OnIconMadeAvailable.
23 - (void)onIconMadeAvailable:(const GURL&)siteURL;
24
25 @end
26
27 namespace ntp_tiles {
28
29 // Observer for the MostVisitedSites that translates all the callbacks to
30 // Objective-C calls.
31 class MostVisitedSitesObserverBridge : public MostVisitedSites::Observer {
32 public:
33 MostVisitedSitesObserverBridge(id<MostVisitedSitesObserving> observer);
34 ~MostVisitedSitesObserverBridge() override;
35
36 void OnMostVisitedURLsAvailable(const NTPTilesVector& most_visited) override;
37 void OnIconMadeAvailable(const GURL& site_url) override;
38
39 private:
40 base::WeakNSProtocol<id<MostVisitedSitesObserving>> observer_;
41
42 DISALLOW_COPY_AND_ASSIGN(MostVisitedSitesObserverBridge);
43 };
44
45 } // namespace ntp_tiles
46
47 #endif // IOS_CHROME_BROWSER_NTP_TILES_MOST_VISITED_SITES_OBSERVER_BRIDGE_H_
OLDNEW
« no previous file with comments | « ios/chrome/browser/ntp_tiles/BUILD.gn ('k') | ios/chrome/browser/ntp_tiles/most_visited_sites_observer_bridge.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698