OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 package org.chromium.chrome.browser.bookmarks; | 5 package org.chromium.chrome.browser.bookmarks; |
6 | 6 |
7 import android.support.v7.widget.Toolbar; | 7 import android.support.v7.widget.Toolbar; |
8 import android.view.View; | 8 import android.view.View; |
9 | 9 |
10 import org.chromium.chrome.browser.ChromeActivity; | 10 import org.chromium.chrome.browser.ChromeActivity; |
| 11 import org.chromium.chrome.browser.snackbar.SnackbarManager; |
11 import org.chromium.chrome.browser.toolbar.BottomToolbarPhone; | 12 import org.chromium.chrome.browser.toolbar.BottomToolbarPhone; |
12 import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet.BottomSheetCon
tent; | 13 import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet.BottomSheetCon
tent; |
13 import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetContentControll
er; | 14 import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetContentControll
er; |
14 | 15 |
15 /** | 16 /** |
16 * A {@link BottomSheetContent} holding a {@link BookmarkManager} for display in
the BottomSheet. | 17 * A {@link BottomSheetContent} holding a {@link BookmarkManager} for display in
the BottomSheet. |
17 */ | 18 */ |
18 public class BookmarkSheetContent implements BottomSheetContent { | 19 public class BookmarkSheetContent implements BottomSheetContent { |
19 private final View mContentView; | 20 private final View mContentView; |
20 private final Toolbar mToolbarView; | 21 private final Toolbar mToolbarView; |
21 private BookmarkManager mBookmarkManager; | 22 private BookmarkManager mBookmarkManager; |
22 | 23 |
23 /** | 24 /** |
24 * @param activity The activity displaying the bookmark manager UI. | 25 * @param activity The activity displaying the bookmark manager UI. |
| 26 * @param snackbarManager The {@link SnackbarManager} used to display snackb
ars. |
25 */ | 27 */ |
26 public BookmarkSheetContent(ChromeActivity activity) { | 28 public BookmarkSheetContent(ChromeActivity activity, SnackbarManager snackba
rManager) { |
27 mBookmarkManager = new BookmarkManager(activity, false); | 29 mBookmarkManager = new BookmarkManager(activity, false, snackbarManager)
; |
28 mBookmarkManager.updateForUrl(BookmarkUtils.getLastUsedUrl(activity)); | 30 mBookmarkManager.updateForUrl(BookmarkUtils.getLastUsedUrl(activity)); |
29 mContentView = mBookmarkManager.getView(); | 31 mContentView = mBookmarkManager.getView(); |
30 mToolbarView = mBookmarkManager.detachToolbarView(); | 32 mToolbarView = mBookmarkManager.detachToolbarView(); |
31 ((BottomToolbarPhone) activity.getToolbarManager().getToolbar()) | 33 ((BottomToolbarPhone) activity.getToolbarManager().getToolbar()) |
32 .setOtherToolbarStyle(mToolbarView); | 34 .setOtherToolbarStyle(mToolbarView); |
33 } | 35 } |
34 | 36 |
35 @Override | 37 @Override |
36 public View getContentView() { | 38 public View getContentView() { |
37 return mContentView; | 39 return mContentView; |
(...skipping 13 matching lines...) Expand all Loading... |
51 public void destroy() { | 53 public void destroy() { |
52 mBookmarkManager.destroy(); | 54 mBookmarkManager.destroy(); |
53 mBookmarkManager = null; | 55 mBookmarkManager = null; |
54 } | 56 } |
55 | 57 |
56 @Override | 58 @Override |
57 public int getType() { | 59 public int getType() { |
58 return BottomSheetContentController.TYPE_BOOKMARKS; | 60 return BottomSheetContentController.TYPE_BOOKMARKS; |
59 } | 61 } |
60 } | 62 } |
OLD | NEW |