OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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_UI_TOOLBAR_TOOLS_MENU_BUTTON_OBSERVER_BRIDGE_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_TOOLBAR_TOOLS_MENU_BUTTON_OBSERVER_BRIDGE_H_ |
| 7 |
| 8 #import <UIKit/UIKit.h> |
| 9 |
| 10 #import "base/mac/scoped_nsobject.h" |
| 11 #include "components/reading_list/ios/reading_list_model_observer.h" |
| 12 |
| 13 @class ToolbarToolsMenuButton; |
| 14 |
| 15 // C++ bridge informing a ToolbarToolsMenuButton whether the Reading List Model |
| 16 // contains unread items. |
| 17 class ToolsMenuButtonObserverBridge : public ReadingListModelObserver { |
| 18 public: |
| 19 // Creates the bridge to the ToolbarToolsMenuButton |button|. |
| 20 ToolsMenuButtonObserverBridge(ReadingListModel* readingListModel, |
| 21 ToolbarToolsMenuButton* button); |
| 22 |
| 23 ~ToolsMenuButtonObserverBridge() final; |
| 24 |
| 25 // ReadingListModelObserver implementation. |
| 26 void ReadingListModelLoaded(const ReadingListModel* model) override; |
| 27 void ReadingListDidApplyChanges(ReadingListModel* model) override; |
| 28 |
| 29 private: |
| 30 // Notify the ToolbarToolsMenuButton of whether the reading list contains |
| 31 // unread items. |
| 32 void UpdateButtonWithModel(const ReadingListModel* model); |
| 33 ReadingListModel* readingListModel_; |
| 34 base::scoped_nsobject<ToolbarToolsMenuButton> button_; |
| 35 }; |
| 36 |
| 37 #endif // IOS_CHROME_BROWSER_UI_TOOLBAR_TOOLS_MENU_BUTTON_OBSERVER_BRIDGE_H_ |
OLD | NEW |