OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.app.Activity; | 7 import android.app.Activity; |
8 import android.app.ActivityManager; | 8 import android.app.ActivityManager; |
9 import android.content.Context; | 9 import android.content.Context; |
10 import android.support.graphics.drawable.VectorDrawableCompat; | 10 import android.support.graphics.drawable.VectorDrawableCompat; |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 * Called when the user presses the back key. This is only going to be calle
d on Phone. | 208 * Called when the user presses the back key. This is only going to be calle
d on Phone. |
209 * @return True if manager handles this event, false if it decides to ignore
. | 209 * @return True if manager handles this event, false if it decides to ignore
. |
210 */ | 210 */ |
211 public boolean onBackPressed() { | 211 public boolean onBackPressed() { |
212 // TODO(twellington): replicate this behavior for other list UIs during
unification. | 212 // TODO(twellington): replicate this behavior for other list UIs during
unification. |
213 if (mSelectionDelegate.isSelectionEnabled()) { | 213 if (mSelectionDelegate.isSelectionEnabled()) { |
214 mSelectionDelegate.clearSelection(); | 214 mSelectionDelegate.clearSelection(); |
215 return true; | 215 return true; |
216 } | 216 } |
217 | 217 |
| 218 if (mToolbar.isSearching()) { |
| 219 mToolbar.hideSearchView(); |
| 220 return true; |
| 221 } |
| 222 |
218 if (!mStateStack.empty()) { | 223 if (!mStateStack.empty()) { |
219 mStateStack.pop(); | 224 mStateStack.pop(); |
220 if (!mStateStack.empty()) { | 225 if (!mStateStack.empty()) { |
221 setState(mStateStack.pop()); | 226 setState(mStateStack.pop()); |
222 return true; | 227 return true; |
223 } | 228 } |
224 } | 229 } |
225 return false; | 230 return false; |
226 } | 231 } |
227 | 232 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 closeSearchUI(); | 451 closeSearchUI(); |
447 } | 452 } |
448 | 453 |
449 // Testing methods | 454 // Testing methods |
450 | 455 |
451 @VisibleForTesting | 456 @VisibleForTesting |
452 public BookmarkActionBar getToolbarForTests() { | 457 public BookmarkActionBar getToolbarForTests() { |
453 return mToolbar; | 458 return mToolbar; |
454 } | 459 } |
455 } | 460 } |
OLD | NEW |