blob: 0af0b1a24b34d2ea3483758b1e808c17fecd1b3f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_ANDROID_BLUETOOTH_CHOOSER_ANDROID_H_
#define CHROME_BROWSER_UI_ANDROID_BLUETOOTH_CHOOSER_ANDROID_H_
#include "base/android/scoped_java_ref.h"
#include "content/public/browser/bluetooth_chooser.h"
#include "content/public/browser/web_contents.h"
namespace url {
class Origin;
}
// Represents a way to ask the user to select a Bluetooth device from a list of
// options.
class BluetoothChooserAndroid : public content::BluetoothChooser {
public:
// Both frame and event_handler must outlive the BluetoothChooserAndroid.
BluetoothChooserAndroid(content::RenderFrameHost* frame,
const EventHandler& event_handler);
~BluetoothChooserAndroid() override;
// content::BluetoothChooser:
bool CanAskForScanningPermission() override;
void SetAdapterPresence(AdapterPresence presence) override;
void ShowDiscoveryState(DiscoveryState state) override;
void AddDevice(const std::string& device_id,
const base::string16& device_name) override;
void RemoveDevice(const std::string& device_id) override;
// Report the dialog's result.
void OnDialogFinished(JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
jint event_type,
const base::android::JavaParamRef<jstring>& device_id);
// Notify bluetooth stack that the search needs to be re-issued.
void RestartSearch();
// Calls RestartSearch(). Unused JNI parameters enable calls from Java.
void RestartSearch(JNIEnv*, const base::android::JavaParamRef<jobject>&);
void ShowBluetoothOverviewLink(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj);
void ShowBluetoothAdapterOffLink(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj);
void ShowNeedLocationPermissionLink(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj);
static bool Register(JNIEnv* env);
private:
void OpenURL(const char* url);
base::android::ScopedJavaGlobalRef<jobject> java_dialog_;
content::WebContents* web_contents_;
BluetoothChooser::EventHandler event_handler_;
};
#endif // CHROME_BROWSER_UI_ANDROID_BLUETOOTH_CHOOSER_ANDROID_H_
|