| 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.searchwidget; | 5 package org.chromium.chrome.browser.searchwidget; |
| 6 | 6 |
| 7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
| 8 import android.app.PendingIntent; | 8 import android.app.PendingIntent; |
| 9 import android.appwidget.AppWidgetManager; | 9 import android.appwidget.AppWidgetManager; |
| 10 import android.appwidget.AppWidgetProvider; | 10 import android.appwidget.AppWidgetProvider; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 startSearchActivity(intent, false); | 194 startSearchActivity(intent, false); |
| 195 } else if (ACTION_START_VOICE_QUERY.equals(action)) { | 195 } else if (ACTION_START_VOICE_QUERY.equals(action)) { |
| 196 startSearchActivity(intent, true); | 196 startSearchActivity(intent, true); |
| 197 } else if (ACTION_UPDATE_ALL_WIDGETS.equals(action)) { | 197 } else if (ACTION_UPDATE_ALL_WIDGETS.equals(action)) { |
| 198 performUpdate(null); | 198 performUpdate(null); |
| 199 } else { | 199 } else { |
| 200 assert false; | 200 assert false; |
| 201 } | 201 } |
| 202 } | 202 } |
| 203 | 203 |
| 204 private static void startSearchActivity(Intent intent, boolean startVoiceSea
rch) { | 204 @VisibleForTesting |
| 205 static void startSearchActivity(Intent intent, boolean startVoiceSearch) { |
| 205 Log.d(TAG, "Launching SearchActivity: VOICE=" + startVoiceSearch); | 206 Log.d(TAG, "Launching SearchActivity: VOICE=" + startVoiceSearch); |
| 206 Context context = getDelegate().getContext(); | 207 Context context = getDelegate().getContext(); |
| 207 | 208 |
| 208 // Abort if the user needs to go through First Run. | 209 // Abort if the user needs to go through First Run. |
| 209 if (FirstRunFlowSequencer.launch(context, intent, true)) return; | 210 if (FirstRunFlowSequencer.launch(context, intent, true)) return; |
| 210 | 211 |
| 211 // Launch the SearchActivity. | 212 // Launch the SearchActivity. |
| 212 Intent searchIntent = new Intent(); | 213 Intent searchIntent = new Intent(); |
| 213 searchIntent.setClass(context, SearchActivity.class); | 214 searchIntent.setClass(context, SearchActivity.class); |
| 214 searchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | 215 searchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 assert sDelegate == null; | 396 assert sDelegate == null; |
| 396 sDelegate = delegate; | 397 sDelegate = delegate; |
| 397 } | 398 } |
| 398 | 399 |
| 399 /** See {@link #sDefaultSearchEngineUrl}. */ | 400 /** See {@link #sDefaultSearchEngineUrl}. */ |
| 400 static String getDefaultSearchEngineUrl() { | 401 static String getDefaultSearchEngineUrl() { |
| 401 // TODO(yusufo): Get rid of this. | 402 // TODO(yusufo): Get rid of this. |
| 402 return sDefaultSearchEngineUrl; | 403 return sDefaultSearchEngineUrl; |
| 403 } | 404 } |
| 404 } | 405 } |
| OLD | NEW |