OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" | 5 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" |
6 | 6 |
| 7 #include "base/logging.h" |
7 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
8 #include "chrome/browser/favicon/favicon_changed_details.h" | 9 #include "chrome/browser/favicon/favicon_changed_details.h" |
9 #include "chrome/browser/favicon/favicon_service.h" | 10 #include "chrome/browser/favicon/favicon_service.h" |
10 #include "chrome/browser/favicon/favicon_service_factory.h" | 11 #include "chrome/browser/favicon/favicon_service_factory.h" |
11 #include "chrome/browser/history/history_service.h" | 12 #include "chrome/browser/history/history_service.h" |
12 #include "chrome/browser/history/history_service_factory.h" | 13 #include "chrome/browser/history/history_service_factory.h" |
13 #include "chrome/browser/history/url_database.h" | 14 #include "chrome/browser/history/url_database.h" |
14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
15 #include "components/bookmarks/core/browser/bookmark_model.h" | 16 #include "components/bookmarks/core/browser/bookmark_model.h" |
| 17 #include "components/bookmarks/core/browser/bookmark_node.h" |
16 #include "content/public/browser/notification_details.h" | 18 #include "content/public/browser/notification_details.h" |
17 #include "content/public/browser/notification_source.h" | 19 #include "content/public/browser/notification_source.h" |
18 #include "content/public/browser/user_metrics.h" | 20 #include "content/public/browser/user_metrics.h" |
19 | 21 |
20 namespace { | 22 namespace { |
21 | 23 |
22 void NotifyHistoryOfRemovedURLs(Profile* profile, | 24 void NotifyHistoryOfRemovedURLs(Profile* profile, |
23 const std::set<GURL>& removed_urls) { | 25 const std::set<GURL>& removed_urls) { |
24 HistoryService* history_service = | 26 HistoryService* history_service = |
25 HistoryServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS); | 27 HistoryServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 96 |
95 NodeTypedCountPair pair(*i, typed_count); | 97 NodeTypedCountPair pair(*i, typed_count); |
96 node_typed_count_pairs->push_back(pair); | 98 node_typed_count_pairs->push_back(pair); |
97 } | 99 } |
98 } | 100 } |
99 | 101 |
100 void ChromeBookmarkClient::RecordAction(const base::UserMetricsAction& action) { | 102 void ChromeBookmarkClient::RecordAction(const base::UserMetricsAction& action) { |
101 content::RecordAction(action); | 103 content::RecordAction(action); |
102 } | 104 } |
103 | 105 |
| 106 bool ChromeBookmarkClient::IsPermanentNodeVisible(int node_type) { |
| 107 DCHECK(node_type == BookmarkNode::BOOKMARK_BAR || |
| 108 node_type == BookmarkNode::OTHER_NODE || |
| 109 node_type == BookmarkNode::MOBILE); |
| 110 #if !defined(OS_IOS) |
| 111 return node_type != BookmarkNode::MOBILE; |
| 112 #else |
| 113 return node_type == BookmarkNode::MOBILE; |
| 114 #endif |
| 115 } |
| 116 |
104 void ChromeBookmarkClient::Observe( | 117 void ChromeBookmarkClient::Observe( |
105 int type, | 118 int type, |
106 const content::NotificationSource& source, | 119 const content::NotificationSource& source, |
107 const content::NotificationDetails& details) { | 120 const content::NotificationDetails& details) { |
108 switch (type) { | 121 switch (type) { |
109 case chrome::NOTIFICATION_FAVICON_CHANGED: { | 122 case chrome::NOTIFICATION_FAVICON_CHANGED: { |
110 content::Details<FaviconChangedDetails> favicon_details(details); | 123 content::Details<FaviconChangedDetails> favicon_details(details); |
111 model_->OnFaviconChanged(favicon_details->urls); | 124 model_->OnFaviconChanged(favicon_details->urls); |
112 break; | 125 break; |
113 } | 126 } |
(...skipping 18 matching lines...) Expand all Loading... |
132 const BookmarkNode* node, | 145 const BookmarkNode* node, |
133 const std::set<GURL>& removed_urls) { | 146 const std::set<GURL>& removed_urls) { |
134 NotifyHistoryOfRemovedURLs(profile_, removed_urls); | 147 NotifyHistoryOfRemovedURLs(profile_, removed_urls); |
135 } | 148 } |
136 | 149 |
137 void ChromeBookmarkClient::BookmarkAllNodesRemoved( | 150 void ChromeBookmarkClient::BookmarkAllNodesRemoved( |
138 BookmarkModel* model, | 151 BookmarkModel* model, |
139 const std::set<GURL>& removed_urls) { | 152 const std::set<GURL>& removed_urls) { |
140 NotifyHistoryOfRemovedURLs(profile_, removed_urls); | 153 NotifyHistoryOfRemovedURLs(profile_, removed_urls); |
141 } | 154 } |
OLD | NEW |