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

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

Issue 1711393002: bluetooth: android: register for adapter on/off events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased on master Created 4 years, 9 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
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.Manifest; 7 import android.Manifest;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.Intent; 9 import android.content.Intent;
10 import android.content.pm.PackageManager; 10 import android.content.pm.PackageManager;
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 new NoUnderlineClickableSpan(LinkType.ADAPTER_OFF, mCont ext))); 314 new NoUnderlineClickableSpan(LinkType.ADAPTER_OFF, mCont ext)));
315 SpannableString adapterOffStatus = SpanApplier.applySpans( 315 SpannableString adapterOffStatus = SpanApplier.applySpans(
316 mContext.getString(R.string.bluetooth_adapter_off_help), 316 mContext.getString(R.string.bluetooth_adapter_off_help),
317 new SpanInfo("<link>", "</link>", 317 new SpanInfo("<link>", "</link>",
318 new NoUnderlineClickableSpan(LinkType.ADAPTER_OFF_HELP, mContext))); 318 new NoUnderlineClickableSpan(LinkType.ADAPTER_OFF_HELP, mContext)));
319 319
320 mItemChooserDialog.setErrorState(adapterOffMessage, adapterOffStatus); 320 mItemChooserDialog.setErrorState(adapterOffMessage, adapterOffStatus);
321 } 321 }
322 322
323 @CalledByNative 323 @CalledByNative
324 private void notifyAdapterTurnedOn() {
325 mItemChooserDialog.clear();
Ted C 2016/02/26 17:50:35 unless this line can somehow call closeDialog(), t
scheib 2016/02/26 20:23:47 Done.
326 if (mNativeBluetoothChooserDialogPtr != 0) {
327 nativeRestartSearch(mNativeBluetoothChooserDialogPtr);
Ted C 2016/02/26 17:50:35 Why not have the native side just call this method
scheib 2016/02/26 20:23:47 Done.
328 }
329 }
330
331 @CalledByNative
324 private void notifyDiscoveryState(int discoveryState) { 332 private void notifyDiscoveryState(int discoveryState) {
325 switch (discoveryState) { 333 switch (discoveryState) {
326 case DISCOVERY_FAILED_TO_START: { 334 case DISCOVERY_FAILED_TO_START: {
327 // FAILED_TO_START might be caused by a missing Location permiss ion. 335 // FAILED_TO_START might be caused by a missing Location permiss ion.
328 // Check, and show a request if so. 336 // Check, and show a request if so.
329 checkLocationPermission(); 337 checkLocationPermission();
330 break; 338 break;
331 } 339 }
332 case DISCOVERY_IDLE: { 340 case DISCOVERY_IDLE: {
333 mItemChooserDialog.setIdleState(); 341 mItemChooserDialog.setIdleState();
334 break; 342 break;
335 } 343 }
336 default: { 344 default: {
337 // TODO(jyasskin): Report the new state to the user. 345 // TODO(jyasskin): Report the new state to the user.
338 break; 346 break;
339 } 347 }
340 } 348 }
341 } 349 }
342 350
343 private native void nativeOnDialogFinished( 351 private native void nativeOnDialogFinished(
344 long nativeBluetoothChooserAndroid, int eventType, String deviceId); 352 long nativeBluetoothChooserAndroid, int eventType, String deviceId);
345 private native void nativeRestartSearch(long nativeBluetoothChooserAndroid); 353 private native void nativeRestartSearch(long nativeBluetoothChooserAndroid);
346 // Help links. 354 // Help links.
347 private native void nativeShowBluetoothOverviewLink(long nativeBluetoothChoo serAndroid); 355 private native void nativeShowBluetoothOverviewLink(long nativeBluetoothChoo serAndroid);
348 private native void nativeShowBluetoothAdapterOffLink(long nativeBluetoothCh ooserAndroid); 356 private native void nativeShowBluetoothAdapterOffLink(long nativeBluetoothCh ooserAndroid);
349 private native void nativeShowNeedLocationPermissionLink(long nativeBluetoot hChooserAndroid); 357 private native void nativeShowNeedLocationPermissionLink(long nativeBluetoot hChooserAndroid);
350 } 358 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698