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.history; | 5 package org.chromium.chrome.browser.history; |
6 | 6 |
7 import android.app.Activity; | 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; |
| 11 import org.chromium.chrome.browser.toolbar.BottomToolbarPhone; |
10 import org.chromium.chrome.browser.widget.BottomSheet.BottomSheetContent; | 12 import org.chromium.chrome.browser.widget.BottomSheet.BottomSheetContent; |
11 | 13 |
12 /** | 14 /** |
13 * A {@link BottomSheetContent} holding a {@link HistoryManager} for display in
the BottomSheet. | 15 * A {@link BottomSheetContent} holding a {@link HistoryManager} for display in
the BottomSheet. |
14 */ | 16 */ |
15 public class HistorySheetContent implements BottomSheetContent { | 17 public class HistorySheetContent implements BottomSheetContent { |
16 private final View mContentView; | 18 private final View mContentView; |
| 19 private final Toolbar mToolbarView; |
17 private HistoryManager mHistoryManager; | 20 private HistoryManager mHistoryManager; |
18 | 21 |
19 /** | 22 /** |
20 * @param activity The activity displaying the history manager UI. | 23 * @param activity The activity displaying the history manager UI. |
21 */ | 24 */ |
22 public HistorySheetContent(Activity activity) { | 25 public HistorySheetContent(ChromeActivity activity) { |
23 mHistoryManager = new HistoryManager(activity, null); | 26 mHistoryManager = new HistoryManager(activity, false); |
24 mContentView = mHistoryManager.detachContentView(); | 27 mContentView = mHistoryManager.getView(); |
| 28 mToolbarView = mHistoryManager.detachToolbarView(); |
| 29 ((BottomToolbarPhone) activity.getToolbarManager().getToolbar()) |
| 30 .setOtherToolbarStyle(mToolbarView); |
25 } | 31 } |
26 | 32 |
27 @Override | 33 @Override |
28 public View getContentView() { | 34 public View getContentView() { |
29 return mContentView; | 35 return mContentView; |
30 } | 36 } |
31 | 37 |
32 @Override | 38 @Override |
33 public View getToolbarView() { | 39 public View getToolbarView() { |
34 return null; | 40 return mToolbarView; |
35 } | 41 } |
36 | 42 |
37 @Override | 43 @Override |
38 public int getVerticalScrollOffset() { | 44 public int getVerticalScrollOffset() { |
39 return mHistoryManager.getVerticalScrollOffset(); | 45 return mHistoryManager.getVerticalScrollOffset(); |
40 } | 46 } |
41 | 47 |
42 @Override | 48 @Override |
43 public void destroy() { | 49 public void destroy() { |
44 mHistoryManager.onDestroyed(); | 50 mHistoryManager.onDestroyed(); |
45 mHistoryManager = null; | 51 mHistoryManager = null; |
46 } | 52 } |
47 } | 53 } |
OLD | NEW |