|
1 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- |
|
2 * This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 package org.mozilla.gecko; |
|
7 |
|
8 public class GeckoViewChrome implements GeckoView.ChromeDelegate { |
|
9 /** |
|
10 * Tell the host application that Gecko is ready to handle requests. |
|
11 * @param view The GeckoView that initiated the callback. |
|
12 */ |
|
13 public void onReady(GeckoView view) {} |
|
14 |
|
15 /** |
|
16 * Tell the host application to display an alert dialog. |
|
17 * @param view The GeckoView that initiated the callback. |
|
18 * @param browser The Browser that is loading the content. |
|
19 * @param message The string to display in the dialog. |
|
20 * @param result A PromptResult used to send back the result without blocking. |
|
21 * Defaults to cancel requests. |
|
22 */ |
|
23 public void onAlert(GeckoView view, GeckoView.Browser browser, String message, GeckoView.PromptResult result) { |
|
24 result.cancel(); |
|
25 } |
|
26 |
|
27 /** |
|
28 * Tell the host application to display a confirmation dialog. |
|
29 * @param view The GeckoView that initiated the callback. |
|
30 * @param browser The Browser that is loading the content. |
|
31 * @param message The string to display in the dialog. |
|
32 * @param result A PromptResult used to send back the result without blocking. |
|
33 * Defaults to cancel requests. |
|
34 */ |
|
35 public void onConfirm(GeckoView view, GeckoView.Browser browser, String message, GeckoView.PromptResult result) { |
|
36 result.cancel(); |
|
37 } |
|
38 |
|
39 /** |
|
40 * Tell the host application to display an input prompt dialog. |
|
41 * @param view The GeckoView that initiated the callback. |
|
42 * @param browser The Browser that is loading the content. |
|
43 * @param message The string to display in the dialog. |
|
44 * @param defaultValue The string to use as default input. |
|
45 * @param result A PromptResult used to send back the result without blocking. |
|
46 * Defaults to cancel requests. |
|
47 */ |
|
48 public void onPrompt(GeckoView view, GeckoView.Browser browser, String message, String defaultValue, GeckoView.PromptResult result) { |
|
49 result.cancel(); |
|
50 } |
|
51 |
|
52 /** |
|
53 * Tell the host application to display a remote debugging request dialog. |
|
54 * @param view The GeckoView that initiated the callback. |
|
55 * @param result A PromptResult used to send back the result without blocking. |
|
56 * Defaults to cancel requests. |
|
57 */ |
|
58 public void onDebugRequest(GeckoView view, GeckoView.PromptResult result) { |
|
59 result.cancel(); |
|
60 } |
|
61 } |