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

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..756e3d3465d7c1cf4cb92fb151a117be488a7cc4 100644
--- a/chrome/browser/chromeos/note_taking_helper.cc
+++ b/chrome/browser/chromeos/note_taking_helper.cc
@@ -153,6 +153,41 @@ NoteTakingAppInfos NoteTakingHelper::GetAvailableApps(Profile* profile) {
return infos;
}
+std::unique_ptr<NoteTakingAppInfo> NoteTakingHelper::GetPreferredChromeAppInfo(
+ Profile* profile) {
+ std::string preferred_app_id =
xiyuan 2017/05/26 22:44:52 nit: const std::string
tbarzic 2017/05/27 00:48:35 Done.
+ profile->GetPrefs()->GetString(prefs::kNoteTakingAppId);
+ if (LooksLikeAndroidPackageName(preferred_app_id))
+ return nullptr;
+ const extensions::Extension* preferred_app =
xiyuan 2017/05/26 22:44:52 nit: insert an empty line before
tbarzic 2017/05/27 00:48:36 Done.
+ extensions::ExtensionRegistry::Get(profile)->GetExtensionById(
+ preferred_app_id, extensions::ExtensionRegistry::ENABLED);
+ if (!preferred_app)
+ return nullptr;
+ if (!IsWhitelistedChromeApp(preferred_app) &&
xiyuan 2017/05/26 22:44:52 nit: insert an empty line before
tbarzic 2017/05/27 00:48:35 Done.
+ !extensions::ActionHandlersInfo::HasActionHandler(
+ preferred_app, app_runtime::ACTION_TYPE_NEW_NOTE)) {
+ return nullptr;
+ }
+ NoteTakingLockScreenSupport lock_screen_support =
xiyuan 2017/05/26 22:44:52 nit: insert an empty line before
tbarzic 2017/05/27 00:48:35 Done.
+ 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 =
xiyuan 2017/05/26 22:44:53 nit: insert an empty line before
tbarzic 2017/05/27 00:48:36 Done.
+ 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