Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(668)

Unified Diff: chrome/browser/chromeos/note_taking_helper.cc

Issue 2902293002: Introduce lock screen app manager (Closed)
Patch Set: . Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/note_taking_helper.cc
diff --git a/chrome/browser/chromeos/note_taking_helper.cc b/chrome/browser/chromeos/note_taking_helper.cc
index 586029ea4403cf9f190ac27157d456c91f799a5e..913f4b5f03a0e3554175dc21e6f194e73eb3de3b 100644
--- a/chrome/browser/chromeos/note_taking_helper.cc
+++ b/chrome/browser/chromeos/note_taking_helper.cc
@@ -153,6 +153,43 @@ NoteTakingAppInfos NoteTakingHelper::GetAvailableApps(Profile* profile) {
return infos;
}
+std::unique_ptr<NoteTakingAppInfo> NoteTakingHelper::GetPreferredChromeAppInfo(
+ Profile* profile) {
+ if (!ash::palette_utils::HasStylusInput())
jdufault 2017/05/26 19:15:53 Why do we disable preferred app if there is no sty
tbarzic 2017/05/26 19:34:14 Yeah, I guess we don;t have to.
+ return nullptr;
+ std::string preferred_app_id =
+ profile->GetPrefs()->GetString(prefs::kNoteTakingAppId);
+ if (LooksLikeAndroidPackageName(preferred_app_id))
jdufault 2017/05/26 19:15:53 Add a comment, // Lock screen does not currently
tbarzic 2017/05/26 19:34:14 Added a comment, but at the place where this metho
+ return nullptr;
+ const extensions::Extension* preferred_app =
+ extensions::ExtensionRegistry::Get(profile)->GetExtensionById(
+ preferred_app_id, extensions::ExtensionRegistry::ENABLED);
+ if (!preferred_app)
+ return nullptr;
+ if (!IsWhitelistedChromeApp(preferred_app) &&
+ !extensions::ActionHandlersInfo::HasActionHandler(
+ preferred_app, app_runtime::ACTION_TYPE_NEW_NOTE)) {
+ return nullptr;
+ }
+ NoteTakingLockScreenSupport lock_screen_support =
+ NoteTakingLockScreenSupport::kNotSupported;
+ if (IsLockScreenEnabled(preferred_app)) {
+ if (profile->GetPrefs()->GetBoolean(
+ prefs::kNoteTakingAppEnabledOnLockScreen)) {
+ lock_screen_support = NoteTakingLockScreenSupport::kSelected;
+ } else {
+ lock_screen_support = NoteTakingLockScreenSupport::kSupported;
+ }
+ }
+ std::unique_ptr<NoteTakingAppInfo> info =
+ base::MakeUnique<NoteTakingAppInfo>();
+ info->name = preferred_app->name();
+ info->app_id = preferred_app->id();
+ info->preferred = true;
+ info->lock_screen_support = lock_screen_support;
+ return info;
+}
+
void NoteTakingHelper::SetPreferredApp(Profile* profile,
const std::string& app_id) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);

Powered by Google App Engine
This is Rietveld 408576698