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

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

Issue 2526893003: chromeos: Add NoteTakingHelper class. (Closed)
Patch Set: drop is-note-taking-app-window stuff Created 4 years 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_app_utils.cc b/chrome/browser/chromeos/note_taking_helper.cc
similarity index 79%
rename from chrome/browser/chromeos/note_taking_app_utils.cc
rename to chrome/browser/chromeos/note_taking_helper.cc
index 7f12a8da4081447fc6d397c1fde54acc820fe55b..32b18a8e376a8bdf470a644ec173a3ade761b93e 100644
--- a/chrome/browser/chromeos/note_taking_app_utils.cc
+++ b/chrome/browser/chromeos/note_taking_helper.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/chromeos/note_taking_app_utils.h"
+#include "chrome/browser/chromeos/note_taking_helper.h"
#include <string>
#include <vector>
@@ -25,6 +25,9 @@ namespace app_runtime = extensions::api::app_runtime;
namespace chromeos {
namespace {
+// Pointer to singleton instance.
+NoteTakingHelper* g_helper = nullptr;
+
// TODO(derat): Add more IDs.
const char* const kExtensionIds[] = {
// TODO(jdufault): Remove testing version after m54. See crbug.com/640828.
@@ -67,13 +70,32 @@ const extensions::Extension* GetApp(Profile* profile) {
} // namespace
-bool IsNoteTakingAppAvailable(Profile* profile) {
+// static
+void NoteTakingHelper::Initialize() {
+ DCHECK(!g_helper);
+ g_helper = new NoteTakingHelper();
+}
+
+// static
+void NoteTakingHelper::Shutdown() {
+ DCHECK(g_helper);
+ delete g_helper;
+ g_helper = nullptr;
+}
+
+// static
+NoteTakingHelper* NoteTakingHelper::Get() {
+ DCHECK(g_helper);
+ return g_helper;
+}
+
+bool NoteTakingHelper::IsAppAvailable(Profile* profile) {
DCHECK(profile);
return ash::IsPaletteFeatureEnabled() && GetApp(profile);
}
-void LaunchNoteTakingAppForNewNote(Profile* profile,
- const base::FilePath& path) {
+void NoteTakingHelper::LaunchAppForNewNote(Profile* profile,
+ const base::FilePath& path) {
DCHECK(profile);
const extensions::Extension* app = GetApp(profile);
if (!app) {
@@ -86,4 +108,8 @@ void LaunchNoteTakingAppForNewNote(Profile* profile,
apps::LaunchPlatformAppWithAction(profile, app, std::move(action_data), path);
}
+NoteTakingHelper::NoteTakingHelper() {}
+
+NoteTakingHelper::~NoteTakingHelper() {}
+
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698