#import <Cocoa/Cocoa.h>
-#include "apps/shell_window_registry.h"
-#include "apps/ui/native_app_window.h"
#include "base/command_line.h"
#include "base/mac/scoped_nsobject.h"
#include "base/strings/sys_string_conversions.h"
#include "chrome/browser/apps/app_browsertest_util.h"
#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/extensions/extension_test_message_listener.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_iterator.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/extensions/extension.h"
+#include "extensions/browser/app_window/app_window_registry.h"
+#include "extensions/browser/app_window/native_app_window.h"
+#include "extensions/browser/uninstall_reason.h"
+#include "extensions/common/extension.h"
+#include "extensions/test/extension_test_message_listener.h"
namespace {
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
PlatformAppBrowserTest::SetUpCommandLine(command_line);
- command_line->AppendSwitch(switches::kEnableAppShims);
}
// Start two apps and wait for them to be launched.
SetUpApps();
// When an app is focused, all Chrome menu items should be hidden, and a menu
// item for the app should be added.
- apps::ShellWindow* app_1_shell_window =
- apps::ShellWindowRegistry::Get(profile())->
- GetShellWindowsForApp(app_1_->id()).front();
+ extensions::AppWindow* app_1_app_window =
+ extensions::AppWindowRegistry::Get(profile())
+ ->GetAppWindowsForApp(app_1_->id()).front();
[[NSNotificationCenter defaultCenter]
postNotificationName:NSWindowDidBecomeMainNotification
- object:app_1_shell_window->GetNativeWindow()];
+ object:app_1_app_window->GetNativeWindow()];
CheckHasAppMenus(app_1_);
// When another app is focused, the menu item for the app should change.
- apps::ShellWindow* app_2_shell_window =
- apps::ShellWindowRegistry::Get(profile())->
- GetShellWindowsForApp(app_2_->id()).front();
+ extensions::AppWindow* app_2_app_window =
+ extensions::AppWindowRegistry::Get(profile())
+ ->GetAppWindowsForApp(app_2_->id()).front();
[[NSNotificationCenter defaultCenter]
postNotificationName:NSWindowDidBecomeMainNotification
- object:app_2_shell_window->GetNativeWindow()];
+ object:app_2_app_window->GetNativeWindow()];
CheckHasAppMenus(app_2_);
// When a browser window is focused, the menu items for the app should be
// When an app window is closed and there are no other app windows, the menu
// items for the app should be removed.
- app_1_shell_window->GetBaseWindow()->Close();
+ app_1_app_window->GetBaseWindow()->Close();
chrome_window->Close();
[[NSNotificationCenter defaultCenter]
postNotificationName:NSWindowWillCloseNotification
- object:app_2_shell_window->GetNativeWindow()];
+ object:app_2_app_window->GetNativeWindow()];
CheckNoAppMenus();
}
// an app is uninstalled. We need to close the other windows first since the
// menu only changes on a NSWindowWillCloseNotification if there are no other
// windows.
- apps::ShellWindow* app_2_shell_window =
- apps::ShellWindowRegistry::Get(profile())->
- GetShellWindowsForApp(app_2_->id()).front();
- app_2_shell_window->GetBaseWindow()->Close();
+ extensions::AppWindow* app_2_app_window =
+ extensions::AppWindowRegistry::Get(profile())
+ ->GetAppWindowsForApp(app_2_->id()).front();
+ app_2_app_window->GetBaseWindow()->Close();
chrome::BrowserIterator()->window()->Close();
- apps::ShellWindow* app_1_shell_window =
- apps::ShellWindowRegistry::Get(profile())->
- GetShellWindowsForApp(app_1_->id()).front();
+ extensions::AppWindow* app_1_app_window =
+ extensions::AppWindowRegistry::Get(profile())
+ ->GetAppWindowsForApp(app_1_->id()).front();
[[NSNotificationCenter defaultCenter]
postNotificationName:NSWindowDidBecomeMainNotification
- object:app_1_shell_window->GetNativeWindow()];
+ object:app_1_app_window->GetNativeWindow()];
CheckHasAppMenus(app_1_);
- ExtensionService::UninstallExtensionHelper(extension_service(), app_1_->id());
+ ExtensionService::UninstallExtensionHelper(
+ extension_service(),
+ app_1_->id(),
+ extensions::UNINSTALL_REASON_FOR_TESTING);
CheckNoAppMenus();
}