| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.appmenu; | 5 package org.chromium.chrome.browser.appmenu; |
| 6 | 6 |
| 7 import android.graphics.PorterDuff; | 7 import android.graphics.PorterDuff; |
| 8 import android.graphics.drawable.Drawable; | 8 import android.graphics.drawable.Drawable; |
| 9 import android.view.Menu; | 9 import android.view.Menu; |
| 10 import android.view.MenuItem; | 10 import android.view.MenuItem; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // * chrome:// pages - Android doesn't know how to direct those URLs
. | 156 // * chrome:// pages - Android doesn't know how to direct those URLs
. |
| 157 // * incognito pages - To avoid problems where users create shortcut
s in incognito | 157 // * incognito pages - To avoid problems where users create shortcut
s in incognito |
| 158 // mode and then open the webapp in regular mod
e. | 158 // mode and then open the webapp in regular mod
e. |
| 159 // * file:// - After API 24, file: URIs are not supported in VIEW in
tents and thus | 159 // * file:// - After API 24, file: URIs are not supported in VIEW in
tents and thus |
| 160 // can not be added to the homescreen. | 160 // can not be added to the homescreen. |
| 161 // * content:// - Accessing external content URIs requires the calli
ng app to grant | 161 // * content:// - Accessing external content URIs requires the calli
ng app to grant |
| 162 // access to the resource via FLAG_GRANT_READ_URI_PER
MISSION, and that | 162 // access to the resource via FLAG_GRANT_READ_URI_PER
MISSION, and that |
| 163 // is not persisted when adding to the homescreen. | 163 // is not persisted when adding to the homescreen. |
| 164 // * If creating shortcuts it not supported by the current home scre
en. | 164 // * If creating shortcuts it not supported by the current home scre
en. |
| 165 MenuItem homescreenItem = menu.findItem(R.id.add_to_homescreen_id); | 165 MenuItem homescreenItem = menu.findItem(R.id.add_to_homescreen_id); |
| 166 boolean homescreenItemVisible = ShortcutHelper.isAddToHomeIntentSupp
orted(mActivity) | 166 boolean homescreenItemVisible = ShortcutHelper.isAddToHomeIntentSupp
orted() |
| 167 && !isChromeScheme && !isFileScheme && !isContentScheme && !
isIncognito; | 167 && !isChromeScheme && !isFileScheme && !isContentScheme && !
isIncognito; |
| 168 if (homescreenItemVisible) { | 168 if (homescreenItemVisible) { |
| 169 homescreenItem.setTitle(AppBannerManager.getHomescreenLanguageOp
tion()); | 169 homescreenItem.setTitle(AppBannerManager.getHomescreenLanguageOp
tion()); |
| 170 } | 170 } |
| 171 homescreenItem.setVisible(homescreenItemVisible); | 171 homescreenItem.setVisible(homescreenItemVisible); |
| 172 | 172 |
| 173 // Hide request desktop site on all chrome:// pages except for the N
TP. Check request | 173 // Hide request desktop site on all chrome:// pages except for the N
TP. Check request |
| 174 // desktop site if it's activated on this page. | 174 // desktop site if it's activated on this page. |
| 175 MenuItem requestItem = menu.findItem(R.id.request_desktop_site_id); | 175 MenuItem requestItem = menu.findItem(R.id.request_desktop_site_id); |
| 176 updateRequestDesktopSiteMenuItem(requestItem, currentTab); | 176 updateRequestDesktopSiteMenuItem(requestItem, currentTab); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 String url = currentTab.getUrl(); | 301 String url = currentTab.getUrl(); |
| 302 boolean isChromeScheme = url.startsWith(UrlConstants.CHROME_URL_PREFIX) | 302 boolean isChromeScheme = url.startsWith(UrlConstants.CHROME_URL_PREFIX) |
| 303 || url.startsWith(UrlConstants.CHROME_NATIVE_URL_PREFIX); | 303 || url.startsWith(UrlConstants.CHROME_NATIVE_URL_PREFIX); |
| 304 requstMenuItem.setVisible(!isChromeScheme || currentTab.isNativePage()); | 304 requstMenuItem.setVisible(!isChromeScheme || currentTab.isNativePage()); |
| 305 requstMenuItem.setChecked(currentTab.getUseDesktopUserAgent()); | 305 requstMenuItem.setChecked(currentTab.getUseDesktopUserAgent()); |
| 306 requstMenuItem.setTitleCondensed(requstMenuItem.isChecked() | 306 requstMenuItem.setTitleCondensed(requstMenuItem.isChecked() |
| 307 ? mActivity.getString(R.string.menu_request_desktop_site_on) | 307 ? mActivity.getString(R.string.menu_request_desktop_site_on) |
| 308 : mActivity.getString(R.string.menu_request_desktop_site_off)); | 308 : mActivity.getString(R.string.menu_request_desktop_site_off)); |
| 309 } | 309 } |
| 310 } | 310 } |
| OLD | NEW |