| 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/app_window/app_window.h" |
| 18 #include "extensions/browser/extension_registry.h" | 19 #include "extensions/browser/extension_registry.h" |
| 19 #include "extensions/common/api/app_runtime.h" | 20 #include "extensions/common/api/app_runtime.h" |
| 20 #include "extensions/common/extension.h" | 21 #include "extensions/common/extension.h" |
| 21 #include "url/gurl.h" | 22 #include "url/gurl.h" |
| 22 | 23 |
| 23 namespace app_runtime = extensions::api::app_runtime; | 24 namespace app_runtime = extensions::api::app_runtime; |
| 24 | 25 |
| 25 namespace chromeos { | 26 namespace chromeos { |
| 26 namespace { | 27 namespace { |
| 27 | 28 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 if (!app) { | 80 if (!app) { |
| 80 LOG(ERROR) << "Failed to find note-taking app"; | 81 LOG(ERROR) << "Failed to find note-taking app"; |
| 81 return; | 82 return; |
| 82 } | 83 } |
| 83 | 84 |
| 84 auto action_data = base::MakeUnique<app_runtime::ActionData>(); | 85 auto action_data = base::MakeUnique<app_runtime::ActionData>(); |
| 85 action_data->action_type = app_runtime::ActionType::ACTION_TYPE_NEW_NOTE; | 86 action_data->action_type = app_runtime::ActionType::ACTION_TYPE_NEW_NOTE; |
| 86 apps::LaunchPlatformAppWithAction(profile, app, std::move(action_data), path); | 87 apps::LaunchPlatformAppWithAction(profile, app, std::move(action_data), path); |
| 87 } | 88 } |
| 88 | 89 |
| 90 bool IsNoteTakingAppWindow(extensions::AppWindow* app_window, |
| 91 Profile* profile) { |
| 92 DCHECK(app_window && profile); |
| 93 const extensions::Extension* app = GetApp(profile); |
| 94 return app && (app->id() == app_window->extension_id()); |
| 95 } |
| 96 |
| 89 } // namespace chromeos | 97 } // namespace chromeos |
| OLD | NEW |