├── MODULE_LICENSE_APACHE2
├── res
├── drawable
│ ├── ssl_icon.png
│ ├── ic_btn_stop_v2.png
│ ├── ic_close_tab.png
│ ├── ic_list_gps_on.png
│ ├── ic_menu_list.png
│ ├── page_indicator.png
│ ├── btn_close_window.png
│ ├── ic_btn_bookmarks.png
│ ├── ic_btn_find_next.png
│ ├── ic_btn_find_prev.png
│ ├── ic_list_bookmark.png
│ ├── ic_list_data_off.png
│ ├── ic_menu_bookmark.png
│ ├── ic_menu_windows.png
│ ├── app_web_browser_sm.png
│ ├── bookmark_shadow.9.png
│ ├── browser_thumbnail.png
│ ├── fav_icn_background.png
│ ├── ic_btn_close_panel.png
│ ├── ic_dialog_bookmark.png
│ ├── ic_launcher_browser.png
│ ├── ic_list_data_large.png
│ ├── ic_list_data_small.png
│ ├── ic_list_gps_denied.png
│ ├── ic_list_new_window.png
│ ├── ic_menu_bookmarks.png
│ ├── ic_menu_new_window.png
│ ├── ic_menu_thumbnail.png
│ ├── default_video_poster.png
│ ├── ic_launcher_drm_file.png
│ ├── ic_menu_add_bookmark.png
│ ├── ic_dialog_menu_generic.png
│ ├── ic_tab_history_selected.png
│ ├── search_plate_browser.9.png
│ ├── ic_btn_bookmark_browsertab.png
│ ├── ic_search_category_browser.png
│ ├── ic_search_category_history.png
│ ├── ic_search_category_suggest.png
│ ├── ic_tab_bookmarks_selected.png
│ ├── ic_tab_history_unselected.png
│ ├── page_indicator_unselected2.png
│ ├── pattern_carbon_fiber_dark.png
│ ├── ic_search_category_bookmark.png
│ ├── ic_tab_bookmarks_unselected.png
│ ├── ic_tab_most_visited_selected.png
│ ├── ic_dialog_browser_security_bad.png
│ ├── ic_dialog_browser_security_good.png
│ ├── ic_tab_most_visited_unselected.png
│ ├── dialog_divider_horizontal_light.9.png
│ ├── ic_dialog_browser_certificate_secure.png
│ ├── ic_launcher_shortcut_browser_bookmark.png
│ ├── ic_dialog_browser_certificate_partially_secure.png
│ ├── blank.xml
│ ├── browser_history_tab.xml
│ ├── browser_bookmark_tab.xml
│ ├── browser_visited_tab.xml
│ ├── button_line.xml
│ ├── title_text.xml
│ ├── btn_bookmark.xml
│ └── close_background.xml
├── drawable-mdpi
│ └── ic_launcher_browser.png
├── menu
│ ├── downloadhistorycontextfailed.xml
│ ├── downloadhistorycontextrunning.xml
│ ├── websitesettings.xml
│ ├── history.xml
│ ├── bookmarks.xml
│ ├── downloadhistorycontextfinished.xml
│ ├── downloadhistory.xml
│ ├── tabscontext.xml
│ ├── title_context.xml
│ ├── historycontext.xml
│ ├── bookmarkscontext.xml
│ ├── browsercontext.xml
│ └── browser.xml
├── anim
│ ├── find_dialog_enter.xml
│ ├── find_dialog_exit.xml
│ ├── title_bar_exit.xml
│ └── title_bar_enter.xml
├── layout
│ ├── no_downloads.xml
│ ├── empty_history.xml
│ ├── history_header.xml
│ ├── browser_bookmarks_page.xml
│ ├── browser_downloads_page.xml
│ ├── title_bar_bg.xml
│ ├── tabs.xml
│ ├── custom_screen.xml
│ ├── tab_view_add_tab.xml
│ ├── video_loading_progress.xml
│ ├── ssl_warning.xml
│ ├── tab.xml
│ ├── active_tabs.xml
│ ├── ssl_success.xml
│ ├── ssl_warnings.xml
│ ├── tabitem.xml
│ ├── browser_subwindow.xml
│ ├── add_new_bookmark.xml
│ ├── error_console.xml
│ ├── http_authentication.xml
│ ├── history_item.xml
│ ├── website_settings_row.xml
│ ├── page_info.xml
│ ├── browser_find.xml
│ ├── tab_view.xml
│ ├── bookmark_thumbnail.xml
│ ├── title_bar.xml
│ ├── browser_download_item.xml
│ ├── geolocation_permissions_prompt.xml
│ ├── browser_add_bookmark.xml
│ └── permission_dialog.xml
├── values
│ ├── themes.xml
│ ├── colors.xml
│ └── styles.xml
├── xml
│ ├── bookmarks_searchable.xml
│ ├── searchable.xml
│ └── debug_preferences.xml
├── values-ja
│ └── arrays.xml
├── values-ko
│ └── arrays.xml
├── values-zh-rCN
│ └── arrays.xml
├── values-zh-rTW
│ └── arrays.xml
├── values-nb
│ └── arrays.xml
├── values-ru
│ └── arrays.xml
├── values-sv
│ └── arrays.xml
├── values-de
│ └── arrays.xml
├── values-el
│ └── arrays.xml
├── values-es-rUS
│ └── arrays.xml
├── values-es
│ └── arrays.xml
├── values-fr
│ └── arrays.xml
├── values-it
│ └── arrays.xml
├── values-nl
│ └── arrays.xml
├── values-pt
│ └── arrays.xml
├── values-tr
│ └── arrays.xml
├── values-cs
│ └── arrays.xml
├── values-da
│ └── arrays.xml
├── values-pl
│ └── arrays.xml
├── values-pt-rPT
│ └── arrays.xml
└── layout-land
│ ├── page_info.xml
│ └── http_authentication.xml
├── Android.mk
├── assets
└── html
│ └── flashtest.html
├── tests
├── Android.mk
└── AndroidManifest.xml
└── src
└── com
└── android
└── browser
├── BookmarkSearch.java
├── AddNewBookmark.java
├── Browser.java
├── BrowserHomepagePreference.java
├── BrowserYesNoPreference.java
├── Dots.java
├── HistoryItem.java
├── BookmarkItem.java
├── GeolocationPermissionsPrompt.java
├── DownloadTouchIcon.java
└── FetchUrlMimeType.java
/MODULE_LICENSE_APACHE2:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/res/drawable/ssl_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ssl_icon.png
--------------------------------------------------------------------------------
/res/drawable/ic_btn_stop_v2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_btn_stop_v2.png
--------------------------------------------------------------------------------
/res/drawable/ic_close_tab.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_close_tab.png
--------------------------------------------------------------------------------
/res/drawable/ic_list_gps_on.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_list_gps_on.png
--------------------------------------------------------------------------------
/res/drawable/ic_menu_list.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_menu_list.png
--------------------------------------------------------------------------------
/res/drawable/page_indicator.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/page_indicator.png
--------------------------------------------------------------------------------
/res/drawable/btn_close_window.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/btn_close_window.png
--------------------------------------------------------------------------------
/res/drawable/ic_btn_bookmarks.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_btn_bookmarks.png
--------------------------------------------------------------------------------
/res/drawable/ic_btn_find_next.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_btn_find_next.png
--------------------------------------------------------------------------------
/res/drawable/ic_btn_find_prev.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_btn_find_prev.png
--------------------------------------------------------------------------------
/res/drawable/ic_list_bookmark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_list_bookmark.png
--------------------------------------------------------------------------------
/res/drawable/ic_list_data_off.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_list_data_off.png
--------------------------------------------------------------------------------
/res/drawable/ic_menu_bookmark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_menu_bookmark.png
--------------------------------------------------------------------------------
/res/drawable/ic_menu_windows.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_menu_windows.png
--------------------------------------------------------------------------------
/res/drawable/app_web_browser_sm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/app_web_browser_sm.png
--------------------------------------------------------------------------------
/res/drawable/bookmark_shadow.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/bookmark_shadow.9.png
--------------------------------------------------------------------------------
/res/drawable/browser_thumbnail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/browser_thumbnail.png
--------------------------------------------------------------------------------
/res/drawable/fav_icn_background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/fav_icn_background.png
--------------------------------------------------------------------------------
/res/drawable/ic_btn_close_panel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_btn_close_panel.png
--------------------------------------------------------------------------------
/res/drawable/ic_dialog_bookmark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_dialog_bookmark.png
--------------------------------------------------------------------------------
/res/drawable/ic_launcher_browser.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_launcher_browser.png
--------------------------------------------------------------------------------
/res/drawable/ic_list_data_large.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_list_data_large.png
--------------------------------------------------------------------------------
/res/drawable/ic_list_data_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_list_data_small.png
--------------------------------------------------------------------------------
/res/drawable/ic_list_gps_denied.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_list_gps_denied.png
--------------------------------------------------------------------------------
/res/drawable/ic_list_new_window.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_list_new_window.png
--------------------------------------------------------------------------------
/res/drawable/ic_menu_bookmarks.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_menu_bookmarks.png
--------------------------------------------------------------------------------
/res/drawable/ic_menu_new_window.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_menu_new_window.png
--------------------------------------------------------------------------------
/res/drawable/ic_menu_thumbnail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_menu_thumbnail.png
--------------------------------------------------------------------------------
/res/drawable/default_video_poster.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/default_video_poster.png
--------------------------------------------------------------------------------
/res/drawable/ic_launcher_drm_file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_launcher_drm_file.png
--------------------------------------------------------------------------------
/res/drawable/ic_menu_add_bookmark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_menu_add_bookmark.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_launcher_browser.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable-mdpi/ic_launcher_browser.png
--------------------------------------------------------------------------------
/res/drawable/ic_dialog_menu_generic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_dialog_menu_generic.png
--------------------------------------------------------------------------------
/res/drawable/ic_tab_history_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_tab_history_selected.png
--------------------------------------------------------------------------------
/res/drawable/search_plate_browser.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/search_plate_browser.9.png
--------------------------------------------------------------------------------
/res/drawable/ic_btn_bookmark_browsertab.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_btn_bookmark_browsertab.png
--------------------------------------------------------------------------------
/res/drawable/ic_search_category_browser.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_search_category_browser.png
--------------------------------------------------------------------------------
/res/drawable/ic_search_category_history.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_search_category_history.png
--------------------------------------------------------------------------------
/res/drawable/ic_search_category_suggest.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_search_category_suggest.png
--------------------------------------------------------------------------------
/res/drawable/ic_tab_bookmarks_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_tab_bookmarks_selected.png
--------------------------------------------------------------------------------
/res/drawable/ic_tab_history_unselected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_tab_history_unselected.png
--------------------------------------------------------------------------------
/res/drawable/page_indicator_unselected2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/page_indicator_unselected2.png
--------------------------------------------------------------------------------
/res/drawable/pattern_carbon_fiber_dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/pattern_carbon_fiber_dark.png
--------------------------------------------------------------------------------
/res/drawable/ic_search_category_bookmark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_search_category_bookmark.png
--------------------------------------------------------------------------------
/res/drawable/ic_tab_bookmarks_unselected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_tab_bookmarks_unselected.png
--------------------------------------------------------------------------------
/res/drawable/ic_tab_most_visited_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_tab_most_visited_selected.png
--------------------------------------------------------------------------------
/res/drawable/ic_dialog_browser_security_bad.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_dialog_browser_security_bad.png
--------------------------------------------------------------------------------
/res/drawable/ic_dialog_browser_security_good.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_dialog_browser_security_good.png
--------------------------------------------------------------------------------
/res/drawable/ic_tab_most_visited_unselected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_tab_most_visited_unselected.png
--------------------------------------------------------------------------------
/res/drawable/dialog_divider_horizontal_light.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/dialog_divider_horizontal_light.9.png
--------------------------------------------------------------------------------
/res/drawable/ic_dialog_browser_certificate_secure.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_dialog_browser_certificate_secure.png
--------------------------------------------------------------------------------
/res/drawable/ic_launcher_shortcut_browser_bookmark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_launcher_shortcut_browser_bookmark.png
--------------------------------------------------------------------------------
/res/drawable/ic_dialog_browser_certificate_partially_secure.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nobunobuta/android_packages_apps_Browser/HEAD/res/drawable/ic_dialog_browser_certificate_partially_secure.png
--------------------------------------------------------------------------------
/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH:= $(call my-dir)
2 | include $(CLEAR_VARS)
3 |
4 | LOCAL_MODULE_TAGS := user
5 |
6 | LOCAL_STATIC_JAVA_LIBRARIES := google-framework
7 |
8 | LOCAL_SRC_FILES := $(call all-subdir-java-files)
9 | LOCAL_JAVA_LIBRARIES := com.cyanogenmod.android
10 |
11 | LOCAL_PACKAGE_NAME := Browser
12 |
13 | include $(BUILD_PACKAGE)
14 |
15 | # additionally, build tests in sub-folders in a separate .apk
16 | include $(call all-makefiles-under,$(LOCAL_PATH))
17 |
--------------------------------------------------------------------------------
/assets/html/flashtest.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Flash test
4 |
5 |
6 | Flash test
7 | This is text above the plugin
8 | Google
9 |
10 | lhs
11 |
14 |
15 |
16 | This is some the text and more text and more text and more text and more text and more text and more text and more text and more text and more text and more text
17 |
18 |
19 |
--------------------------------------------------------------------------------
/res/menu/downloadhistorycontextfailed.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
23 |
--------------------------------------------------------------------------------
/res/menu/downloadhistorycontextrunning.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
23 |
--------------------------------------------------------------------------------
/res/menu/websitesettings.xml:
--------------------------------------------------------------------------------
1 |
15 |
16 |
21 |
22 |
--------------------------------------------------------------------------------
/res/menu/history.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
22 |
--------------------------------------------------------------------------------
/res/drawable/blank.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 | -
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/res/drawable/browser_history_tab.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/res/drawable/browser_bookmark_tab.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/res/drawable/browser_visited_tab.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/res/menu/bookmarks.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
24 |
--------------------------------------------------------------------------------
/res/anim/find_dialog_enter.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/res/anim/find_dialog_exit.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/res/menu/downloadhistorycontextfinished.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
25 |
--------------------------------------------------------------------------------
/res/layout/no_downloads.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
26 |
--------------------------------------------------------------------------------
/res/drawable/button_line.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 | -
18 |
19 |
20 |
21 |
22 | -
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/res/layout/empty_history.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
27 |
--------------------------------------------------------------------------------
/res/anim/title_bar_exit.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
18 |
20 |
22 |
23 |
--------------------------------------------------------------------------------
/res/layout/history_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
--------------------------------------------------------------------------------
/res/anim/title_bar_enter.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
19 |
21 |
23 |
24 |
--------------------------------------------------------------------------------
/res/drawable/title_text.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
19 |
20 |
22 |
24 |
25 |
--------------------------------------------------------------------------------
/res/layout/browser_bookmarks_page.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
22 |
27 |
28 |
--------------------------------------------------------------------------------
/res/menu/downloadhistory.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
27 |
--------------------------------------------------------------------------------
/res/drawable/btn_bookmark.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
19 |
20 |
22 |
24 |
25 |
--------------------------------------------------------------------------------
/res/drawable/close_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
19 |
21 |
23 |
25 |
26 |
--------------------------------------------------------------------------------
/res/menu/tabscontext.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
27 |
--------------------------------------------------------------------------------
/res/layout/browser_downloads_page.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
26 |
31 |
32 |
--------------------------------------------------------------------------------
/res/layout/title_bar_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
23 |
29 |
30 |
--------------------------------------------------------------------------------
/res/menu/title_context.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
27 |
--------------------------------------------------------------------------------
/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
28 |
29 |
--------------------------------------------------------------------------------
/tests/Android.mk:
--------------------------------------------------------------------------------
1 | # Copyright 2008, The Android Open Source Project
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | LOCAL_PATH:= $(call my-dir)
16 | include $(CLEAR_VARS)
17 |
18 | # We only want this apk build for tests.
19 | LOCAL_MODULE_TAGS := tests
20 |
21 | LOCAL_JAVA_LIBRARIES := android.test.runner
22 |
23 | # Include all test java files.
24 | LOCAL_SRC_FILES := $(call all-java-files-under, src)
25 |
26 | # Notice that we don't have to include the src files of Browser because, by
27 | # running the tests using an instrumentation targeting Browser, we
28 | # automatically get all of its classes loaded into our environment.
29 |
30 | LOCAL_PACKAGE_NAME := BrowserTests
31 |
32 | LOCAL_INSTRUMENTATION_FOR := Browser
33 |
34 | LOCAL_SDK_VERSION := current
35 |
36 | include $(BUILD_PACKAGE)
37 |
38 |
--------------------------------------------------------------------------------
/res/xml/bookmarks_searchable.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
31 |
--------------------------------------------------------------------------------
/res/layout/tabs.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
20 |
21 |
25 |
26 |
30 |
31 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/res/xml/searchable.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
19 |
20 |
34 |
--------------------------------------------------------------------------------
/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
20 |
22 |
23 | #ffffffff
24 | #ff000000
25 |
26 | #ffffffff
27 | #ff000000
28 |
29 | #ffffffff
30 | #ffffffff
31 |
32 | #ffffffff
33 | #ff000000
34 | #ffbbbbbb
35 | #ff777777
36 |
37 | #ffdddddd
38 |
39 |
40 |
--------------------------------------------------------------------------------
/res/values-ja/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
18 |
19 | - "割り当てられません"
20 | - "5MB"
21 | - "10MB"
22 | - "30MB"
23 | - "100MB"
24 |
25 |
26 | - "0"
27 | - "5"
28 | - "10"
29 | - "30"
30 | - "100"
31 |
32 |
33 |
--------------------------------------------------------------------------------
/res/values-ko/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
18 |
19 | - "할당된 저장용량이 없습니다."
20 | - "5MB"
21 | - "10MB"
22 | - "30MB"
23 | - "100MB"
24 |
25 |
26 | - "0"
27 | - "5"
28 | - "10"
29 | - "30"
30 | - "100"
31 |
32 |
33 |
--------------------------------------------------------------------------------
/res/values-zh-rCN/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
18 |
19 | - "不允许设置配额"
20 | - "5 MB"
21 | - "10 MB"
22 | - "30 MB"
23 | - "100 MB"
24 |
25 |
26 | - "0"
27 | - "5"
28 | - "10"
29 | - "30"
30 | - "100"
31 |
32 |
33 |
--------------------------------------------------------------------------------
/res/values-zh-rTW/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
18 |
19 | - "未獲得任何配額"
20 | - "5 MB"
21 | - "10 MB"
22 | - "30 MB"
23 | - "100 MB"
24 |
25 |
26 | - "0"
27 | - "5"
28 | - "10"
29 | - "30"
30 | - "100"
31 |
32 |
33 |
--------------------------------------------------------------------------------
/res/values-nb/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
18 |
19 | - "Ingen kvote tillatt"
20 | - "5 MB"
21 | - "10 MB"
22 | - "30 MB"
23 | - "100 MB"
24 |
25 |
26 | - "0"
27 | - "5"
28 | - "10"
29 | - "30"
30 | - "100"
31 |
32 |
33 |
--------------------------------------------------------------------------------
/res/values-ru/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
18 |
19 | - "Квота не назначена"
20 | - "5 МБ"
21 | - "10 МБ"
22 | - "30 МБ"
23 | - "100 МБ"
24 |
25 |
26 | - "0"
27 | - "5"
28 | - "10"
29 | - "30"
30 | - "100"
31 |
32 |
33 |
--------------------------------------------------------------------------------
/res/values-sv/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
18 |
19 | - "Ingen kvot tillåts"
20 | - "5 MB"
21 | - "10 MB"
22 | - "30 MB"
23 | - "100 MB"
24 |
25 |
26 | - "0"
27 | - "5"
28 | - "10"
29 | - "30"
30 | - "100"
31 |
32 |
33 |
--------------------------------------------------------------------------------
/res/values-de/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
18 |
19 | - "Kein Kontingent erlaubt"
20 | - "5 MB"
21 | - "10 MB"
22 | - "30 MB"
23 | - "100 MB"
24 |
25 |
26 | - "0"
27 | - "5"
28 | - "10"
29 | - "30"
30 | - "100"
31 |
32 |
33 |
--------------------------------------------------------------------------------
/res/values-el/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
18 |
19 | - "Δεν επιτρέπονται όρια"
20 | - "5 MB"
21 | - "10 MB"
22 | - "30 MB"
23 | - "100 MB"
24 |
25 |
26 | - "0"
27 | - "5"
28 | - "10"
29 | - "30"
30 | - "100"
31 |
32 |
33 |
--------------------------------------------------------------------------------
/res/values-es-rUS/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
18 |
19 | - "Cuota no permitida"
20 | - "5 MB"
21 | - "10 MB"
22 | - "30 MB"
23 | - "100 MB"
24 |
25 |
26 | - "0"
27 | - "5"
28 | - "10"
29 | - "30"
30 | - "100"
31 |
32 |
33 |
--------------------------------------------------------------------------------
/res/values-es/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
18 |
19 | - "Ninguna cuota permitida"
20 | - "5 MB"
21 | - "10 MB"
22 | - "30 MB"
23 | - "100 MB"
24 |
25 |
26 | - "0"
27 | - "5"
28 | - "10"
29 | - "30"
30 | - "100"
31 |
32 |
33 |
--------------------------------------------------------------------------------
/res/values-fr/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
18 |
19 | - "Aucun quota autorisé"
20 | - "5 Mo"
21 | - "10 Mo"
22 | - "30 Mo"
23 | - "100 Mo"
24 |
25 |
26 | - "0"
27 | - "5"
28 | - "10"
29 | - "30"
30 | - "100"
31 |
32 |
33 |
--------------------------------------------------------------------------------
/res/values-it/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
18 |
19 | - "Nessuna quota consentita"
20 | - "5 MB"
21 | - "10 MB"
22 | - "30 MB"
23 | - "100 MB"
24 |
25 |
26 | - "0"
27 | - "5"
28 | - "10"
29 | - "30"
30 | - "100"
31 |
32 |
33 |
--------------------------------------------------------------------------------
/res/values-nl/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
18 |
19 | - "Geen maximum toegestaan"
20 | - "5 MB"
21 | - "10 MB"
22 | - "30 MB"
23 | - "100 MB"
24 |
25 |
26 | - "0"
27 | - "5"
28 | - "10"
29 | - "30"
30 | - "100"
31 |
32 |
33 |
--------------------------------------------------------------------------------
/res/values-pt/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
18 |
19 | - "Nenhuma quota permitida"
20 | - "5 MB"
21 | - "10 MB"
22 | - "30 MB"
23 | - "100 MB"
24 |
25 |
26 | - "0"
27 | - "5"
28 | - "10"
29 | - "30"
30 | - "100"
31 |
32 |
33 |
--------------------------------------------------------------------------------
/res/values-tr/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
18 |
19 | - "İzin verilen kota yok"
20 | - "5 MB"
21 | - "10 MB"
22 | - "30 MB"
23 | - "100 MB"
24 |
25 |
26 | - "0"
27 | - "5"
28 | - "10"
29 | - "30"
30 | - "100"
31 |
32 |
33 |
--------------------------------------------------------------------------------
/res/values-cs/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
18 |
19 | - "Není povolena žádná kvóta"
20 | - "5 MB"
21 | - "10 MB"
22 | - "30 MB"
23 | - "100 MB"
24 |
25 |
26 | - "0"
27 | - "5"
28 | - "10"
29 | - "30"
30 | - "100"
31 |
32 |
33 |
--------------------------------------------------------------------------------
/res/values-da/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
18 |
19 | - "Der er ingen tilladt kvote"
20 | - "5 Mb"
21 | - "10 Mb"
22 | - "30 Mb"
23 | - "100 Mb"
24 |
25 |
26 | - "0"
27 | - "5"
28 | - "10"
29 | - "30"
30 | - "100"
31 |
32 |
33 |
--------------------------------------------------------------------------------
/res/values-pl/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
18 |
19 | - "Brak dozwolonego przydziału"
20 | - "5 MB"
21 | - "10 MB"
22 | - "30 MB"
23 | - "100 MB"
24 |
25 |
26 | - "0"
27 | - "5"
28 | - "10"
29 | - "30"
30 | - "100"
31 |
32 |
33 |
--------------------------------------------------------------------------------
/res/values-pt-rPT/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
18 |
19 | - "Nenhuma quota permitida"
20 | - "5 MB"
21 | - "10 MB"
22 | - "30 MB"
23 | - "100 MB"
24 |
25 |
26 | - "0"
27 | - "5"
28 | - "10"
29 | - "30"
30 | - "100"
31 |
32 |
33 |
--------------------------------------------------------------------------------
/res/layout/custom_screen.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
24 |
27 |
28 |
32 |
33 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/res/menu/historycontext.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
33 |
--------------------------------------------------------------------------------
/src/com/android/browser/BookmarkSearch.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 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.android.browser;
18 |
19 | import android.app.Activity;
20 | import android.content.Intent;
21 | import android.os.Bundle;
22 |
23 | /**
24 | * This activity is never started from the browser. Its purpose is to provide bookmark suggestions
25 | * to global search (through its searchable meta-data), and to handle the intents produced
26 | * by clicking such suggestions.
27 | */
28 | public class BookmarkSearch extends Activity {
29 |
30 | @Override
31 | protected void onCreate(Bundle savedInstanceState) {
32 | super.onCreate(savedInstanceState);
33 | Intent intent = getIntent();
34 | if (intent != null) {
35 | String action = intent.getAction();
36 | if (Intent.ACTION_VIEW.equals(action)) {
37 | intent.setClass(this, BrowserActivity.class);
38 | startActivity(intent);
39 | }
40 | }
41 | finish();
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/res/layout/tab_view_add_tab.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
24 |
30 |
39 |
40 |
--------------------------------------------------------------------------------
/res/layout/video_loading_progress.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
23 |
24 |
29 |
30 |
36 |
--------------------------------------------------------------------------------
/res/layout/ssl_warning.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
22 |
23 |
24 |
29 |
30 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/res/layout/tab.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
27 |
28 |
29 |
33 |
34 |
35 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/tests/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
20 |
21 |
24 |
25 |
26 |
27 |
28 |
33 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/res/layout/active_tabs.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
23 |
28 |
37 |
38 |
44 |
45 |
--------------------------------------------------------------------------------
/res/layout/ssl_success.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
21 |
22 |
23 |
30 |
31 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/res/menu/bookmarkscontext.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
41 |
--------------------------------------------------------------------------------
/res/layout/ssl_warnings.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
22 |
23 |
27 |
28 |
29 |
40 |
41 |
42 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/src/com/android/browser/AddNewBookmark.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 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.android.browser;
18 |
19 | import android.content.Context;
20 | import android.view.LayoutInflater;
21 | import android.widget.ImageView;
22 | import android.widget.LinearLayout;
23 | import android.widget.TextView;
24 |
25 | /**
26 | * Custom layout for an item representing a bookmark in the browser.
27 | */
28 | // FIXME: Remove BrowserBookmarkItem
29 | class AddNewBookmark extends LinearLayout {
30 |
31 | private TextView mTextView;
32 | private TextView mUrlText;
33 | private ImageView mImageView;
34 |
35 | /**
36 | * Instantiate a bookmark item, including a default favicon.
37 | *
38 | * @param context The application context for the item.
39 | */
40 | AddNewBookmark(Context context) {
41 | super(context);
42 |
43 | setWillNotDraw(false);
44 | LayoutInflater factory = LayoutInflater.from(context);
45 | factory.inflate(R.layout.add_new_bookmark, this);
46 | mTextView = (TextView) findViewById(R.id.title);
47 | mUrlText = (TextView) findViewById(R.id.url);
48 | mImageView = (ImageView) findViewById(R.id.favicon);
49 | }
50 |
51 | /**
52 | * Set the new url for the bookmark item.
53 | * @param url The new url for the bookmark item.
54 | */
55 | /* package */ void setUrl(String url) {
56 | mUrlText.setText(url);
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/res/layout/tabitem.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
22 |
23 |
27 |
28 |
41 |
42 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/res/layout/browser_subwindow.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
21 |
25 |
30 |
35 |
36 |
37 |
43 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/src/com/android/browser/Browser.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2006 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.android.browser;
18 |
19 | import android.util.Log;
20 |
21 | import android.app.Application;
22 | import android.content.Intent;
23 | import android.webkit.CookieManager;
24 | import android.webkit.CookieSyncManager;
25 |
26 | import dalvik.system.VMRuntime;
27 |
28 | public class Browser extends Application {
29 |
30 | private final static String LOGTAG = "browser";
31 |
32 | // Set to true to enable extra debugging.
33 | final static boolean DEBUG = false;
34 |
35 | // Set to true to enable verbose logging.
36 | final static boolean LOGV_ENABLED = DEBUG;
37 |
38 | // Set to true to enable extra debug logging.
39 | final static boolean LOGD_ENABLED = true;
40 |
41 | /**
42 | * Specifies a heap utilization ratio that works better
43 | * for the browser than the default ratio does.
44 | */
45 | private final static float TARGET_HEAP_UTILIZATION = 0.75f;
46 |
47 | public Browser() {
48 | }
49 |
50 | public void onCreate() {
51 | if (LOGV_ENABLED)
52 | Log.v(LOGTAG, "Browser.onCreate: this=" + this);
53 | // Fix heap utilization for better heap size characteristics.
54 | VMRuntime.getRuntime().setTargetHeapUtilization(
55 | TARGET_HEAP_UTILIZATION);
56 | // create CookieSyncManager with current Context
57 | CookieSyncManager.createInstance(this);
58 | // remove all expired cookies
59 | CookieManager.getInstance().removeExpiredCookie();
60 | }
61 |
62 | static Intent createBrowserViewIntent() {
63 | Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
64 | return intent;
65 | }
66 | }
67 |
68 |
--------------------------------------------------------------------------------
/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
20 |
21 |
28 |
29 |
33 |
34 |
44 |
45 |
49 |
50 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/src/com/android/browser/BrowserHomepagePreference.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 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.android.browser;
18 |
19 | import android.app.AlertDialog;
20 | import android.content.Context;
21 | import android.preference.EditTextPreference;
22 | import android.util.AttributeSet;
23 |
24 | public class BrowserHomepagePreference extends EditTextPreference {
25 |
26 | public BrowserHomepagePreference(Context context, AttributeSet attrs,
27 | int defStyle) {
28 | super(context, attrs, defStyle);
29 | }
30 |
31 | public BrowserHomepagePreference(Context context, AttributeSet attrs) {
32 | super(context, attrs);
33 | }
34 |
35 | public BrowserHomepagePreference(Context context) {
36 | super(context);
37 | }
38 |
39 | @Override
40 | protected void onDialogClosed(boolean positiveResult) {
41 | if (positiveResult) {
42 | String url = getEditText().getText().toString();
43 | if (url.length() > 0
44 | && !BrowserActivity.ACCEPTED_URI_SCHEMA.matcher(url)
45 | .matches()) {
46 | int colon = url.indexOf(':');
47 | int space = url.indexOf(' ');
48 | if (colon == -1 && space == -1) {
49 | // if no colon, no space, add "http://" to make it a url
50 | getEditText().setText("http://" + url);
51 | } else {
52 | // show an error dialog and change the positiveResult to
53 | // false so that the bad url will not override the old url
54 | new AlertDialog.Builder(this.getContext()).setMessage(
55 | R.string.bookmark_url_not_valid).setPositiveButton(
56 | R.string.ok, null).show();
57 | positiveResult = false;
58 | }
59 | }
60 | }
61 | super.onDialogClosed(positiveResult);
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/res/layout/add_new_bookmark.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
28 |
37 |
42 |
50 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/src/com/android/browser/BrowserYesNoPreference.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 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.android.browser;
18 |
19 | import com.android.internal.preference.YesNoPreference;
20 |
21 | import android.content.Context;
22 | import android.util.AttributeSet;
23 |
24 | class BrowserYesNoPreference extends YesNoPreference {
25 |
26 | // This is the constructor called by the inflater
27 | public BrowserYesNoPreference(Context context, AttributeSet attrs) {
28 | super(context, attrs);
29 | }
30 |
31 | @Override
32 | protected void onDialogClosed(boolean positiveResult) {
33 | super.onDialogClosed(positiveResult);
34 |
35 | if (positiveResult) {
36 | setEnabled(false);
37 |
38 | Context context = getContext();
39 | if (BrowserSettings.PREF_CLEAR_CACHE.equals(getKey())) {
40 | BrowserSettings.getInstance().clearCache(context);
41 | BrowserSettings.getInstance().clearDatabases(context);
42 | } else if (BrowserSettings.PREF_CLEAR_COOKIES.equals(getKey())) {
43 | BrowserSettings.getInstance().clearCookies(context);
44 | } else if (BrowserSettings.PREF_CLEAR_HISTORY.equals(getKey())) {
45 | BrowserSettings.getInstance().clearHistory(context);
46 | } else if (BrowserSettings.PREF_CLEAR_FORM_DATA.equals(getKey())) {
47 | BrowserSettings.getInstance().clearFormData(context);
48 | } else if (BrowserSettings.PREF_CLEAR_PASSWORDS.equals(getKey())) {
49 | BrowserSettings.getInstance().clearPasswords(context);
50 | } else if (BrowserSettings.PREF_EXTRAS_RESET_DEFAULTS.equals(
51 | getKey())) {
52 | BrowserSettings.getInstance().resetDefaultPreferences(context);
53 | setEnabled(true);
54 | } else if (BrowserSettings.PREF_CLEAR_GEOLOCATION_ACCESS.equals(
55 | getKey())) {
56 | BrowserSettings.getInstance().clearLocationAccess(context);
57 | }
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/com/android/browser/Dots.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 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.android.browser;
18 |
19 | import android.content.Context;
20 | import android.util.AttributeSet;
21 | import android.view.Gravity;
22 | import android.widget.ImageView;
23 | import android.widget.LinearLayout;
24 |
25 | import java.util.Map;
26 |
27 | /**
28 | * Displays a series of dots. The selected one is highlighted.
29 | * No animations yet. Nothing fancy.
30 | */
31 | class Dots extends LinearLayout {
32 |
33 | private static final int MAX_DOTS = 8;
34 | private int mSelected = -1;
35 |
36 | public Dots(Context context) {
37 | this(context, null);
38 | }
39 |
40 | public Dots(Context context, AttributeSet attrs) {
41 | super(context, attrs);
42 |
43 | setGravity(Gravity.CENTER);
44 | setPadding(0, 4, 0, 4);
45 |
46 | LayoutParams lp =
47 | new LayoutParams(LayoutParams.WRAP_CONTENT,
48 | LayoutParams.WRAP_CONTENT);
49 |
50 | for (int i = 0; i < MAX_DOTS; i++) {
51 | ImageView dotView = new ImageView(mContext);
52 | dotView.setImageResource(R.drawable.page_indicator_unselected2);
53 | addView(dotView, lp);
54 | }
55 | }
56 |
57 | /**
58 | * @param dotCount if less than 1 or greater than MAX_DOTS, Dots
59 | * disappears
60 | */
61 | public void setDotCount(int dotCount) {
62 | if (dotCount > 1 && dotCount <= MAX_DOTS) {
63 | setVisibility(VISIBLE);
64 | for (int i = 0; i < MAX_DOTS; i++) {
65 | getChildAt(i).setVisibility(i < dotCount? VISIBLE : GONE);
66 | }
67 | } else {
68 | setVisibility(GONE);
69 | }
70 | }
71 |
72 | public void setSelected(int index) {
73 | if (index < 0 || index >= MAX_DOTS) return;
74 |
75 | if (mSelected >= 0) {
76 | // Unselect old
77 | ((ImageView)getChildAt(mSelected)).setImageResource(
78 | R.drawable.page_indicator_unselected2);
79 | }
80 | ((ImageView)getChildAt(index)).setImageResource(R.drawable.page_indicator);
81 | mSelected = index;
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/res/layout/error_console.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
17 |
18 |
24 |
25 |
35 |
36 |
44 |
45 |
50 |
51 |
60 |
61 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/res/layout/http_authentication.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
22 |
23 |
34 |
35 |
46 |
47 |
57 |
58 |
69 |
70 |
--------------------------------------------------------------------------------
/res/layout-land/page_info.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
22 |
23 |
27 |
28 |
29 |
40 |
41 |
42 |
47 |
48 |
49 |
57 |
58 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/res/layout/history_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
28 |
37 |
42 |
50 |
58 |
59 |
65 |
66 |
--------------------------------------------------------------------------------
/res/menu/browsercontext.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
59 |
60 |
--------------------------------------------------------------------------------
/res/layout/website_settings_row.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
23 |
24 |
31 |
32 |
41 |
42 |
46 |
47 |
51 |
52 |
53 |
54 |
64 |
65 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/res/layout/page_info.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
22 |
23 |
27 |
28 |
29 |
40 |
41 |
42 |
46 |
47 |
58 |
59 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/src/com/android/browser/HistoryItem.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 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 |
18 | package com.android.browser;
19 |
20 | import android.content.Context;
21 | import android.graphics.Bitmap;
22 | import android.provider.Browser;
23 | import android.view.View;
24 | import android.widget.CompoundButton;
25 | import android.widget.ImageView;
26 | import android.widget.TextView;
27 |
28 | /**
29 | * Layout representing a history item in the classic history viewer.
30 | */
31 | /* package */ class HistoryItem extends BookmarkItem {
32 |
33 | private CompoundButton mStar; // Star for bookmarking
34 | private CompoundButton.OnCheckedChangeListener mListener;
35 | /**
36 | * Create a new HistoryItem.
37 | * @param context Context for this HistoryItem.
38 | */
39 | /* package */ HistoryItem(Context context) {
40 | super(context);
41 |
42 | mStar = (CompoundButton) findViewById(R.id.star);
43 | mStar.setVisibility(View.VISIBLE);
44 | mListener = new CompoundButton.OnCheckedChangeListener() {
45 | public void onCheckedChanged(CompoundButton buttonView,
46 | boolean isChecked) {
47 | if (isChecked) {
48 | Bookmarks.addBookmark(mContext,
49 | mContext.getContentResolver(), mUrl, getName(), null, true);
50 | } else {
51 | Bookmarks.removeFromBookmarks(mContext,
52 | mContext.getContentResolver(), mUrl, getName());
53 | }
54 | }
55 | };
56 | }
57 |
58 | /* package */ void copyTo(HistoryItem item) {
59 | item.mTextView.setText(mTextView.getText());
60 | item.mUrlText.setText(mUrlText.getText());
61 | item.setIsBookmark(mStar.isChecked());
62 | item.mImageView.setImageDrawable(mImageView.getDrawable());
63 | }
64 |
65 | /**
66 | * Whether or not this item represents a bookmarked site
67 | */
68 | /* package */ boolean isBookmark() {
69 | return mStar.isChecked();
70 | }
71 |
72 | /**
73 | * Set whether or not this represents a bookmark, and make sure the star
74 | * behaves appropriately.
75 | */
76 | /* package */ void setIsBookmark(boolean isBookmark) {
77 | mStar.setOnCheckedChangeListener(null);
78 | mStar.setChecked(isBookmark);
79 | mStar.setOnCheckedChangeListener(mListener);
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/res/xml/debug_preferences.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
19 |
22 |
23 |
25 |
29 |
30 |
34 |
35 |
39 |
40 |
44 |
45 |
49 |
50 |
54 |
55 |
59 |
60 |
64 |
65 |
71 |
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/res/layout/browser_find.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
26 |
32 |
33 |
39 |
40 |
47 |
54 |
61 |
68 |
69 |
70 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/res/layout-land/http_authentication.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
22 |
23 |
28 |
29 |
30 |
36 |
37 |
48 |
49 |
50 |
51 |
57 |
58 |
70 |
71 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/res/layout/tab_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
24 |
26 |
33 |
39 |
47 |
55 |
56 |
64 |
73 |
74 |
--------------------------------------------------------------------------------
/res/layout/bookmark_thumbnail.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
23 |
24 |
31 |
32 |
33 |
34 |
35 |
44 |
49 |
57 |
58 |
59 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/res/layout/title_bar.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
27 |
28 |
34 |
35 |
40 |
41 |
49 |
54 |
60 |
73 |
74 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/res/layout/browser_download_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
25 |
26 |
33 |
34 |
42 |
50 |
51 |
60 |
61 |
70 |
71 |
80 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/src/com/android/browser/BookmarkItem.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 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.android.browser;
18 |
19 | import android.content.Context;
20 | import android.graphics.Bitmap;
21 | import android.view.LayoutInflater;
22 | import android.view.View;
23 | import android.widget.ImageView;
24 | import android.widget.LinearLayout;
25 | import android.widget.TextView;
26 |
27 | /**
28 | * Custom layout for an item representing a bookmark in the browser.
29 | */
30 | class BookmarkItem extends LinearLayout {
31 |
32 | protected TextView mTextView;
33 | protected TextView mUrlText;
34 | protected ImageView mImageView;
35 | protected String mUrl;
36 |
37 | /**
38 | * Instantiate a bookmark item, including a default favicon.
39 | *
40 | * @param context The application context for the item.
41 | */
42 | BookmarkItem(Context context) {
43 | super(context);
44 |
45 | LayoutInflater factory = LayoutInflater.from(context);
46 | factory.inflate(R.layout.history_item, this);
47 | mTextView = (TextView) findViewById(R.id.title);
48 | mUrlText = (TextView) findViewById(R.id.url);
49 | mImageView = (ImageView) findViewById(R.id.favicon);
50 | View star = findViewById(R.id.star);
51 | star.setVisibility(View.GONE);
52 | }
53 |
54 | /**
55 | * Copy this BookmarkItem to item.
56 | * @param item BookmarkItem to receive the info from this BookmarkItem.
57 | */
58 | /* package */ void copyTo(BookmarkItem item) {
59 | item.mTextView.setText(mTextView.getText());
60 | item.mUrlText.setText(mUrlText.getText());
61 | item.mImageView.setImageDrawable(mImageView.getDrawable());
62 | }
63 |
64 | /**
65 | * Return the name assigned to this bookmark item.
66 | */
67 | /* package */ String getName() {
68 | return mTextView.getText().toString();
69 | }
70 |
71 | /**
72 | * Return the TextView which holds the name of this bookmark item.
73 | */
74 | /* package */ TextView getNameTextView() {
75 | return mTextView;
76 | }
77 |
78 | /* package */ String getUrl() {
79 | return mUrl;
80 | }
81 |
82 | /**
83 | * Set the favicon for this item.
84 | *
85 | * @param b The new bitmap for this item.
86 | * If it is null, will use the default.
87 | */
88 | /* package */ void setFavicon(Bitmap b) {
89 | if (b != null) {
90 | mImageView.setImageBitmap(b);
91 | } else {
92 | mImageView.setImageResource(R.drawable.app_web_browser_sm);
93 | }
94 | }
95 |
96 | /**
97 | * Set the new name for the bookmark item.
98 | *
99 | * @param name The new name for the bookmark item.
100 | */
101 | /* package */ void setName(String name) {
102 | mTextView.setText(name);
103 | }
104 |
105 | /**
106 | * Set the new url for the bookmark item.
107 | * @param url The new url for the bookmark item.
108 | */
109 | /* package */ void setUrl(String url) {
110 | mUrlText.setText(url);
111 | mUrl = url;
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/res/layout/geolocation_permissions_prompt.xml:
--------------------------------------------------------------------------------
1 |
2 |
18 |
19 |
23 |
24 |
25 |
32 |
33 |
34 |
39 |
40 |
41 |
47 |
48 |
49 |
54 |
55 |
56 |
60 |
63 |
70 |
71 |
72 |
73 |
76 |
81 |
86 |
87 |
88 |
89 |
90 |
91 |
--------------------------------------------------------------------------------
/res/layout/browser_add_bookmark.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
22 |
23 |
31 |
32 |
41 |
42 |
49 |
50 |
58 |
59 |
60 |
61 |
68 |
69 |
78 |
79 |
80 |
89 |
96 |
103 |
104 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/src/com/android/browser/GeolocationPermissionsPrompt.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 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.android.browser;
18 |
19 | import android.content.Context;
20 | import android.graphics.drawable.Drawable;
21 | import android.net.Uri;
22 | import android.util.AttributeSet;
23 | import android.view.LayoutInflater;
24 | import android.view.View;
25 | import android.webkit.WebView;
26 | import android.webkit.GeolocationPermissions;
27 | import android.widget.Button;
28 | import android.widget.CheckBox;
29 | import android.widget.LinearLayout;
30 | import android.widget.TextView;
31 |
32 | public class GeolocationPermissionsPrompt extends LinearLayout {
33 | private LinearLayout mInner;
34 | private TextView mMessage;
35 | private Button mShareButton;
36 | private Button mDontShareButton;
37 | private CheckBox mRemember;
38 | private GeolocationPermissions.Callback mCallback;
39 | private String mOrigin;
40 |
41 | public GeolocationPermissionsPrompt(Context context) {
42 | this(context, null);
43 | }
44 |
45 | public GeolocationPermissionsPrompt(Context context, AttributeSet attrs) {
46 | super(context, attrs);
47 | LayoutInflater factory = LayoutInflater.from(context);
48 | factory.inflate(R.layout.geolocation_permissions_prompt, this);
49 |
50 | mInner = (LinearLayout) findViewById(R.id.inner);
51 | mMessage = (TextView) findViewById(R.id.message);
52 | mShareButton = (Button) findViewById(R.id.share_button);
53 | mDontShareButton = (Button) findViewById(R.id.dont_share_button);
54 | mRemember = (CheckBox) findViewById(R.id.remember);
55 | setButtonClickListeners();
56 | }
57 |
58 | /**
59 | * Shows the prompt for the given origin. When the user clicks on one of
60 | * the buttons, the supplied callback is be called.
61 | */
62 | public void show(String origin, GeolocationPermissions.Callback callback) {
63 | mOrigin = origin;
64 | mCallback = callback;
65 | Uri uri = Uri.parse(mOrigin);
66 | setMessage("http".equals(uri.getScheme()) ? mOrigin.substring(7) : mOrigin);
67 | // The checkbox should always be intially checked.
68 | mRemember.setChecked(true);
69 | showDialog(true);
70 | }
71 |
72 | /**
73 | * Hides the prompt.
74 | */
75 | public void hide() {
76 | showDialog(false);
77 | }
78 |
79 | /**
80 | * Sets the on click listeners for the buttons.
81 | */
82 | private void setButtonClickListeners() {
83 | final GeolocationPermissionsPrompt me = this;
84 | mShareButton.setOnClickListener(new View.OnClickListener() {
85 | public void onClick(View v) {
86 | me.handleButtonClick(true);
87 | }
88 | });
89 | mDontShareButton.setOnClickListener(new View.OnClickListener() {
90 | public void onClick(View v) {
91 | me.handleButtonClick(false);
92 | }
93 | });
94 | }
95 |
96 | /**
97 | * Handles a click on one the buttons by invoking the callback.
98 | */
99 | private void handleButtonClick(boolean allow) {
100 | boolean remember = mRemember.isChecked();
101 | showDialog(false);
102 | mCallback.invoke(mOrigin, allow, remember);
103 | }
104 |
105 | /**
106 | * Sets the prompt's message.
107 | */
108 | private void setMessage(CharSequence origin) {
109 | mMessage.setText(String.format(
110 | getResources().getString(R.string.geolocation_permissions_prompt_message),
111 | origin));
112 | }
113 |
114 | /**
115 | * Shows or hides the prompt.
116 | */
117 | private void showDialog(boolean shown) {
118 | mInner.setVisibility(shown ? View.VISIBLE : View.GONE);
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/src/com/android/browser/DownloadTouchIcon.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 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.android.browser;
18 |
19 | import android.content.ContentResolver;
20 | import android.content.ContentUris;
21 | import android.content.ContentValues;
22 | import android.database.Cursor;
23 | import android.graphics.Bitmap;
24 | import android.graphics.BitmapFactory;
25 | import android.net.http.AndroidHttpClient;
26 | import android.os.AsyncTask;
27 | import android.provider.Browser;
28 | import android.webkit.WebView;
29 |
30 | import org.apache.http.HttpEntity;
31 | import org.apache.http.HttpResponse;
32 | import org.apache.http.client.methods.HttpGet;
33 | import org.apache.http.client.params.HttpClientParams;
34 |
35 | import java.io.ByteArrayOutputStream;
36 | import java.io.IOException;
37 | import java.io.InputStream;
38 |
39 | class DownloadTouchIcon extends AsyncTask {
40 | private final ContentResolver mContentResolver;
41 | private final Cursor mCursor;
42 | private final String mOriginalUrl;
43 | private final String mUrl;
44 | private final String mUserAgent;
45 | /* package */ BrowserActivity mActivity;
46 |
47 | public DownloadTouchIcon(BrowserActivity activity, ContentResolver cr,
48 | Cursor c, WebView view) {
49 | mActivity = activity;
50 | mContentResolver = cr;
51 | mCursor = c;
52 | // Store these in case they change.
53 | mOriginalUrl = view.getOriginalUrl();
54 | mUrl = view.getUrl();
55 | mUserAgent = view.getSettings().getUserAgentString();
56 | }
57 |
58 | public DownloadTouchIcon(ContentResolver cr, Cursor c, String url) {
59 | mActivity = null;
60 | mContentResolver = cr;
61 | mCursor = c;
62 | mOriginalUrl = null;
63 | mUrl = url;
64 | mUserAgent = null;
65 | }
66 |
67 | @Override
68 | public Bitmap doInBackground(String... values) {
69 | String url = values[0];
70 |
71 | AndroidHttpClient client = AndroidHttpClient.newInstance(
72 | mUserAgent);
73 | HttpGet request = new HttpGet(url);
74 |
75 | // Follow redirects
76 | HttpClientParams.setRedirecting(client.getParams(), true);
77 |
78 | try {
79 | HttpResponse response = client.execute(request);
80 |
81 | if (response.getStatusLine().getStatusCode() == 200) {
82 | HttpEntity entity = response.getEntity();
83 | if (entity != null) {
84 | InputStream content = entity.getContent();
85 | if (content != null) {
86 | Bitmap icon = BitmapFactory.decodeStream(
87 | content, null, null);
88 | return icon;
89 | }
90 | }
91 | }
92 | } catch (IllegalArgumentException ex) {
93 | request.abort();
94 | } catch (IOException ex) {
95 | request.abort();
96 | } finally {
97 | client.close();
98 | }
99 | return null;
100 | }
101 |
102 | @Override
103 | protected void onCancelled() {
104 | if (mCursor != null) {
105 | mCursor.close();
106 | }
107 | }
108 |
109 | @Override
110 | public void onPostExecute(Bitmap icon) {
111 | // Do this first in case the download failed.
112 | if (mActivity != null) {
113 | // Remove the touch icon loader from the BrowserActivity.
114 | mActivity.mTouchIconLoader = null;
115 | }
116 |
117 | if (icon == null || mCursor == null || isCancelled()) {
118 | return;
119 | }
120 |
121 | final ByteArrayOutputStream os = new ByteArrayOutputStream();
122 | icon.compress(Bitmap.CompressFormat.PNG, 100, os);
123 | ContentValues values = new ContentValues();
124 | values.put(Browser.BookmarkColumns.TOUCH_ICON,
125 | os.toByteArray());
126 |
127 | if (mCursor.moveToFirst()) {
128 | do {
129 | mContentResolver.update(ContentUris.withAppendedId(
130 | Browser.BOOKMARKS_URI, mCursor.getInt(0)),
131 | values, null, null);
132 | } while (mCursor.moveToNext());
133 | }
134 | mCursor.close();
135 | }
136 | }
137 |
--------------------------------------------------------------------------------
/src/com/android/browser/FetchUrlMimeType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 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.android.browser;
18 |
19 | import android.content.ContentValues;
20 | import android.net.Uri;
21 | import android.net.http.AndroidHttpClient;
22 |
23 | import org.apache.http.HttpResponse;
24 | import org.apache.http.Header;
25 | import org.apache.http.client.methods.HttpHead;
26 |
27 | import java.io.IOException;
28 |
29 | import android.os.AsyncTask;
30 | import android.provider.Downloads;
31 | import android.webkit.MimeTypeMap;
32 | import android.webkit.URLUtil;
33 |
34 | /**
35 | * This class is used to pull down the http headers of a given URL so that
36 | * we can analyse the mimetype and make any correction needed before we give
37 | * the URL to the download manager. The ContentValues class holds the
38 | * content that would be provided to the download manager, so that on
39 | * completion of checking the mimetype, we can issue the download to
40 | * the download manager.
41 | * This operation is needed when the user long-clicks on a link or image and
42 | * we don't know the mimetype. If the user just clicks on the link, we will
43 | * do the same steps of correcting the mimetype down in
44 | * android.os.webkit.LoadListener rather than handling it here.
45 | *
46 | */
47 | class FetchUrlMimeType extends AsyncTask {
48 |
49 | BrowserActivity mActivity;
50 | ContentValues mValues;
51 |
52 | public FetchUrlMimeType(BrowserActivity activity) {
53 | mActivity = activity;
54 | }
55 |
56 | @Override
57 | public String doInBackground(ContentValues... values) {
58 | mValues = values[0];
59 |
60 | // Check to make sure we have a URI to download
61 | String uri = mValues.getAsString(Downloads.COLUMN_URI);
62 | if (uri == null || uri.length() == 0) {
63 | return null;
64 | }
65 |
66 | // User agent is likely to be null, though the AndroidHttpClient
67 | // seems ok with that.
68 | AndroidHttpClient client = AndroidHttpClient.newInstance(
69 | mValues.getAsString(Downloads.COLUMN_USER_AGENT));
70 | HttpHead request = new HttpHead(uri);
71 |
72 | String cookie = mValues.getAsString(Downloads.COLUMN_COOKIE_DATA);
73 | if (cookie != null && cookie.length() > 0) {
74 | request.addHeader("Cookie", cookie);
75 | }
76 |
77 | String referer = mValues.getAsString(Downloads.COLUMN_REFERER);
78 | if (referer != null && referer.length() > 0) {
79 | request.addHeader("Referer", referer);
80 | }
81 |
82 | HttpResponse response;
83 | String mimeType = null;
84 | try {
85 | response = client.execute(request);
86 | // We could get a redirect here, but if we do lets let
87 | // the download manager take care of it, and thus trust that
88 | // the server sends the right mimetype
89 | if (response.getStatusLine().getStatusCode() == 200) {
90 | Header header = response.getFirstHeader("Content-Type");
91 | if (header != null) {
92 | mimeType = header.getValue();
93 | final int semicolonIndex = mimeType.indexOf(';');
94 | if (semicolonIndex != -1) {
95 | mimeType = mimeType.substring(0, semicolonIndex);
96 | }
97 | }
98 | }
99 | } catch (IllegalArgumentException ex) {
100 | request.abort();
101 | } catch (IOException ex) {
102 | request.abort();
103 | } finally {
104 | client.close();
105 | }
106 |
107 | return mimeType;
108 | }
109 |
110 | @Override
111 | public void onPostExecute(String mimeType) {
112 | if (mimeType != null) {
113 | String url = mValues.getAsString(Downloads.COLUMN_URI);
114 | if (mimeType.equalsIgnoreCase("text/plain") ||
115 | mimeType.equalsIgnoreCase("application/octet-stream")) {
116 | String newMimeType =
117 | MimeTypeMap.getSingleton().getMimeTypeFromExtension(
118 | MimeTypeMap.getFileExtensionFromUrl(url));
119 | if (newMimeType != null) {
120 | mValues.put(Downloads.COLUMN_MIME_TYPE, newMimeType);
121 | }
122 | }
123 | String filename = URLUtil.guessFileName(url,
124 | null, mimeType);
125 | mValues.put(Downloads.COLUMN_FILE_NAME_HINT, filename);
126 | }
127 |
128 | // Start the download
129 | final Uri contentUri =
130 | mActivity.getContentResolver().insert(Downloads.CONTENT_URI, mValues);
131 | mActivity.viewDownloads(contentUri);
132 | }
133 |
134 | }
135 |
--------------------------------------------------------------------------------
/res/layout/permission_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
26 |
27 |
32 |
33 |
39 |
40 |
50 |
51 |
52 |
53 |
57 |
58 |
66 |
67 |
68 |
69 |
74 |
75 |
82 |
83 |
92 |
93 |
102 |
103 |
104 |
105 |
106 |
107 |
114 |
115 |
121 |
122 |
130 |
131 |
139 |
140 |
148 |
149 |
155 |
156 |
157 |
158 |
159 |
--------------------------------------------------------------------------------
/res/menu/browser.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
113 |
114 |
--------------------------------------------------------------------------------