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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java

Issue 2926413002: Disable search functionality in ChromeActivity before search promo check (Closed)
Patch Set: tests Created 3 years, 6 months 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/locale/LocaleManager.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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; 5 package org.chromium.chrome.browser;
6 6
7 import android.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.annotation.TargetApi; 8 import android.annotation.TargetApi;
9 import android.app.Activity; 9 import android.app.Activity;
10 import android.app.SearchManager; 10 import android.app.SearchManager;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 import org.chromium.chrome.browser.firstrun.ForcedSigninProcessor; 81 import org.chromium.chrome.browser.firstrun.ForcedSigninProcessor;
82 import org.chromium.chrome.browser.fullscreen.ChromeFullscreenManager; 82 import org.chromium.chrome.browser.fullscreen.ChromeFullscreenManager;
83 import org.chromium.chrome.browser.gsa.ContextReporter; 83 import org.chromium.chrome.browser.gsa.ContextReporter;
84 import org.chromium.chrome.browser.gsa.GSAAccountChangeListener; 84 import org.chromium.chrome.browser.gsa.GSAAccountChangeListener;
85 import org.chromium.chrome.browser.gsa.GSAState; 85 import org.chromium.chrome.browser.gsa.GSAState;
86 import org.chromium.chrome.browser.help.HelpAndFeedback; 86 import org.chromium.chrome.browser.help.HelpAndFeedback;
87 import org.chromium.chrome.browser.history.HistoryManagerUtils; 87 import org.chromium.chrome.browser.history.HistoryManagerUtils;
88 import org.chromium.chrome.browser.infobar.InfoBarContainer; 88 import org.chromium.chrome.browser.infobar.InfoBarContainer;
89 import org.chromium.chrome.browser.init.AsyncInitializationActivity; 89 import org.chromium.chrome.browser.init.AsyncInitializationActivity;
90 import org.chromium.chrome.browser.init.ProcessInitializationHandler; 90 import org.chromium.chrome.browser.init.ProcessInitializationHandler;
91 import org.chromium.chrome.browser.locale.LocaleManager;
91 import org.chromium.chrome.browser.media.PictureInPictureController; 92 import org.chromium.chrome.browser.media.PictureInPictureController;
92 import org.chromium.chrome.browser.metrics.LaunchMetrics; 93 import org.chromium.chrome.browser.metrics.LaunchMetrics;
93 import org.chromium.chrome.browser.metrics.StartupMetrics; 94 import org.chromium.chrome.browser.metrics.StartupMetrics;
94 import org.chromium.chrome.browser.metrics.UmaSessionStats; 95 import org.chromium.chrome.browser.metrics.UmaSessionStats;
95 import org.chromium.chrome.browser.metrics.UmaUtils; 96 import org.chromium.chrome.browser.metrics.UmaUtils;
96 import org.chromium.chrome.browser.metrics.WebApkUma; 97 import org.chromium.chrome.browser.metrics.WebApkUma;
97 import org.chromium.chrome.browser.multiwindow.MultiWindowUtils; 98 import org.chromium.chrome.browser.multiwindow.MultiWindowUtils;
98 import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; 99 import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings;
99 import org.chromium.chrome.browser.nfc.BeamController; 100 import org.chromium.chrome.browser.nfc.BeamController;
100 import org.chromium.chrome.browser.nfc.BeamProvider; 101 import org.chromium.chrome.browser.nfc.BeamProvider;
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 * @return The layout ID for the toolbar to use. 734 * @return The layout ID for the toolbar to use.
734 */ 735 */
735 protected int getToolbarLayoutId() { 736 protected int getToolbarLayoutId() {
736 return NO_TOOLBAR_LAYOUT; 737 return NO_TOOLBAR_LAYOUT;
737 } 738 }
738 739
739 /** 740 /**
740 * @return Whether contextual search is allowed for this activity or not. 741 * @return Whether contextual search is allowed for this activity or not.
741 */ 742 */
742 protected boolean isContextualSearchAllowed() { 743 protected boolean isContextualSearchAllowed() {
743 return true; 744 return !LocaleManager.getInstance().needToCheckForSearchEnginePromo();
744 } 745 }
745 746
746 @Override 747 @Override
747 public void initializeState() { 748 public void initializeState() {
748 super.initializeState(); 749 super.initializeState();
749 750
750 IntentHandler.setTestIntentsEnabled( 751 IntentHandler.setTestIntentsEnabled(
751 CommandLine.getInstance().hasSwitch(ContentSwitches.ENABLE_TEST_ INTENTS)); 752 CommandLine.getInstance().hasSwitch(ContentSwitches.ENABLE_TEST_ INTENTS));
752 mIntentHandler = new IntentHandler(createIntentHandlerDelegate(), getPac kageName()); 753 mIntentHandler = new IntentHandler(createIntentHandlerDelegate(), getPac kageName());
753 } 754 }
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1370 * Allows Activities that extend ChromeActivity to do additional hiding/show ing of menu items. 1371 * Allows Activities that extend ChromeActivity to do additional hiding/show ing of menu items.
1371 * @param menu Menu that is going to be shown when the menu button is presse d. 1372 * @param menu Menu that is going to be shown when the menu button is presse d.
1372 */ 1373 */
1373 public void prepareMenu(Menu menu) { 1374 public void prepareMenu(Menu menu) {
1374 } 1375 }
1375 1376
1376 protected IntentHandlerDelegate createIntentHandlerDelegate() { 1377 protected IntentHandlerDelegate createIntentHandlerDelegate() {
1377 return new IntentHandlerDelegate() { 1378 return new IntentHandlerDelegate() {
1378 @Override 1379 @Override
1379 public void processWebSearchIntent(String query) { 1380 public void processWebSearchIntent(String query) {
1380 Intent searchIntent = new Intent(Intent.ACTION_WEB_SEARCH); 1381 final Intent searchIntent = new Intent(Intent.ACTION_WEB_SEARCH) ;
1381 searchIntent.putExtra(SearchManager.QUERY, query); 1382 searchIntent.putExtra(SearchManager.QUERY, query);
1382 startActivity(searchIntent); 1383 Callback<Boolean> callback = new Callback<Boolean>() {
1384 @Override
1385 public void onResult(Boolean result) {
1386 if (result != null && result) startActivity(searchIntent );
1387 }
1388 };
1389 if (!LocaleManager.getInstance().showSearchEnginePromoIfNeeded(
1390 ChromeActivity.this, callback)) {
1391 callback.onResult(true);
1392 }
1383 } 1393 }
1384 1394
1385 @Override 1395 @Override
1386 public void processUrlViewIntent(String url, String referer, String headers, 1396 public void processUrlViewIntent(String url, String referer, String headers,
1387 TabOpenType tabOpenType, String externalAppId, int tabIdToBr ingToFront, 1397 TabOpenType tabOpenType, String externalAppId, int tabIdToBr ingToFront,
1388 boolean hasUserGesture, Intent intent) { 1398 boolean hasUserGesture, Intent intent) {
1389 } 1399 }
1390 }; 1400 };
1391 } 1401 }
1392 1402
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
2221 return false; 2231 return false;
2222 } 2232 }
2223 2233
2224 /** 2234 /**
2225 * @return the reference pool for this activity. 2235 * @return the reference pool for this activity.
2226 */ 2236 */
2227 public DiscardableReferencePool getReferencePool() { 2237 public DiscardableReferencePool getReferencePool() {
2228 return mReferencePool; 2238 return mReferencePool;
2229 } 2239 }
2230 } 2240 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/locale/LocaleManager.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698