OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "apps/app_lifetime_monitor_factory.h" | 8 #include "apps/app_lifetime_monitor_factory.h" |
9 #include "apps/switches.h" | 9 #include "apps/switches.h" |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 bool HasAppShimHost(Profile* profile, const std::string& app_id) { | 212 bool HasAppShimHost(Profile* profile, const std::string& app_id) { |
213 return g_browser_process->platform_part() | 213 return g_browser_process->platform_part() |
214 ->app_shim_host_manager() | 214 ->app_shim_host_manager() |
215 ->extension_app_shim_handler() | 215 ->extension_app_shim_handler() |
216 ->FindHost(profile, app_id); | 216 ->FindHost(profile, app_id); |
217 } | 217 } |
218 | 218 |
219 base::FilePath GetAppShimPath(Profile* profile, | 219 base::FilePath GetAppShimPath(Profile* profile, |
220 const extensions::Extension* app) { | 220 const extensions::Extension* app) { |
221 // Use a WebAppShortcutCreator to get the path. | 221 // Use a WebAppShortcutCreator to get the path. |
222 std::unique_ptr<web_app::ShortcutInfo> shortcut_info = | 222 scoped_refptr<web_app::ShortcutInfo> shortcut_info = |
223 web_app::ShortcutInfoForExtensionAndProfile(app, profile); | 223 web_app::ShortcutInfoForExtensionAndProfile(app, profile); |
224 web_app::WebAppShortcutCreator shortcut_creator( | 224 web_app::WebAppShortcutCreator shortcut_creator( |
225 web_app::GetWebAppDataDirectory(profile->GetPath(), app->id(), GURL()), | 225 web_app::GetWebAppDataDirectory(profile->GetPath(), app->id(), GURL()), |
226 shortcut_info.get()); | 226 shortcut_info.get()); |
227 return shortcut_creator.GetInternalShortcutPath(); | 227 return shortcut_creator.GetInternalShortcutPath(); |
228 } | 228 } |
229 | 229 |
230 Browser* GetFirstHostedAppWindow() { | 230 Browser* GetFirstHostedAppWindow() { |
231 for (Browser* browser : *BrowserList::GetInstance()) { | 231 for (Browser* browser : *BrowserList::GetInstance()) { |
232 const extensions::Extension* extension = | 232 const extensions::Extension* extension = |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 base::FilePath test_data_dir; | 543 base::FilePath test_data_dir; |
544 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); | 544 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); |
545 base::FilePath shim_path_32 = | 545 base::FilePath shim_path_32 = |
546 test_data_dir.Append("app_shim").Append("app_shim_32_bit.app"); | 546 test_data_dir.Append("app_shim").Append("app_shim_32_bit.app"); |
547 EXPECT_TRUE(base::PathExists(shim_path_32)); | 547 EXPECT_TRUE(base::PathExists(shim_path_32)); |
548 | 548 |
549 // Install test app. | 549 // Install test app. |
550 const extensions::Extension* app = InstallPlatformApp("minimal"); | 550 const extensions::Extension* app = InstallPlatformApp("minimal"); |
551 | 551 |
552 // Use WebAppShortcutCreator to create a 64 bit shim. | 552 // Use WebAppShortcutCreator to create a 64 bit shim. |
553 std::unique_ptr<web_app::ShortcutInfo> shortcut_info = | 553 scoped_refptr<web_app::ShortcutInfo> shortcut_info = |
554 web_app::ShortcutInfoForExtensionAndProfile(app, profile()); | 554 web_app::ShortcutInfoForExtensionAndProfile(app, profile()); |
555 web_app::WebAppShortcutCreator shortcut_creator( | 555 web_app::WebAppShortcutCreator shortcut_creator( |
556 web_app::GetWebAppDataDirectory(profile()->GetPath(), app->id(), GURL()), | 556 web_app::GetWebAppDataDirectory(profile()->GetPath(), app->id(), GURL()), |
557 shortcut_info.get()); | 557 shortcut_info.get()); |
558 shortcut_creator.UpdateShortcuts(); | 558 shortcut_creator.UpdateShortcuts(); |
559 base::FilePath shim_path = shortcut_creator.GetInternalShortcutPath(); | 559 base::FilePath shim_path = shortcut_creator.GetInternalShortcutPath(); |
560 NSMutableDictionary* plist_64 = [NSMutableDictionary | 560 NSMutableDictionary* plist_64 = [NSMutableDictionary |
561 dictionaryWithContentsOfFile:base::mac::FilePathToNSString( | 561 dictionaryWithContentsOfFile:base::mac::FilePathToNSString( |
562 shim_path.Append("Contents").Append("Info.plist"))]; | 562 shim_path.Append("Contents").Append("Info.plist"))]; |
563 | 563 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 // the shim is rebuilt. | 618 // the shim is rebuilt. |
619 WindowedAppShimLaunchObserver(app->id()).Wait(); | 619 WindowedAppShimLaunchObserver(app->id()).Wait(); |
620 | 620 |
621 EXPECT_TRUE(GetFirstAppWindow()); | 621 EXPECT_TRUE(GetFirstAppWindow()); |
622 EXPECT_TRUE(HasAppShimHost(profile(), app->id())); | 622 EXPECT_TRUE(HasAppShimHost(profile(), app->id())); |
623 } | 623 } |
624 | 624 |
625 #endif // defined(ARCH_CPU_64_BITS) | 625 #endif // defined(ARCH_CPU_64_BITS) |
626 | 626 |
627 } // namespace apps | 627 } // namespace apps |
OLD | NEW |