| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "chrome/browser/chromeos/note_taking_app_utils.h" | 5 #include "chrome/browser/chromeos/note_taking_app_utils.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "apps/launcher.h" | 10 #include "apps/launcher.h" |
| 11 #include "ash/common/system/chromeos/palette/palette_utils.h" | 11 #include "ash/common/system/chromeos/palette/palette_utils.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
| 15 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chromeos/chromeos_switches.h" | 17 #include "chromeos/chromeos_switches.h" |
| 18 #include "extensions/browser/extension_registry.h" | 18 #include "extensions/browser/extension_registry.h" |
| 19 #include "extensions/common/api/app_runtime.h" | 19 #include "extensions/common/api/app_runtime.h" |
| 20 #include "extensions/common/extension.h" | 20 #include "extensions/common/extension.h" |
| 21 #include "url/gurl.h" | 21 #include "url/gurl.h" |
| 22 | 22 |
| 23 namespace app_runtime = extensions::api::app_runtime; | 23 namespace app_runtime = extensions::api::app_runtime; |
| 24 | 24 |
| 25 namespace chromeos { | 25 namespace chromeos { |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 // TODO(derat): Add more IDs. | 28 // TODO(derat): Add more IDs. |
| 29 const char* const kExtensionIds[] = { | 29 const char* const kExtensionIds[] = { |
| 30 // TODO(jdufault): Remove testing version after m54. See crbug.com/640828. |
| 31 "ogfjaccbdfhecploibfbhighmebiffla", // Testing Keep app |
| 30 "hmjkmjkepdijhoojdojkdfohbdgmmhki", // Google Keep app (Web Store) | 32 "hmjkmjkepdijhoojdojkdfohbdgmmhki", // Google Keep app (Web Store) |
| 31 }; | 33 }; |
| 32 | 34 |
| 33 // Returns the first installed and enabled whitelisted note-taking app, or null | 35 // Returns the first installed and enabled whitelisted note-taking app, or null |
| 34 // if none is installed. | 36 // if none is installed. |
| 35 const extensions::Extension* GetApp(Profile* profile) { | 37 const extensions::Extension* GetApp(Profile* profile) { |
| 36 // TODO(derat): Check the to-be-added "note-taking app enabled" pref here and | 38 // TODO(derat): Check the to-be-added "note-taking app enabled" pref here and |
| 37 // return null if it's disabled. | 39 // return null if it's disabled. |
| 38 | 40 |
| 39 std::vector<std::string> ids; | 41 std::vector<std::string> ids; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 LOG(ERROR) << "Failed to find note-taking app"; | 80 LOG(ERROR) << "Failed to find note-taking app"; |
| 79 return; | 81 return; |
| 80 } | 82 } |
| 81 | 83 |
| 82 auto action_data = base::MakeUnique<app_runtime::ActionData>(); | 84 auto action_data = base::MakeUnique<app_runtime::ActionData>(); |
| 83 action_data->action_type = app_runtime::ActionType::ACTION_TYPE_NEW_NOTE; | 85 action_data->action_type = app_runtime::ActionType::ACTION_TYPE_NEW_NOTE; |
| 84 apps::LaunchPlatformAppWithAction(profile, app, std::move(action_data), path); | 86 apps::LaunchPlatformAppWithAction(profile, app, std::move(action_data), path); |
| 85 } | 87 } |
| 86 | 88 |
| 87 } // namespace chromeos | 89 } // namespace chromeos |
| OLD | NEW |