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

Side by Side Diff: chrome/browser/chromeos/note_taking_app_utils.cc

Issue 2212303003: Implement app launch changes for app runtime extension proposal. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tool-screenshot
Patch Set: Nits Created 4 years, 4 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 unified diff | Download patch
OLDNEW
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/strings/string_split.h" 15 #include "base/strings/string_split.h"
15 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
16 #include "chromeos/chromeos_switches.h" 17 #include "chromeos/chromeos_switches.h"
17 #include "extensions/browser/extension_registry.h" 18 #include "extensions/browser/extension_registry.h"
19 #include "extensions/common/api/app_runtime.h"
18 #include "extensions/common/extension.h" 20 #include "extensions/common/extension.h"
19 #include "url/gurl.h" 21 #include "url/gurl.h"
20 22
23 namespace app_runtime = extensions::api::app_runtime;
24
21 namespace chromeos { 25 namespace chromeos {
22 namespace { 26 namespace {
23 27
24 // TODO(derat): Add more IDs. 28 // TODO(derat): Add more IDs.
25 const char* const kExtensionIds[] = { 29 const char* const kExtensionIds[] = {
26 "hmjkmjkepdijhoojdojkdfohbdgmmhki", // Google Keep app (Web Store) 30 "hmjkmjkepdijhoojdojkdfohbdgmmhki", // Google Keep app (Web Store)
27 }; 31 };
28 32
29 // Returns the first installed and enabled whitelisted note-taking app, or null 33 // Returns the first installed and enabled whitelisted note-taking app, or null
30 // if none is installed. 34 // if none is installed.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 72
69 void LaunchNoteTakingAppForNewNote(Profile* profile, 73 void LaunchNoteTakingAppForNewNote(Profile* profile,
70 const base::FilePath& path) { 74 const base::FilePath& path) {
71 DCHECK(profile); 75 DCHECK(profile);
72 const extensions::Extension* app = GetApp(profile); 76 const extensions::Extension* app = GetApp(profile);
73 if (!app) { 77 if (!app) {
74 LOG(ERROR) << "Failed to find note-taking app"; 78 LOG(ERROR) << "Failed to find note-taking app";
75 return; 79 return;
76 } 80 }
77 81
78 // TODO(derat): Launch with a "create new note" launch action once that's been 82 auto action_data = base::MakeUnique<app_runtime::ActionData>();
79 // added to chrome.appRuntime. Also decide what should be passed as the launch 83 action_data->action_type = app_runtime::ActionType::ACTION_TYPE_NEW_NOTE;
80 // source. 84 apps::LaunchPlatformAppWithAction(profile, app, std::move(action_data), path);
81 if (path.empty())
82 apps::LaunchPlatformApp(profile, app, extensions::SOURCE_UNTRACKED);
83 else
84 apps::LaunchPlatformAppWithPath(profile, app, path);
85 } 85 }
86 86
87 } // namespace chromeos 87 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/apps/app_launch_for_metro_restart_win.cc ('k') | extensions/browser/api/app_runtime/app_runtime_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698