Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanel.java

Issue 2449653002: [Contextual Search] Add support for a static icon (Closed)
Patch Set: [Contextual Search] Add support for a static icon Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.compositor.bottombar.contextualsearch; 5 package org.chromium.chrome.browser.compositor.bottombar.contextualsearch;
6 6
7 import android.app.Activity; 7 import android.app.Activity;
8 import android.content.Context; 8 import android.content.Context;
9 import android.os.Handler; 9 import android.os.Handler;
10 10
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 // ========================================================================= =================== 245 // ========================================================================= ===================
246 246
247 @Override 247 @Override
248 protected void onClosed(StateChangeReason reason) { 248 protected void onClosed(StateChangeReason reason) {
249 // Must be called before destroying Content because unseen visits should be removed from 249 // Must be called before destroying Content because unseen visits should be removed from
250 // history, and if the Content gets destroyed there won't be a ContentVi ewCore to do that. 250 // history, and if the Content gets destroyed there won't be a ContentVi ewCore to do that.
251 mManagementDelegate.onCloseContextualSearch(reason); 251 mManagementDelegate.onCloseContextualSearch(reason);
252 252
253 setProgressBarCompletion(0); 253 setProgressBarCompletion(0);
254 setProgressBarVisible(false); 254 setProgressBarVisible(false);
255 getImageControl().hideThumbnail(false); 255 getImageControl().hideStaticIcon(false);
256 256
257 super.onClosed(reason); 257 super.onClosed(reason);
258 258
259 if (mSceneLayer != null) mSceneLayer.hideTree(); 259 if (mSceneLayer != null) mSceneLayer.hideTree();
260 } 260 }
261 261
262 // ========================================================================= =================== 262 // ========================================================================= ===================
263 // Generic Event Handling 263 // Generic Event Handling
264 // ========================================================================= =================== 264 // ========================================================================= ===================
265 265
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 return mHasContentBeenTouched; 483 return mHasContentBeenTouched;
484 } 484 }
485 485
486 /** 486 /**
487 * Sets the search term to display in the SearchBar. 487 * Sets the search term to display in the SearchBar.
488 * This should be called when the search term is set without search term res olution, or 488 * This should be called when the search term is set without search term res olution, or
489 * after search term resolution completed. 489 * after search term resolution completed.
490 * @param searchTerm The string that represents the search term. 490 * @param searchTerm The string that represents the search term.
491 */ 491 */
492 public void setSearchTerm(String searchTerm) { 492 public void setSearchTerm(String searchTerm) {
493 getImageControl().hideThumbnail(true); 493 getImageControl().hideStaticIcon(true);
494 getSearchBarControl().setSearchTerm(searchTerm); 494 getSearchBarControl().setSearchTerm(searchTerm);
495 mPanelMetrics.onSearchRequestStarted(); 495 mPanelMetrics.onSearchRequestStarted();
496 } 496 }
497 497
498 /** 498 /**
499 * Sets the search context to display in the SearchBar. 499 * Sets the search context to display in the SearchBar.
500 * @param selection The portion of the context that represents the user's se lection. 500 * @param selection The portion of the context that represents the user's se lection.
501 * @param end The portion of the context from the selection to its end. 501 * @param end The portion of the context from the selection to its end.
502 */ 502 */
503 public void setSearchContext(String selection, String end) { 503 public void setSearchContext(String selection, String end) {
504 getImageControl().hideThumbnail(true); 504 getImageControl().hideStaticIcon(true);
505 getSearchBarControl().setSearchContext(selection, end); 505 getSearchBarControl().setSearchContext(selection, end);
506 mPanelMetrics.onSearchRequestStarted(); 506 mPanelMetrics.onSearchRequestStarted();
507 } 507 }
508 508
509 /** 509 /**
510 * Sets the caption to display in the SearchBar. 510 * Sets the caption to display in the SearchBar.
511 * When the caption is displayed, the Search Term is pushed up and the capti on shows below. 511 * When the caption is displayed, the Search Term is pushed up and the capti on shows below.
512 * @param caption The string to show in as the caption. 512 * @param caption The string to show in as the caption.
513 */ 513 */
514 public void setCaption(String caption) { 514 public void setCaption(String caption) {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 protected void destroySearchBarControl() { 657 protected void destroySearchBarControl() {
658 if (mSearchBarControl != null) { 658 if (mSearchBarControl != null) {
659 mSearchBarControl.destroy(); 659 mSearchBarControl.destroy();
660 mSearchBarControl = null; 660 mSearchBarControl = null;
661 } 661 }
662 } 662 }
663 663
664 // ========================================================================= =================== 664 // ========================================================================= ===================
665 // Image Control 665 // Image Control
666 // ========================================================================= =================== 666 // ========================================================================= ===================
667
668 // TODO(twellington): The image control should move to ContextualSearchBarCo ntrol since it
669 // is a part of the Bar.
670 private ContextualSearchImageControl mImageControl;
671
672 /** 667 /**
673 * @return The {@link ContextualSearchImageControl} for the panel. 668 * @return The {@link ContextualSearchImageControl} for the panel.
674 */ 669 */
675 public ContextualSearchImageControl getImageControl() { 670 public ContextualSearchImageControl getImageControl() {
676 if (mImageControl == null) { 671 return getSearchBarControl().getImageControl();
677 mImageControl = new ContextualSearchImageControl(this, mContext);
678 }
679 return mImageControl;
680 } 672 }
681 673
682 // ========================================================================= =================== 674 // ========================================================================= ===================
683 // Peek Promo 675 // Peek Promo
684 // ========================================================================= =================== 676 // ========================================================================= ===================
685 677
686 private ContextualSearchPeekPromoControl mPeekPromoControl; 678 private ContextualSearchPeekPromoControl mPeekPromoControl;
687 679
688 /** 680 /**
689 * Creates the ContextualSearchPeekPromoControl, if needed. 681 * Creates the ContextualSearchPeekPromoControl, if needed.
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 790
799 /** 791 /**
800 * Destroy the current content in the panel. 792 * Destroy the current content in the panel.
801 * NOTE(mdjones): This should not be exposed. The only use is in ContextualS earchManager for a 793 * NOTE(mdjones): This should not be exposed. The only use is in ContextualS earchManager for a
802 * bug related to loading new panel content. 794 * bug related to loading new panel content.
803 */ 795 */
804 public void destroyContent() { 796 public void destroyContent() {
805 super.destroyOverlayPanelContent(); 797 super.destroyOverlayPanelContent();
806 } 798 }
807 } 799 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698