The webpage at %s might be
15 | temporarily down or it may have moved permanently to a new web
16 | address.
17 |
18 |
Suggestions:
19 |
20 |
Make sure you have a data connection
21 |
Reload this webpage later
22 |
Check the address you entered
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/java/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/java/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
--------------------------------------------------------------------------------
/java/res/values-v17/styles_content.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/java/res/values-v17/styles_ui.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 |
13 |
--------------------------------------------------------------------------------
/java/res/values-zh-rCN/android_ui_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | "内存不足,无法完成上一操作"
4 | "无法打开所选文件"
5 | "更多"
6 | "色调"
7 | "饱和度"
8 | "值"
9 | "设置"
10 | "取消"
11 | "选择颜色"
12 | "红色"
13 | "青色"
14 | "蓝色"
15 | "绿色"
16 | "洋红色"
17 | "黄色"
18 | "黑色"
19 | "白色"
20 | "未能复制到剪贴板"
21 |
22 |
--------------------------------------------------------------------------------
/java/res/values/android_ui_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | "Unable to complete previous operation due to low memory"
4 | "Failed to open selected file"
5 | "More"
6 | "Hue"
7 | "Saturation"
8 | "Value"
9 | "Set"
10 | "Cancel"
11 | "Select color"
12 | "Red"
13 | "Cyan"
14 | "Blue"
15 | "Green"
16 | "Magenta"
17 | "Yellow"
18 | "Black"
19 | "White"
20 | "Failed to copy to the clipboard"
21 |
22 |
--------------------------------------------------------------------------------
/java/res/values/attrs_content.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/java/res/values/colors_ui.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 | #B0B0B0
9 | #FFFFFF
10 | #E5E5E5
11 | #C0C0C0
12 |
13 |
14 |
--------------------------------------------------------------------------------
/java/res/values/dimens_content.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | 7dp
11 |
12 |
--------------------------------------------------------------------------------
/java/res/values/dimens_ui.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
13 | 14.5dp
14 | 60dp
15 | 44dp
16 | 1px
17 |
18 |
19 |
--------------------------------------------------------------------------------
/java/res/values/strings_content.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/java/res/values/strings_ui.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/java/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
--------------------------------------------------------------------------------
/java/res/values/values_ui.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/java/src/OWNERS:
--------------------------------------------------------------------------------
1 | # Changes in this folder are guaranteed to affect the downstream
2 | # android_webview build. Adding one of the folks from the below list to the
3 | # review gives us time to prepare a matching change ahead of time so that our
4 | # downstream build can continue running smoothly.
5 | set noparent
6 |
7 | benm@chromium.org
8 | boliu@chomium.org
9 | michaelbai@chromium.org
10 | mkosiba@chromium.org
11 | mnaganov@chromium.org
12 | primiano@chromium.org
13 | sgurun@chromium.org
14 | torne@chromium.org
15 |
--------------------------------------------------------------------------------
/java/src/com/googlecode/eyesfree/braille/display/BrailleDisplayProperties.aidl:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.googlecode.eyesfree.braille.display;
18 |
19 | parcelable BrailleDisplayProperties;
20 |
--------------------------------------------------------------------------------
/java/src/com/googlecode/eyesfree/braille/display/BrailleInputEvent.aidl:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.googlecode.eyesfree.braille.display;
18 |
19 | parcelable BrailleInputEvent;
20 |
--------------------------------------------------------------------------------
/java/src/com/googlecode/eyesfree/braille/display/IBrailleService.aidl:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.googlecode.eyesfree.braille.display;
18 |
19 | import com.googlecode.eyesfree.braille.display.IBrailleServiceCallback;
20 |
21 | /**
22 | * Interface for clients to talk to the braille display service.
23 | */
24 | interface IBrailleService {
25 | /**
26 | * Register a callback for the {@code callingApp} which will receive
27 | * certain braille display related events.
28 | */
29 | boolean registerCallback(in IBrailleServiceCallback callback);
30 |
31 | /**
32 | * Unregister a previously registered callback for the {@code callingApp}.
33 | */
34 | oneway void unregisterCallback(in IBrailleServiceCallback callback);
35 |
36 | /**
37 | * Updates the main cells of the connected braille display
38 | * with a given dot {@code pattern}.
39 | *
40 | * @return {@code true} on success and {@code false} otherwise.
41 | */
42 | void displayDots(in byte[] patterns);
43 | }
44 |
--------------------------------------------------------------------------------
/java/src/com/googlecode/eyesfree/braille/display/IBrailleServiceCallback.aidl:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.googlecode.eyesfree.braille.display;
18 |
19 | import com.googlecode.eyesfree.braille.display.BrailleDisplayProperties;
20 | import com.googlecode.eyesfree.braille.display.BrailleInputEvent;
21 |
22 | /**
23 | * Callback interface that a braille display client can expose to
24 | * get information about various braille display events.
25 | */
26 | interface IBrailleServiceCallback {
27 | void onDisplayConnected(in BrailleDisplayProperties displayProperties);
28 | void onDisplayDisconnected();
29 | void onInput(in BrailleInputEvent inputEvent);
30 | }
31 |
--------------------------------------------------------------------------------
/java/src/com/googlecode/eyesfree/braille/selfbraille/ISelfBrailleService.aidl:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.googlecode.eyesfree.braille.selfbraille;
18 |
19 | import com.googlecode.eyesfree.braille.selfbraille.WriteData;
20 |
21 | /**
22 | * Interface for a client to control braille output for a part of the
23 | * accessibility node tree.
24 | */
25 | interface ISelfBrailleService {
26 | void write(IBinder clientToken, in WriteData writeData);
27 | oneway void disconnect(IBinder clientToken);
28 | }
29 |
--------------------------------------------------------------------------------
/java/src/com/googlecode/eyesfree/braille/selfbraille/WriteData.aidl:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.googlecode.eyesfree.braille.selfbraille;
18 |
19 | parcelable WriteData;
20 |
--------------------------------------------------------------------------------
/java/src/com/googlecode/eyesfree/braille/translate/BrailleTranslator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.googlecode.eyesfree.braille.translate;
18 |
19 | /**
20 | * Translates from text to braille and the other way according to a
21 | * particular translation table.
22 | */
23 | public interface BrailleTranslator {
24 | /**
25 | * Translates a string into the corresponding dot patterns and returns the
26 | * resulting byte array. Returns {@code null} on error.
27 | */
28 | byte[] translate(String text);
29 |
30 | /**
31 | * Translates the braille {@code cells} into the corresponding text, which
32 | * is returned. Returns {@code null} on error.
33 | */
34 | String backTranslate(byte[] cells);
35 | }
36 |
--------------------------------------------------------------------------------
/java/src/com/googlecode/eyesfree/braille/translate/ITranslatorService.aidl:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.googlecode.eyesfree.braille.translate;
18 |
19 | import com.googlecode.eyesfree.braille.translate.ITranslatorServiceCallback;
20 |
21 | interface ITranslatorService {
22 | /**
23 | * Sets a callback to be called when the service is ready to translate.
24 | * Using any of the other methods in this interface before the
25 | * callback is called with a successful status will return
26 | * failure.
27 | */
28 | void setCallback(ITranslatorServiceCallback callback);
29 |
30 | /**
31 | * Makes sure that the given table string is valid and that the
32 | * table compiles.
33 | */
34 | boolean checkTable(String tableName);
35 |
36 | /**
37 | * Translates text into braille according to the give tableName.
38 | * Returns null on fatal translation errors.
39 | */
40 | byte[] translate(String text, String tableName);
41 |
42 | /**
43 | * Translates braille cells into text according to the given table
44 | * name. Returns null on fatal translation errors.
45 | */
46 | String backTranslate(in byte[] cells, String tableName);
47 | }
48 |
--------------------------------------------------------------------------------
/java/src/com/googlecode/eyesfree/braille/translate/ITranslatorServiceCallback.aidl:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.googlecode.eyesfree.braille.translate;
18 |
19 | oneway interface ITranslatorServiceCallback {
20 | void onInit(int status);
21 | }
22 |
--------------------------------------------------------------------------------
/java/src/com/mogoweb/chrome/DownloadListener.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2013 mogoweb. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | /*
6 | * Copyright (C) 2007 The Android Open Source Project
7 | *
8 | * Licensed under the Apache License, Version 2.0 (the "License");
9 | * you may not use this file except in compliance with the License.
10 | * You may obtain a copy of the License at
11 | *
12 | * http://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing, software
15 | * distributed under the License is distributed on an "AS IS" BASIS,
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | * See the License for the specific language governing permissions and
18 | * limitations under the License.
19 | */
20 | package com.mogoweb.chrome;
21 |
22 | public interface DownloadListener {
23 |
24 | /**
25 | * Notify the host application that a file should be downloaded
26 | * @param url The full url to the content that should be downloaded
27 | * @param userAgent the user agent to be used for the download.
28 | * @param contentDisposition Content-disposition http header, if
29 | * present.
30 | * @param mimetype The mimetype of the content reported by the server
31 | * @param contentLength The file size reported by the server
32 | */
33 | public void onDownloadStart(String url, String userAgent,
34 | String contentDisposition, String mimetype, long contentLength);
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/java/src/com/mogoweb/chrome/JavascriptInterface.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.mogoweb.chrome;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 | import java.lang.annotation.Target;
23 |
24 | /**
25 | * Annotation that allows exposing methods to JavaScript. Starting from API level
26 | * {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} and above, only methods explicitly
27 | * marked with this annotation are available to the Javascript code. See
28 | * {@link android.webkit.WebView#addJavascriptInterface} for more information about it.
29 | *
30 | */
31 | @SuppressWarnings("javadoc")
32 | @Retention(RetentionPolicy.RUNTIME)
33 | @Target({ElementType.METHOD})
34 | public @interface JavascriptInterface {
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/java/src/com/mogoweb/chrome/MustOverrideException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2012 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.mogoweb.chrome;
18 |
19 | //TODO: Remove MustOverrideException and make all methods throwing it abstract instead;
20 | //needs API file update.
21 | public class MustOverrideException extends RuntimeException {
22 | MustOverrideException() {
23 | super("abstract function called: must be overriden!");
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/java/src/com/mogoweb/chrome/SslErrorHandler.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2014 mogoweb. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 | /*
5 | * Copyright (C) 2007 The Android Open Source Project
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | */
19 |
20 | package com.mogoweb.chrome;
21 |
22 | import android.os.Handler;
23 |
24 | /**
25 | * Represents a request for handling an SSL error. Instances of this class are
26 | * created by the WebView and passed to
27 | * {@link WebViewClient#onReceivedSslError}. The host application must call
28 | * either {@link #proceed} or {@link #cancel} to set the WebView's response
29 | * to the request.
30 | */
31 | public class SslErrorHandler extends Handler {
32 |
33 | /**
34 | * @hide Only for use by WebViewProvider implementations.
35 | */
36 | public SslErrorHandler() {}
37 |
38 | /**
39 | * Proceed with the SSL certificate.
40 | */
41 | public void proceed() {}
42 |
43 | /**
44 | * Cancel this request and all pending requests for the WebView that had
45 | * the error.
46 | */
47 | public void cancel() {}
48 | }
49 |
--------------------------------------------------------------------------------
/java/src/com/mogoweb/chrome/impl/DebugFlags.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2014 mogoweb. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 | /*
5 | * Copyright (C) 2009 The Android Open Source Project
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | */
19 |
20 | package com.mogoweb.chrome.impl;
21 |
22 | /**
23 | * This class is a container for all of the debug flags used in the Java
24 | * components of webkit. These flags must be final in order to ensure that
25 | * the compiler optimizes the code that uses them out of the final executable.
26 | *
27 | * The name of each flags maps directly to the name of the class in which that
28 | * flag is used.
29 | *
30 | * @hide Only used by WebView implementations.
31 | */
32 | public class DebugFlags {
33 |
34 | public static final boolean COOKIE_SYNC_MANAGER = false;
35 | public static final boolean TRACE_API = false;
36 | public static final boolean TRACE_CALLBACK = false;
37 | public static final boolean TRACE_JAVASCRIPT_BRIDGE = false;
38 | public static final boolean URL_UTIL = false;
39 | public static final boolean WEB_SYNC_MANAGER = false;
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/java/src/org/chromium/android_webview/AwContentsIoThreadClient.java:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | package org.chromium.android_webview;
6 |
7 | import org.chromium.base.CalledByNative;
8 | import org.chromium.base.JNINamespace;
9 |
10 | /**
11 | * Delegate for handling callbacks. All methods are called on the IO thread.
12 | *
13 | * You should create a separate instance for every WebContents that requires the
14 | * provided functionality.
15 | */
16 | @JNINamespace("android_webview")
17 | public interface AwContentsIoThreadClient {
18 | @CalledByNative
19 | public int getCacheMode();
20 |
21 | @CalledByNative
22 | public InterceptedRequestData shouldInterceptRequest(String url, boolean isMainFrame);
23 |
24 | @CalledByNative
25 | public boolean shouldBlockContentUrls();
26 |
27 | @CalledByNative
28 | public boolean shouldBlockFileUrls();
29 |
30 | @CalledByNative
31 | public boolean shouldBlockNetworkLoads();
32 |
33 | @CalledByNative
34 | public void onDownloadStart(String url,
35 | String userAgent,
36 | String contentDisposition,
37 | String mimeType,
38 | long contentLength);
39 |
40 | @CalledByNative
41 | public void newLoginRequest(String realm, String account, String args);
42 | }
43 |
--------------------------------------------------------------------------------
/java/src/org/chromium/android_webview/AwDevToolsServer.java:
--------------------------------------------------------------------------------
1 | // Copyright 2013 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | package org.chromium.android_webview;
6 |
7 | import org.chromium.base.JNINamespace;
8 |
9 | /**
10 | * Controller for Remote Web Debugging (Developer Tools).
11 | */
12 | @JNINamespace("android_webview")
13 | public class AwDevToolsServer {
14 |
15 | private int mNativeDevToolsServer = 0;
16 |
17 | public AwDevToolsServer() {
18 | mNativeDevToolsServer = nativeInitRemoteDebugging();
19 | }
20 |
21 | public void destroy() {
22 | nativeDestroyRemoteDebugging(mNativeDevToolsServer);
23 | mNativeDevToolsServer = 0;
24 | }
25 |
26 | public void setRemoteDebuggingEnabled(boolean enabled) {
27 | nativeSetRemoteDebuggingEnabled(mNativeDevToolsServer, enabled);
28 | }
29 |
30 | private native int nativeInitRemoteDebugging();
31 | private native void nativeDestroyRemoteDebugging(int devToolsServer);
32 | private native void nativeSetRemoteDebuggingEnabled(int devToolsServer, boolean enabled);
33 | }
34 |
--------------------------------------------------------------------------------
/java/src/org/chromium/android_webview/AwFormDatabase.java:
--------------------------------------------------------------------------------
1 | // Copyright 2013 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | package org.chromium.android_webview;
6 |
7 | import org.chromium.base.JNINamespace;
8 |
9 | /**
10 | * Exposes a subset of Chromium form database to Webview database for managing autocomplete
11 | * functionality.
12 | */
13 | @JNINamespace("android_webview")
14 | public class AwFormDatabase {
15 |
16 | public static boolean hasFormData() {
17 | return nativeHasFormData();
18 | }
19 |
20 | public static void clearFormData() {
21 | nativeClearFormData();
22 | }
23 |
24 | //--------------------------------------------------------------------------------------------
25 | // Native methods
26 | //--------------------------------------------------------------------------------------------
27 | private static native boolean nativeHasFormData();
28 |
29 | private static native void nativeClearFormData();
30 | }
31 |
--------------------------------------------------------------------------------
/java/src/org/chromium/android_webview/AwHttpAuthHandler.java:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | package org.chromium.android_webview;
6 |
7 | import org.chromium.base.CalledByNative;
8 | import org.chromium.base.JNINamespace;
9 |
10 | @JNINamespace("android_webview")
11 | public class AwHttpAuthHandler {
12 |
13 | private long mNativeAwHttpAuthHandler;
14 | private final boolean mFirstAttempt;
15 |
16 | public void proceed(String username, String password) {
17 | if (mNativeAwHttpAuthHandler != 0) {
18 | nativeProceed(mNativeAwHttpAuthHandler, username, password);
19 | mNativeAwHttpAuthHandler = 0;
20 | }
21 | }
22 |
23 | public void cancel() {
24 | if (mNativeAwHttpAuthHandler != 0) {
25 | nativeCancel(mNativeAwHttpAuthHandler);
26 | mNativeAwHttpAuthHandler = 0;
27 | }
28 | }
29 |
30 | public boolean isFirstAttempt() {
31 | return mFirstAttempt;
32 | }
33 |
34 | @CalledByNative
35 | public static AwHttpAuthHandler create(long nativeAwAuthHandler, boolean firstAttempt) {
36 | return new AwHttpAuthHandler(nativeAwAuthHandler, firstAttempt);
37 | }
38 |
39 | private AwHttpAuthHandler(long nativeAwHttpAuthHandler, boolean firstAttempt) {
40 | mNativeAwHttpAuthHandler = nativeAwHttpAuthHandler;
41 | mFirstAttempt = firstAttempt;
42 | }
43 |
44 | @CalledByNative
45 | void handlerDestroyed() {
46 | mNativeAwHttpAuthHandler = 0;
47 | }
48 |
49 | private native void nativeProceed(long nativeAwHttpAuthHandler,
50 | String username, String password);
51 | private native void nativeCancel(long nativeAwHttpAuthHandler);
52 | }
53 |
--------------------------------------------------------------------------------
/java/src/org/chromium/android_webview/AwWebContentsDelegate.java:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | package org.chromium.android_webview;
6 |
7 | import com.google.common.annotations.VisibleForTesting;
8 |
9 | import org.chromium.base.CalledByNative;
10 | import org.chromium.base.JNINamespace;
11 | import org.chromium.components.web_contents_delegate_android.WebContentsDelegateAndroid;
12 |
13 | /**
14 | * WebView-specific WebContentsDelegate.
15 | * This file is the Java version of the native class of the same name.
16 | * It should contain abstract WebContentsDelegate methods to be implemented by the embedder.
17 | * These methods belong to WebView but are not shared with the Chromium Android port.
18 | */
19 | @VisibleForTesting
20 | @JNINamespace("android_webview")
21 | public abstract class AwWebContentsDelegate extends WebContentsDelegateAndroid {
22 | // Callback filesSelectedInChooser() when done.
23 | @CalledByNative
24 | public abstract void runFileChooser(int processId, int renderId, int mode_flags,
25 | String acceptTypes, String title, String defaultFilename, boolean capture);
26 |
27 | @CalledByNative
28 | public abstract boolean addNewContents(boolean isDialog, boolean isUserGesture);
29 |
30 | @Override
31 | @CalledByNative
32 | public abstract void closeContents();
33 |
34 | @Override
35 | @CalledByNative
36 | public abstract void activateContents();
37 |
38 | // Call in response to a prior runFileChooser call.
39 | protected static native void nativeFilesSelectedInChooser(int processId, int renderId,
40 | int mode_flags, String[] filePath);
41 | }
42 |
--------------------------------------------------------------------------------
/java/src/org/chromium/android_webview/InterceptedRequestData.java:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | package org.chromium.android_webview;
6 |
7 | import org.chromium.base.CalledByNative;
8 | import org.chromium.base.JNINamespace;
9 |
10 | import java.io.InputStream;
11 |
12 | /**
13 | * The response information that is to be returned for a particular resource fetch.
14 | */
15 | @JNINamespace("android_webview")
16 | public class InterceptedRequestData {
17 | private String mMimeType;
18 | private String mCharset;
19 | private InputStream mData;
20 |
21 | public InterceptedRequestData(String mimeType, String encoding, InputStream data) {
22 | mMimeType = mimeType;
23 | mCharset = encoding;
24 | mData = data;
25 | }
26 |
27 | @CalledByNative
28 | public String getMimeType() {
29 | return mMimeType;
30 | }
31 |
32 | @CalledByNative
33 | public String getCharset() {
34 | return mCharset;
35 | }
36 |
37 | @CalledByNative
38 | public InputStream getData() {
39 | return mData;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/java/src/org/chromium/android_webview/JsPromptResultReceiver.java:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | package org.chromium.android_webview;
6 |
7 | /**
8 | * This interface is used when the AwContentsClient offers a JavaScript
9 | * modal prompt dialog to enable the client to handle the dialog in their own way.
10 | * AwContentsClient will offer an object that implements this interface to the
11 | * client and when the client has handled the dialog, it must either callback with
12 | * confirm() or cancel() to allow processing to continue.
13 | */
14 | public interface JsPromptResultReceiver {
15 | public void confirm(String result);
16 | public void cancel();
17 | }
18 |
--------------------------------------------------------------------------------
/java/src/org/chromium/android_webview/JsResultHandler.java:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | package org.chromium.android_webview;
6 |
7 | import org.chromium.base.ThreadUtils;
8 |
9 | class JsResultHandler implements JsResultReceiver, JsPromptResultReceiver {
10 | private AwContentsClientBridge mBridge;
11 | private final int mId;
12 |
13 | JsResultHandler(AwContentsClientBridge bridge, int id) {
14 | mBridge = bridge;
15 | mId = id;
16 | }
17 |
18 | @Override
19 | public void confirm() {
20 | confirm(null);
21 | }
22 |
23 | @Override
24 | public void confirm(final String promptResult) {
25 | ThreadUtils.runOnUiThread(new Runnable() {
26 | @Override
27 | public void run() {
28 | if (mBridge != null)
29 | mBridge.confirmJsResult(mId, promptResult);
30 | mBridge = null;
31 | }
32 | });
33 | }
34 |
35 | @Override
36 | public void cancel() {
37 | ThreadUtils.runOnUiThread(new Runnable() {
38 | @Override
39 | public void run() {
40 | if (mBridge != null)
41 | mBridge.cancelJsResult(mId);
42 | mBridge = null;
43 | }
44 | });
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/java/src/org/chromium/android_webview/JsResultReceiver.java:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | package org.chromium.android_webview;
6 |
7 | /**
8 | * This interface is used when the AwContentsClient offers a JavaScript
9 | * modal dialog (alert, beforeunload or confirm) to enable the client to
10 | * handle the dialog in their own way. AwContentsClient will offer an object
11 | * that implements this interface to the client and when the client has handled
12 | * the dialog, it must either callback with confirm() or cancel() to allow
13 | * processing to continue.
14 | */
15 | public interface JsResultReceiver {
16 | public void confirm();
17 | public void cancel();
18 | }
19 |
--------------------------------------------------------------------------------
/java/src/org/chromium/base/AccessedByNative.java:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | package org.chromium.base;
6 |
7 | import java.lang.annotation.ElementType;
8 | import java.lang.annotation.Retention;
9 | import java.lang.annotation.RetentionPolicy;
10 | import java.lang.annotation.Target;
11 |
12 | /**
13 | * @AccessedByNative is used to ensure proguard will keep this field, since it's
14 | * only accessed by native.
15 | */
16 | @Target(ElementType.FIELD)
17 | @Retention(RetentionPolicy.CLASS)
18 | public @interface AccessedByNative {
19 | public String value() default "";
20 | }
21 |
--------------------------------------------------------------------------------
/java/src/org/chromium/base/ActivityState.java:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | package org.chromium.base;
6 |
7 |
8 |
9 |
10 | interface ActivityState {
11 | public final int CREATED = 1;
12 | public final int STARTED = 2;
13 | public final int RESUMED = 3;
14 | public final int PAUSED = 4;
15 | public final int STOPPED = 5;
16 | public final int DESTROYED = 6;
17 | }
18 |
--------------------------------------------------------------------------------
/java/src/org/chromium/base/ActivityState.template:
--------------------------------------------------------------------------------
1 | // Copyright 2013 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | package org.chromium.base;
6 |
7 | // A simple auto-generated interface used to list the various
8 | // states of an activity as used by both org.chromium.base.ActivityStatus
9 | // and base/android/activity_status.h
10 | interface ActivityState {
11 | #define DEFINE_ACTIVITY_STATE(x,y) public final int x = y;
12 | #include "base/android/activity_state_list.h"
13 | #undef DEFINE_ACTIVITY_STATE
14 | }
15 |
--------------------------------------------------------------------------------
/java/src/org/chromium/base/BaseChromiumApplication.java:
--------------------------------------------------------------------------------
1 | // Copyright 2013 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | package org.chromium.base;
6 |
7 | import android.app.Application;
8 |
9 | /**
10 | * Basic application functionality that should be shared among all browser applications.
11 | */
12 | public class BaseChromiumApplication extends Application {
13 |
14 | @Override
15 | public void onCreate() {
16 | super.onCreate();
17 | ActivityStatus.initialize(this);
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/java/src/org/chromium/base/BaseSwitches.java:
--------------------------------------------------------------------------------
1 | // Copyright 2013 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | package org.chromium.base;
6 |
7 | /**
8 | * Contains all of the command line switches that are specific to the base/
9 | * portion of Chromium on Android.
10 | */
11 | public abstract class BaseSwitches {
12 | // Block onCreate() of Chrome until a Java debugger is attached.
13 | public static final String WAIT_FOR_JAVA_DEBUGGER = "wait-for-java-debugger";
14 |
15 | // Overrides low-end device detection, disabling low-end device optimizations.
16 | public static final String DISABLE_LOW_END_DEVICE_MODE = "disable-low-end-device-mode";
17 |
18 | // Overrides low-end device detection, enabling low-end device optimizations.
19 | public static final String ENABLE_LOW_END_DEVICE_MODE = "enable-low-end-device-mode";
20 |
21 | // Adds additional thread idle time information into the trace event output.
22 | public static final String ENABLE_IDLE_TRACING = "enable-idle-tracing";
23 |
24 | // Prevent instantiation.
25 | private BaseSwitches() {}
26 | }
27 |
--------------------------------------------------------------------------------
/java/src/org/chromium/base/CalledByNative.java:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | package org.chromium.base;
6 |
7 | import java.lang.annotation.ElementType;
8 | import java.lang.annotation.Retention;
9 | import java.lang.annotation.RetentionPolicy;
10 | import java.lang.annotation.Target;
11 |
12 | /**
13 | * @CalledByNative is used by the JNI generator to create the necessary JNI
14 | * bindings and expose this method to native code.
15 | */
16 | @Target(ElementType.METHOD)
17 | @Retention(RetentionPolicy.CLASS)
18 | public @interface CalledByNative {
19 | /*
20 | * If present, tells which inner class the method belongs to.
21 | */
22 | public String value() default "";
23 | }
24 |
--------------------------------------------------------------------------------
/java/src/org/chromium/base/CalledByNativeUnchecked.java:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | package org.chromium.base;
6 |
7 | import java.lang.annotation.ElementType;
8 | import java.lang.annotation.Retention;
9 | import java.lang.annotation.RetentionPolicy;
10 | import java.lang.annotation.Target;
11 |
12 | /**
13 | * @CalledByNativeUnchecked is used to generate JNI bindings that do not check for exceptions.
14 | * It only makes sense to use this annotation on methods that declare a throws... spec.
15 | * However, note that the exception received native side maybe an 'unchecked' (RuntimeExpception)
16 | * such as NullPointerException, so the native code should differentiate these cases.
17 | * Usage of this should be very rare; where possible handle exceptions in the Java side and use a
18 | * return value to indicate success / failure.
19 | */
20 | @Target(ElementType.METHOD)
21 | @Retention(RetentionPolicy.CLASS)
22 | public @interface CalledByNativeUnchecked {
23 | /*
24 | * If present, tells which inner class the method belongs to.
25 | */
26 | public String value() default "";
27 | }
28 |
--------------------------------------------------------------------------------
/java/src/org/chromium/base/ChromiumApplication.java:
--------------------------------------------------------------------------------
1 | // Copyright 2013 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | package org.chromium.base;
6 |
7 | import android.app.Application;
8 |
9 | /**
10 | * Basic application functionality that should be shared among all browser applications.
11 | */
12 | public class ChromiumApplication extends Application {
13 |
14 | @Override
15 | public void onCreate() {
16 | super.onCreate();
17 | ActivityStatus.initialize(this);
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/java/src/org/chromium/base/CollectionUtil.java:
--------------------------------------------------------------------------------
1 | // Copyright 2013 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | package org.chromium.base;
6 |
7 | import java.util.ArrayList;
8 | import java.util.Collections;
9 | import java.util.HashSet;
10 |
11 | /**
12 | * Functions used for easier initialization of Java collections. Inspired by
13 | * functionality in com.google.common.collect in Guava but cherry-picked to
14 | * bare-minimum functionality to avoid bloat. (http://crbug.com/272790 provides
15 | * further details)
16 | */
17 | public final class CollectionUtil {
18 | private CollectionUtil() {}
19 |
20 | public static HashSet newHashSet(E... elements) {
21 | HashSet set = new HashSet(elements.length);
22 | Collections.addAll(set, elements);
23 | return set;
24 | }
25 |
26 | public static ArrayList newArrayList(E... elements) {
27 | ArrayList list = new ArrayList(elements.length);
28 | Collections.addAll(list, elements);
29 | return list;
30 | }
31 |
32 | public static ArrayList newArrayList(Iterable iterable) {
33 | ArrayList list = new ArrayList();
34 | for (E element : iterable) {
35 | list.add(element);
36 | }
37 | return list;
38 | }
39 | }
--------------------------------------------------------------------------------
/java/src/org/chromium/base/CpuFeatures.java:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | package org.chromium.base;
6 |
7 | // The only purpose of this class is to allow sending CPU properties
8 | // from the browser process to sandboxed renderer processes. This is
9 | // needed because sandboxed processes cannot, on ARM, query the kernel
10 | // about the CPU's properties by parsing /proc, so this operation must
11 | // be performed in the browser process, and the result passed to
12 | // renderer ones.
13 | //
14 | // For more context, see http://crbug.com/164154
15 | //
16 | // Technically, this is a wrapper around the native NDK cpufeatures
17 | // library. The exact CPU features bits are never used in Java so
18 | // there is no point in duplicating their definitions here.
19 | //
20 | @JNINamespace("base::android")
21 | public abstract class CpuFeatures {
22 | /**
23 | * Return the number of CPU Cores on the device.
24 | */
25 | public static int getCount() {
26 | return nativeGetCoreCount();
27 | }
28 |
29 | /**
30 | * Return the CPU feature mask.
31 | * This is a 64-bit integer that corresponds to the CPU's features.
32 | * The value comes directly from android_getCpuFeatures().
33 | */
34 | public static long getMask() {
35 | return nativeGetCpuFeatures();
36 | }
37 |
38 | private static native int nativeGetCoreCount();
39 | private static native long nativeGetCpuFeatures();
40 | }
41 |
--------------------------------------------------------------------------------
/java/src/org/chromium/base/ImportantFileWriterAndroid.java:
--------------------------------------------------------------------------------
1 | // Copyright 2013 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | package org.chromium.base;
6 |
7 | /**
8 | * This class provides an interface to the native class for writing
9 | * important data files without risking data loss.
10 | */
11 | @JNINamespace("base::android")
12 | public class ImportantFileWriterAndroid {
13 |
14 | /**
15 | * Write a binary file atomically.
16 | *
17 | * This either writes all the data or leaves the file unchanged.
18 | *
19 | * @param fileName The complete path of the file to be written
20 | * @param data The data to be written to the file
21 | * @return true if the data was written to the file, false if not.
22 | */
23 | public static boolean writeFileAtomically(String fileName, byte[] data) {
24 | return nativeWriteFileAtomically(fileName, data);
25 | }
26 |
27 | private static native boolean nativeWriteFileAtomically(
28 | String fileName, byte[] data);
29 | }
30 |
--------------------------------------------------------------------------------
/java/src/org/chromium/base/JNINamespace.java:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | package org.chromium.base;
6 |
7 | import java.lang.annotation.ElementType;
8 | import java.lang.annotation.Retention;
9 | import java.lang.annotation.RetentionPolicy;
10 | import java.lang.annotation.Target;
11 |
12 | /**
13 | * @JNINamespace is used by the JNI generator to create the necessary JNI
14 | * bindings and expose this method to native code using the specified namespace.
15 | */
16 | @Target(ElementType.TYPE)
17 | @Retention(RetentionPolicy.RUNTIME)
18 | public @interface JNINamespace {
19 | public String value();
20 | }
21 |
--------------------------------------------------------------------------------
/java/src/org/chromium/base/JavaHandlerThread.java:
--------------------------------------------------------------------------------
1 | // Copyright 2013 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | package org.chromium.base;
6 |
7 | import android.os.Handler;
8 | import android.os.HandlerThread;
9 |
10 | /**
11 | * This class is an internal detail of the native counterpart.
12 | * It is instantiated and owned by the native object.
13 | */
14 | @JNINamespace("base::android")
15 | class JavaHandlerThread {
16 | final HandlerThread mThread;
17 |
18 | private JavaHandlerThread(String name) {
19 | mThread = new HandlerThread(name);
20 | }
21 |
22 | @CalledByNative
23 | private static JavaHandlerThread create(String name) {
24 | return new JavaHandlerThread(name);
25 | }
26 |
27 | @CalledByNative
28 | private void start(final long nativeThread, final long nativeEvent) {
29 | mThread.start();
30 | new Handler(mThread.getLooper()).post(new Runnable() {
31 | @Override
32 | public void run() {
33 | nativeInitializeThread(nativeThread, nativeEvent);
34 | }
35 | });
36 | }
37 |
38 | private native void nativeInitializeThread(long nativeJavaHandlerThread, long nativeEvent);
39 | }
40 |
--------------------------------------------------------------------------------
/java/src/org/chromium/base/MemoryPressureLevelList.java:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | package org.chromium.base;
6 |
7 | class MemoryPressureLevelList {
8 |
9 |
10 |
11 |
12 |
13 |
14 | static final int MEMORY_PRESSURE_MODERATE = 0;
15 |
16 |
17 |
18 |
19 | static final int MEMORY_PRESSURE_CRITICAL = 2;
20 | }
21 |
--------------------------------------------------------------------------------
/java/src/org/chromium/base/MemoryPressureLevelList.template:
--------------------------------------------------------------------------------
1 | // Copyright 2013 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | package org.chromium.base;
6 |
7 | class MemoryPressureLevelList {
8 | #define DEFINE_MEMORY_PRESSURE_LEVEL(name, value) \
9 | static final int name = value;
10 | #include "base/memory/memory_pressure_level_list.h"
11 | #undef DEFINE_MEMORY_PRESSURE_LEVEL
12 | }
13 |
--------------------------------------------------------------------------------
/java/src/org/chromium/base/NativeClassQualifiedName.java:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | package org.chromium.base;
6 |
7 | import java.lang.annotation.ElementType;
8 | import java.lang.annotation.Retention;
9 | import java.lang.annotation.RetentionPolicy;
10 | import java.lang.annotation.Target;
11 |
12 | /**
13 | * @NativeClassQualifiedName is used by the JNI generator to create the necessary JNI
14 | * bindings to call into the specified native class name.
15 | */
16 | @Target(ElementType.METHOD)
17 | @Retention(RetentionPolicy.RUNTIME)
18 | public @interface NativeClassQualifiedName {
19 | /*
20 | * Tells which native class the method is going to be bound to.
21 | * The first parameter of the annotated method must be an int nativePtr pointing to
22 | * an instance of this class.
23 | */
24 | public String value();
25 | }
26 |
--------------------------------------------------------------------------------
/java/src/org/chromium/base/PathService.java:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | package org.chromium.base;
6 |
7 | /**
8 | * This class provides java side access to the native PathService.
9 | */
10 | @JNINamespace("base::android")
11 | public abstract class PathService {
12 |
13 | // Must match the value of DIR_MODULE in base/base_paths.h!
14 | public static final int DIR_MODULE = 3;
15 |
16 | // Prevent instantiation.
17 | private PathService() {}
18 |
19 | public static void override(int what, String path) {
20 | nativeOverride(what, path);
21 | }
22 |
23 | private static native void nativeOverride(int what, String path);
24 | }
25 |
--------------------------------------------------------------------------------
/java/src/org/chromium/base/PowerStatusReceiver.java:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | package org.chromium.base;
6 |
7 | import android.content.BroadcastReceiver;
8 | import android.content.Context;
9 | import android.content.Intent;
10 |
11 |
12 | /**
13 | * A BroadcastReceiver that listens to changes in power status and notifies
14 | * PowerMonitor.
15 | * It's instantiated by the framework via the application intent-filter
16 | * declared in its manifest.
17 | */
18 | public class PowerStatusReceiver extends BroadcastReceiver {
19 | @Override
20 | public void onReceive(Context context, Intent intent) {
21 | PowerMonitor.onBatteryChargingChanged(intent);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/java/src/org/chromium/base/SystemMessageHandler.java:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | package org.chromium.base;
6 |
7 | import android.os.Handler;
8 | import android.os.Message;
9 |
10 | class SystemMessageHandler extends Handler {
11 |
12 | private static final int TIMER_MESSAGE = 1;
13 | private static final int DELAYED_TIMER_MESSAGE = 2;
14 |
15 | // Native class pointer set by the constructor of the SharedClient native class.
16 | private long mMessagePumpDelegateNative = 0;
17 |
18 | private SystemMessageHandler(long messagePumpDelegateNative) {
19 | mMessagePumpDelegateNative = messagePumpDelegateNative;
20 | }
21 |
22 | @Override
23 | public void handleMessage(Message msg) {
24 | nativeDoRunLoopOnce(mMessagePumpDelegateNative);
25 | }
26 |
27 | @SuppressWarnings("unused")
28 | @CalledByNative
29 | private void setTimer() {
30 | sendEmptyMessage(TIMER_MESSAGE);
31 | }
32 |
33 | @SuppressWarnings("unused")
34 | @CalledByNative
35 | private void setDelayedTimer(long millis) {
36 | removeMessages(DELAYED_TIMER_MESSAGE);
37 | sendEmptyMessageDelayed(DELAYED_TIMER_MESSAGE, millis);
38 | }
39 |
40 | @SuppressWarnings("unused")
41 | @CalledByNative
42 | private void removeTimer() {
43 | removeMessages(TIMER_MESSAGE);
44 | }
45 |
46 | @CalledByNative
47 | private static SystemMessageHandler create(long messagePumpDelegateNative) {
48 | return new SystemMessageHandler(messagePumpDelegateNative);
49 | }
50 |
51 | private native void nativeDoRunLoopOnce(long messagePumpDelegateNative);
52 | }
53 |
--------------------------------------------------------------------------------
/java/src/org/chromium/base/WeakContext.java:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Chromium Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | package org.chromium.base;
6 |
7 | import android.content.Context;
8 |
9 | import java.lang.ref.WeakReference;
10 | import java.util.concurrent.Callable;
11 |
12 | /**
13 | * Holds a WeakReference to Context to allow it to be GC'd.
14 | * Also provides utility functions to getSystemService from the UI or any
15 | * other thread (may return null, if the Context has been nullified).
16 | */
17 | public class WeakContext {
18 | private static WeakReference sWeakContext;
19 |
20 | public static void initializeWeakContext(final Context context) {
21 | sWeakContext = new WeakReference(context);
22 | }
23 |
24 | public static Context getContext() {
25 | return sWeakContext.get();
26 | }
27 |
28 | // Returns a system service. May be called from any thread.
29 | // If necessary, it will send a message to the main thread to acquire the
30 | // service, and block waiting for it to complete.
31 | // May return null if context is no longer available.
32 | public static Object getSystemService(final String name) {
33 | final Context context = sWeakContext.get();
34 | if (context == null) {
35 | return null;
36 | }
37 | if (ThreadUtils.runningOnUiThread()) {
38 | return context.getSystemService(name);
39 | }
40 | return ThreadUtils.runOnUiThreadBlockingNoException(new Callable