Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
|
sdefresne
2017/04/03 14:25:49
I think this file should be named after the main c
gambard
2017/04/03 15:17:36
Done.
| |
| 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 COMPONENTS_NTP_TILES_IOS_MOST_VISITED_SITES_BRIDGE_OBSERVER_H_ | |
| 6 #define COMPONENTS_NTP_TILES_IOS_MOST_VISITED_SITES_BRIDGE_OBSERVER_H_ | |
| 7 | |
| 8 #import <Foundation/Foundation.h> | |
| 9 | |
| 10 #include "components/ntp_tiles/most_visited_sites.h" | |
| 11 | |
| 12 // Observes MostVisitedSites events from Objective-C. To use as a | |
| 13 // ntp_tiles::MostVisitedSites::Observer, wrap in a MostVisitedSitesBridge. | |
| 14 @protocol MostVisitedSitesObserver | |
|
sdefresne
2017/04/03 14:25:49
marq & rohitrao recommendation regarding Objective
gambard
2017/04/03 15:17:36
Done.
| |
| 15 | |
| 16 // Invoked by ntp_tiles::MostVisitedSites::Observer::OnMostVisitedURLsAvailable. | |
| 17 - (void)onMostVisitedURLsAvailable: | |
| 18 (const ntp_tiles::NTPTilesVector&)mostVisited; | |
| 19 | |
| 20 // Invoked by ntp_tiles::MostVisitedSites::Observer::OnIconMadeAvailable. | |
| 21 - (void)onIconMadeAvailable:(const GURL&)siteURL; | |
| 22 | |
| 23 @end | |
| 24 | |
| 25 namespace ntp_tiles { | |
| 26 | |
| 27 // Observer for the MostVisitedSites that translates all the callbacks to | |
| 28 // Objective-C calls. | |
| 29 class MostVisitedSitesBridge : public MostVisitedSites::Observer { | |
|
sdefresne
2017/04/03 14:25:49
I would call this MostVisitedSitesObserverBridge.
gambard
2017/04/03 15:17:37
Done.
| |
| 30 public: | |
| 31 MostVisitedSitesBridge(id<MostVisitedSitesObserver> observer); | |
| 32 | |
| 33 void OnMostVisitedURLsAvailable(const NTPTilesVector& most_visited) override; | |
| 34 void OnIconMadeAvailable(const GURL& site_url) override; | |
| 35 | |
| 36 private: | |
| 37 __unsafe_unretained id<MostVisitedSitesObserver> observer_; | |
|
sdefresne
2017/04/03 14:25:49
I think we should avoid using __unsafe_unretained
gambard
2017/04/03 15:17:36
Done.
| |
| 38 | |
| 39 DISALLOW_COPY_AND_ASSIGN(MostVisitedSitesBridge); | |
| 40 }; | |
| 41 | |
| 42 } // namespace ntp_tiles | |
| 43 | |
| 44 #endif // COMPONENTS_NTP_TILES_IOS_MOST_VISITED_SITES_BRIDGE_OBSERVER_H_ | |
| OLD | NEW |