OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
tapted
2017/02/03 05:12:06
CL description maybe "this part of the code" -> "d
Matt Giuca
2017/02/03 05:22:20
Done.
| |
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" |
11 #include "base/mac/foundation_util.h" | 11 #include "base/mac/foundation_util.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 std::unique_ptr<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(), extensions::FileHandlersInfo()); | 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 = |
233 apps::ExtensionAppShimHandler::MaybeGetAppForBrowser(browser); | 233 apps::ExtensionAppShimHandler::MaybeGetAppForBrowser(browser); |
234 if (extension && extension->is_hosted_app()) | 234 if (extension && extension->is_hosted_app()) |
235 return browser; | 235 return browser; |
236 } | 236 } |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 std::unique_ptr<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(), extensions::FileHandlersInfo()); | 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 |
564 // Copy 32 bit shim to where it's expected to be. | 564 // Copy 32 bit shim to where it's expected to be. |
565 // CopyDirectory doesn't seem to work when copying and renaming in one go. | 565 // CopyDirectory doesn't seem to work when copying and renaming in one go. |
566 ASSERT_TRUE(base::DeleteFile(shim_path, true)); | 566 ASSERT_TRUE(base::DeleteFile(shim_path, true)); |
567 ASSERT_TRUE(base::PathExists(shim_path.DirName())); | 567 ASSERT_TRUE(base::PathExists(shim_path.DirName())); |
(...skipping 50 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 |