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

Side by Side Diff: ios/chrome/browser/ui/toolbar/tools_menu_button_observer_bridge.mm

Issue 2588733002: Upstream Chrome on iOS source code [9/11]. (Closed)
Patch Set: Created 4 years 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 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 #import "ios/chrome/browser/ui/toolbar/tools_menu_button_observer_bridge.h"
6
7 #include "components/reading_list/ios/reading_list_model.h"
8 #import "ios/chrome/browser/ui/toolbar/toolbar_tools_menu_button.h"
9
10 ToolsMenuButtonObserverBridge::ToolsMenuButtonObserverBridge(
11 ReadingListModel* readingListModel,
12 ToolbarToolsMenuButton* button)
13 : readingListModel_(readingListModel), button_([button retain]) {
14 readingListModel_->AddObserver(this);
15 };
16
17 ToolsMenuButtonObserverBridge::~ToolsMenuButtonObserverBridge() {
18 readingListModel_->RemoveObserver(this);
19 }
20
21 void ToolsMenuButtonObserverBridge::ReadingListModelLoaded(
22 const ReadingListModel* model) {
23 UpdateButtonWithModel(model);
24 }
25 void ToolsMenuButtonObserverBridge::ReadingListDidApplyChanges(
26 ReadingListModel* model) {
27 UpdateButtonWithModel(model);
28 }
29
30 void ToolsMenuButtonObserverBridge::UpdateButtonWithModel(
31 const ReadingListModel* model) {
32 bool readingListContainsUnreadItems = model->unread_size() > 0;
33 [button_ setReadingListContainsUnreadItems:readingListContainsUnreadItems];
34 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698