| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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/ntp_snippets/bookmark_last_visit_updater.h" | 5 #include "chrome/browser/ntp_snippets/bookmark_last_visit_updater.h" |
| 6 | 6 |
| 7 #include "chrome/common/features.h" | |
| 8 #include "components/bookmarks/browser/bookmark_model.h" | 7 #include "components/bookmarks/browser/bookmark_model.h" |
| 9 #include "components/bookmarks/browser/bookmark_node.h" | 8 #include "components/bookmarks/browser/bookmark_node.h" |
| 10 #include "components/ntp_snippets/bookmarks/bookmark_last_visit_utils.h" | 9 #include "components/ntp_snippets/bookmarks/bookmark_last_visit_utils.h" |
| 11 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
| 12 #include "content/public/browser/navigation_handle.h" | 11 #include "content/public/browser/navigation_handle.h" |
| 13 | 12 |
| 14 namespace { | 13 namespace { |
| 15 | 14 |
| 16 bool IsMobilePlatform() { | 15 bool IsMobilePlatform() { |
| 17 #if BUILDFLAG(ANDROID_JAVA_UI) // There are no tab helpers on iOS. | 16 #if defined(OS_ANDROID) // There are no tab helpers on iOS. |
| 18 return true; | 17 return true; |
| 19 #else | 18 #else |
| 20 return false; | 19 return false; |
| 21 #endif | 20 #endif |
| 22 } | 21 } |
| 23 | 22 |
| 24 } // namespace | 23 } // namespace |
| 25 | 24 |
| 26 DEFINE_WEB_CONTENTS_USER_DATA_KEY(BookmarkLastVisitUpdater); | 25 DEFINE_WEB_CONTENTS_USER_DATA_KEY(BookmarkLastVisitUpdater); |
| 27 | 26 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 int index) { | 81 int index) { |
| 83 const GURL& new_bookmark_url = parent->GetChild(index)->url(); | 82 const GURL& new_bookmark_url = parent->GetChild(index)->url(); |
| 84 | 83 |
| 85 if (new_bookmark_url == web_contents_->GetLastCommittedURL()) { | 84 if (new_bookmark_url == web_contents_->GetLastCommittedURL()) { |
| 86 // Consider in this TabHelper only bookmarks created from this tab (and not | 85 // Consider in this TabHelper only bookmarks created from this tab (and not |
| 87 // the ones created from other tabs or created through bookmark sync). | 86 // the ones created from other tabs or created through bookmark sync). |
| 88 ntp_snippets::UpdateBookmarkOnURLVisitedInMainFrame( | 87 ntp_snippets::UpdateBookmarkOnURLVisitedInMainFrame( |
| 89 bookmark_model_, new_bookmark_url, IsMobilePlatform()); | 88 bookmark_model_, new_bookmark_url, IsMobilePlatform()); |
| 90 } | 89 } |
| 91 } | 90 } |
| OLD | NEW |