summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-15 05:36:33 +0000
committerjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-15 05:36:33 +0000
commitdbb03fbe591bdf4e711af10c3e8233e68b29ee49 (patch)
tree0958d99e8988d6bfd7aefe6bf024b425fbef46af
parent26f8f3aa15d34fd29080889512131b02d933fef5 (diff)
downloadchromium_src-dbb03fbe591bdf4e711af10c3e8233e68b29ee49.zip
chromium_src-dbb03fbe591bdf4e711af10c3e8233e68b29ee49.tar.gz
chromium_src-dbb03fbe591bdf4e711af10c3e8233e68b29ee49.tar.bz2
Rename apps::ShellWindow to apps::AppWindow
* Rename ShellWindowRegistry * Rename ShellWindowGeometryCache * Rename members like shell_window_ to app_window_ * Rename locals like shell_window to app_window BUG=343591 TEST=compiles COLLABORATOR=scheib@chromium.org TBR=skuhne@chromium.org for chrome/browser/ui/ash/launcher TBR=thakis@chromium.org for chrome/browser/ui/cocoa TBR=erg@chromium.org for chrome/browser/ui/gtk TBR=sky@chromium.org for chrome/test Review URL: https://codereview.chromium.org/166573005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251542 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--apps/app_keep_alive_service_factory.cc2
-rw-r--r--apps/app_lifetime_monitor.cc46
-rw-r--r--apps/app_lifetime_monitor.h12
-rw-r--r--apps/app_lifetime_monitor_factory.cc4
-rw-r--r--apps/app_load_service.cc11
-rw-r--r--apps/app_load_service.h2
-rw-r--r--apps/app_load_service_factory.cc4
-rw-r--r--apps/app_restore_service.cc2
-rw-r--r--apps/app_restore_service.h2
-rw-r--r--apps/app_shim/app_shim_handler_mac.cc18
-rw-r--r--apps/app_shim/extension_app_shim_handler_mac.cc77
-rw-r--r--apps/app_shim/extension_app_shim_handler_mac.h17
-rw-r--r--apps/app_shim/extension_app_shim_handler_mac_unittest.cc20
-rw-r--r--apps/app_window.cc (renamed from apps/shell_window.cc)399
-rw-r--r--apps/app_window.h (renamed from apps/shell_window.h)135
-rw-r--r--apps/app_window_contents.cc40
-rw-r--r--apps/app_window_contents.h22
-rw-r--r--apps/app_window_geometry_cache.cc (renamed from apps/shell_window_geometry_cache.cc)153
-rw-r--r--apps/app_window_geometry_cache.h (renamed from apps/shell_window_geometry_cache.h)29
-rw-r--r--apps/app_window_geometry_cache_unittest.cc (renamed from apps/shell_window_geometry_cache_unittest.cc)111
-rw-r--r--apps/app_window_interactive_uitest.cc (renamed from apps/shell_window_interactive_uitest.cc)72
-rw-r--r--apps/app_window_registry.cc307
-rw-r--r--apps/app_window_registry.h147
-rw-r--r--apps/apps.gypi16
-rw-r--r--apps/shell_window_registry.cc309
-rw-r--r--apps/shell_window_registry.h147
-rw-r--r--apps/ui/native_app_window.h8
-rw-r--r--apps/ui/views/app_window_frame_view.cc (renamed from apps/ui/views/shell_window_frame_view.cc)149
-rw-r--r--apps/ui/views/app_window_frame_view.h (renamed from apps/ui/views/shell_window_frame_view.h)22
-rw-r--r--chrome/browser/app_controller_mac.mm4
-rw-r--r--chrome/browser/app_controller_mac_browsertest.mm10
-rw-r--r--chrome/browser/apps/app_browsertest.cc167
-rw-r--r--chrome/browser/apps/app_browsertest_util.cc79
-rw-r--r--chrome/browser/apps/app_browsertest_util.h41
-rw-r--r--chrome/browser/apps/app_pointer_lock_interactive_uitest.cc2
-rw-r--r--chrome/browser/apps/app_url_redirector_browsertest.cc24
-rw-r--r--chrome/browser/apps/app_window_browsertest.cc28
-rw-r--r--chrome/browser/apps/app_window_interactive_uitest.cc36
-rw-r--r--chrome/browser/apps/ephemeral_app_browsertest.cc8
-rw-r--r--chrome/browser/apps/event_page_browsertest.cc8
-rw-r--r--chrome/browser/apps/web_view_browsertest.cc25
-rw-r--r--chrome/browser/apps/web_view_interactive_browsertest.cc28
-rw-r--r--chrome/browser/chromeos/app_mode/app_session_lifetime.cc23
-rw-r--r--chrome/browser/chromeos/extensions/file_manager/private_api_misc.cc43
-rw-r--r--chrome/browser/chromeos/file_manager/file_manager_browsertest.cc14
-rw-r--r--chrome/browser/chromeos/login/app_launch_controller.cc29
-rw-r--r--chrome/browser/chromeos/login/kiosk_browsertest.cc52
-rw-r--r--chrome/browser/extensions/DEPS4
-rw-r--r--chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc66
-rw-r--r--chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.h44
-rw-r--r--chrome/browser/extensions/api/app_window/app_window_api.cc45
-rw-r--r--chrome/browser/extensions/api/app_window/app_window_apitest.cc47
-rw-r--r--chrome/browser/extensions/api/developer_private/developer_private_api.cc67
-rw-r--r--chrome/browser/extensions/api/developer_private/developer_private_api.h4
-rw-r--r--chrome/browser/extensions/api/feedback_private/feedback_browsertest.cc12
-rw-r--r--chrome/browser/extensions/api/file_system/file_system_api.cc30
-rw-r--r--chrome/browser/extensions/api/identity/web_auth_flow.cc44
-rw-r--r--chrome/browser/extensions/api/identity/web_auth_flow.h17
-rw-r--r--chrome/browser/extensions/api/media_galleries/media_galleries_api.cc10
-rw-r--r--chrome/browser/extensions/api/tabs/ash_panel_contents.cc43
-rw-r--r--chrome/browser/extensions/api/tabs/ash_panel_contents.h12
-rw-r--r--chrome/browser/extensions/api/tabs/tabs_api.cc19
-rw-r--r--chrome/browser/extensions/extension_tab_util.cc27
-rw-r--r--chrome/browser/extensions/window_open_apitest.cc6
-rw-r--r--chrome/browser/policy/policy_browsertest.cc59
-rw-r--r--chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc6
-rw-r--r--chrome/browser/ui/apps/apps_metro_handler_win.cc8
-rw-r--r--chrome/browser/ui/apps/chrome_shell_window_delegate.cc4
-rw-r--r--chrome/browser/ui/apps/chrome_shell_window_delegate.h15
-rw-r--r--chrome/browser/ui/ash/accelerator_commands_browsertest.cc64
-rw-r--r--chrome/browser/ui/ash/chrome_new_window_delegate_chromeos.cc2
-rw-r--r--chrome/browser/ui/ash/chrome_shell_delegate.cc4
-rw-r--r--chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc112
-rw-r--r--chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc20
-rw-r--r--chrome/browser/ui/ash/launcher/chrome_launcher_controller_win.cc10
-rw-r--r--chrome/browser/ui/ash/launcher/multi_profile_shell_window_launcher_controller.cc63
-rw-r--r--chrome/browser/ui/ash/launcher/multi_profile_shell_window_launcher_controller.h20
-rw-r--r--chrome/browser/ui/ash/launcher/shell_window_launcher_controller.cc72
-rw-r--r--chrome/browser/ui/ash/launcher/shell_window_launcher_controller.h29
-rw-r--r--chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.cc136
-rw-r--r--chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.h27
-rw-r--r--chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc59
-rw-r--r--chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h6
-rw-r--r--chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc14
-rw-r--r--chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac.mm37
-rw-r--r--chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac_browsertest.mm38
-rw-r--r--chrome/browser/ui/cocoa/apps/chrome_shell_window_delegate_cocoa.mm6
-rw-r--r--chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h12
-rw-r--r--chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm48
-rw-r--r--chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm8
-rw-r--r--chrome/browser/ui/gtk/apps/chrome_shell_window_delegate_gtk.cc6
-rw-r--r--chrome/browser/ui/gtk/apps/native_app_window_gtk.cc46
-rw-r--r--chrome/browser/ui/gtk/apps/native_app_window_gtk.h12
-rw-r--r--chrome/browser/ui/views/app_list/win/app_list_controller_delegate_win.cc10
-rw-r--r--chrome/browser/ui/views/apps/chrome_shell_window_delegate_views.cc6
-rw-r--r--chrome/browser/ui/views/apps/chrome_shell_window_delegate_views_win.cc6
-rw-r--r--chrome/browser/ui/views/apps/native_app_window_views.cc120
-rw-r--r--chrome/browser/ui/views/apps/native_app_window_views.h26
-rw-r--r--chrome/browser/ui/views/apps/native_app_window_views_win.cc10
-rw-r--r--chrome/browser/ui/views/select_file_dialog_extension.cc27
-rw-r--r--chrome/browser/ui/webui/extensions/extension_settings_handler.cc25
-rw-r--r--chrome/browser/ui/webui/extensions/extension_settings_handler.h7
-rw-r--r--chrome/browser/ui/webui/options/browser_options_handler.cc4
-rw-r--r--chrome/browser/ui/webui/options/options_handlers_helper.cc14
-rw-r--r--chrome/chrome_tests.gypi2
-rw-r--r--chrome/chrome_tests_unit.gypi4
-rw-r--r--chrome/test/remoting/remote_desktop_browsertest.cc2
-rw-r--r--extensions/browser/extension_prefs.h2
-rw-r--r--extensions/common/view_type.h2
109 files changed, 2282 insertions, 2329 deletions
diff --git a/apps/app_keep_alive_service_factory.cc b/apps/app_keep_alive_service_factory.cc
index c33452b..5afe050 100644
--- a/apps/app_keep_alive_service_factory.cc
+++ b/apps/app_keep_alive_service_factory.cc
@@ -6,7 +6,7 @@
#include "apps/app_keep_alive_service.h"
#include "apps/app_lifetime_monitor_factory.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window_registry.h"
#include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
#include "extensions/browser/extensions_browser_client.h"
diff --git a/apps/app_lifetime_monitor.cc b/apps/app_lifetime_monitor.cc
index f2bb345..b207b04 100644
--- a/apps/app_lifetime_monitor.cc
+++ b/apps/app_lifetime_monitor.cc
@@ -4,7 +4,7 @@
#include "apps/app_lifetime_monitor.h"
-#include "apps/shell_window.h"
+#include "apps/app_window.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/extension_host.h"
#include "chrome/browser/profiles/profile.h"
@@ -29,11 +29,11 @@ AppLifetimeMonitor::AppLifetimeMonitor(Profile* profile)
this, chrome::NOTIFICATION_APP_TERMINATING,
content::NotificationService::AllSources());
- ShellWindowRegistry* shell_window_registry =
- ShellWindowRegistry::Factory::GetForBrowserContext(
- profile_, false /* create */);
- DCHECK(shell_window_registry);
- shell_window_registry->AddObserver(this);
+ AppWindowRegistry* app_window_registry =
+ AppWindowRegistry::Factory::GetForBrowserContext(profile_,
+ false /* create */);
+ DCHECK(app_window_registry);
+ app_window_registry->AddObserver(this);
}
AppLifetimeMonitor::~AppLifetimeMonitor() {}
@@ -77,33 +77,33 @@ void AppLifetimeMonitor::Observe(int type,
}
}
-void AppLifetimeMonitor::OnShellWindowAdded(ShellWindow* shell_window) {
- if (shell_window->window_type() != ShellWindow::WINDOW_TYPE_DEFAULT)
+void AppLifetimeMonitor::OnAppWindowAdded(AppWindow* app_window) {
+ if (app_window->window_type() != AppWindow::WINDOW_TYPE_DEFAULT)
return;
- ShellWindowRegistry::ShellWindowList windows =
- ShellWindowRegistry::Get(shell_window->browser_context())
- ->GetShellWindowsForApp(shell_window->extension_id());
+ AppWindowRegistry::AppWindowList windows =
+ AppWindowRegistry::Get(app_window->browser_context())
+ ->GetAppWindowsForApp(app_window->extension_id());
if (windows.size() == 1)
- NotifyAppActivated(shell_window->extension_id());
+ NotifyAppActivated(app_window->extension_id());
}
-void AppLifetimeMonitor::OnShellWindowIconChanged(ShellWindow* shell_window) {}
+void AppLifetimeMonitor::OnAppWindowIconChanged(AppWindow* app_window) {}
-void AppLifetimeMonitor::OnShellWindowRemoved(ShellWindow* shell_window) {
- ShellWindowRegistry::ShellWindowList windows =
- ShellWindowRegistry::Get(shell_window->browser_context())
- ->GetShellWindowsForApp(shell_window->extension_id());
+void AppLifetimeMonitor::OnAppWindowRemoved(AppWindow* app_window) {
+ AppWindowRegistry::AppWindowList windows =
+ AppWindowRegistry::Get(app_window->browser_context())
+ ->GetAppWindowsForApp(app_window->extension_id());
if (windows.empty())
- NotifyAppDeactivated(shell_window->extension_id());
+ NotifyAppDeactivated(app_window->extension_id());
}
void AppLifetimeMonitor::Shutdown() {
- ShellWindowRegistry* shell_window_registry =
- ShellWindowRegistry::Factory::GetForBrowserContext(
- profile_, false /* create */);
- if (shell_window_registry)
- shell_window_registry->RemoveObserver(this);
+ AppWindowRegistry* app_window_registry =
+ AppWindowRegistry::Factory::GetForBrowserContext(profile_,
+ false /* create */);
+ if (app_window_registry)
+ app_window_registry->RemoveObserver(this);
}
void AppLifetimeMonitor::NotifyAppStart(const std::string& app_id) {
diff --git a/apps/app_lifetime_monitor.h b/apps/app_lifetime_monitor.h
index 2da6550..45ab09a 100644
--- a/apps/app_lifetime_monitor.h
+++ b/apps/app_lifetime_monitor.h
@@ -8,7 +8,7 @@
#include <string>
#include <vector>
-#include "apps/shell_window_registry.h"
+#include "apps/app_window_registry.h"
#include "base/observer_list.h"
#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
#include "content/public/browser/notification_observer.h"
@@ -26,7 +26,7 @@ namespace apps {
// events.
class AppLifetimeMonitor : public BrowserContextKeyedService,
public content::NotificationObserver,
- public ShellWindowRegistry::Observer {
+ public AppWindowRegistry::Observer {
public:
class Observer {
public:
@@ -61,10 +61,10 @@ class AppLifetimeMonitor : public BrowserContextKeyedService,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
- // ShellWindowRegistry::Observer overrides:
- virtual void OnShellWindowAdded(ShellWindow* shell_window) OVERRIDE;
- virtual void OnShellWindowIconChanged(ShellWindow* shell_window) OVERRIDE;
- virtual void OnShellWindowRemoved(ShellWindow* shell_window) OVERRIDE;
+ // AppWindowRegistry::Observer overrides:
+ virtual void OnAppWindowAdded(AppWindow* app_window) OVERRIDE;
+ virtual void OnAppWindowIconChanged(AppWindow* app_window) OVERRIDE;
+ virtual void OnAppWindowRemoved(AppWindow* app_window) OVERRIDE;
// BrowserContextKeyedService overrides:
virtual void Shutdown() OVERRIDE;
diff --git a/apps/app_lifetime_monitor_factory.cc b/apps/app_lifetime_monitor_factory.cc
index 7d37e4e..b8a813a 100644
--- a/apps/app_lifetime_monitor_factory.cc
+++ b/apps/app_lifetime_monitor_factory.cc
@@ -5,7 +5,7 @@
#include "apps/app_lifetime_monitor_factory.h"
#include "apps/app_lifetime_monitor.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window_registry.h"
#include "chrome/browser/profiles/profile.h"
#include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
#include "extensions/browser/extensions_browser_client.h"
@@ -26,7 +26,7 @@ AppLifetimeMonitorFactory::AppLifetimeMonitorFactory()
: BrowserContextKeyedServiceFactory(
"AppLifetimeMonitor",
BrowserContextDependencyManager::GetInstance()) {
- DependsOn(ShellWindowRegistry::Factory::GetInstance());
+ DependsOn(AppWindowRegistry::Factory::GetInstance());
}
AppLifetimeMonitorFactory::~AppLifetimeMonitorFactory() {}
diff --git a/apps/app_load_service.cc b/apps/app_load_service.cc
index a64cffc..ae60f7f 100644
--- a/apps/app_load_service.cc
+++ b/apps/app_load_service.cc
@@ -5,8 +5,8 @@
#include "apps/app_load_service.h"
#include "apps/app_load_service_factory.h"
+#include "apps/app_window_registry.h"
#include "apps/launcher.h"
-#include "apps/shell_window_registry.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/extension_host.h"
#include "chrome/browser/extensions/extension_service.h"
@@ -116,7 +116,7 @@ void AppLoadService::Observe(int type,
break;
if (WasUnloadedForReload(*unload_info) &&
- HasShellWindows(unload_info->extension->id()) &&
+ HasAppWindows(unload_info->extension->id()) &&
!HasPostReloadAction(unload_info->extension->id())) {
post_reload_actions_[unload_info->extension->id()].action_type = LAUNCH;
}
@@ -127,9 +127,10 @@ void AppLoadService::Observe(int type,
}
}
-bool AppLoadService::HasShellWindows(const std::string& extension_id) {
- return !ShellWindowRegistry::Get(profile_)->
- GetShellWindowsForApp(extension_id).empty();
+bool AppLoadService::HasAppWindows(const std::string& extension_id) {
+ return !AppWindowRegistry::Get(profile_)
+ ->GetAppWindowsForApp(extension_id)
+ .empty();
}
bool AppLoadService::WasUnloadedForReload(
diff --git a/apps/app_load_service.h b/apps/app_load_service.h
index 9f0d971..518a30a 100644
--- a/apps/app_load_service.h
+++ b/apps/app_load_service.h
@@ -64,7 +64,7 @@ class AppLoadService : public BrowserContextKeyedService,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
- bool HasShellWindows(const std::string& extension_id);
+ bool HasAppWindows(const std::string& extension_id);
bool WasUnloadedForReload(
const extensions::UnloadedExtensionInfo& unload_info);
bool HasPostReloadAction(const std::string& extension_id);
diff --git a/apps/app_load_service_factory.cc b/apps/app_load_service_factory.cc
index 60b0e9f..771db73 100644
--- a/apps/app_load_service_factory.cc
+++ b/apps/app_load_service_factory.cc
@@ -5,7 +5,7 @@
#include "apps/app_load_service_factory.h"
#include "apps/app_load_service.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window_registry.h"
#include "chrome/browser/profiles/profile.h"
#include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
#include "extensions/browser/extension_prefs_factory.h"
@@ -31,7 +31,7 @@ AppLoadServiceFactory::AppLoadServiceFactory()
DependsOn(
extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
DependsOn(extensions::ExtensionPrefsFactory::GetInstance());
- DependsOn(ShellWindowRegistry::Factory::GetInstance());
+ DependsOn(AppWindowRegistry::Factory::GetInstance());
}
AppLoadServiceFactory::~AppLoadServiceFactory() {
diff --git a/apps/app_restore_service.cc b/apps/app_restore_service.cc
index c9fca85..3193fc6 100644
--- a/apps/app_restore_service.cc
+++ b/apps/app_restore_service.cc
@@ -6,9 +6,9 @@
#include "apps/app_lifetime_monitor_factory.h"
#include "apps/app_restore_service_factory.h"
+#include "apps/app_window.h"
#include "apps/launcher.h"
#include "apps/saved_files_service.h"
-#include "apps/shell_window.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/api/app_runtime/app_runtime_api.h"
#include "chrome/browser/extensions/extension_host.h"
diff --git a/apps/app_restore_service.h b/apps/app_restore_service.h
index 425364e..9dd88cf 100644
--- a/apps/app_restore_service.h
+++ b/apps/app_restore_service.h
@@ -9,7 +9,7 @@
#include <vector>
#include "apps/app_lifetime_monitor.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window_registry.h"
#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
namespace extensions {
diff --git a/apps/app_shim/app_shim_handler_mac.cc b/apps/app_shim/app_shim_handler_mac.cc
index f50acdb..cfbf4ff 100644
--- a/apps/app_shim/app_shim_handler_mac.cc
+++ b/apps/app_shim/app_shim_handler_mac.cc
@@ -6,7 +6,7 @@
#include <map>
-#include "apps/shell_window_registry.h"
+#include "apps/app_window_registry.h"
#include "base/bind.h"
#include "base/logging.h"
#include "base/memory/singleton.h"
@@ -22,11 +22,12 @@ namespace apps {
namespace {
-void TerminateIfNoShellWindows() {
- bool shell_windows_left =
- apps::ShellWindowRegistry::IsShellWindowRegisteredInAnyProfile(0);
- if (!shell_windows_left && !AppListService::Get(
- chrome::HOST_DESKTOP_TYPE_NATIVE)->IsAppListVisible()) {
+void TerminateIfNoAppWindows() {
+ bool app_windows_left =
+ apps::AppWindowRegistry::IsAppWindowRegisteredInAnyProfile(0);
+ if (!app_windows_left &&
+ !AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE)
+ ->IsAppListVisible()) {
chrome::AttemptExit();
}
}
@@ -61,11 +62,10 @@ class AppShimHandlerRegistry : public content::NotificationObserver {
void MaybeTerminate() {
if (!browser_opened_ever_) {
- // Post this to give ShellWindows a chance to remove themselves from the
+ // Post this to give AppWindows a chance to remove themselves from the
// registry.
base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&TerminateIfNoShellWindows));
+ FROM_HERE, base::Bind(&TerminateIfNoAppWindows));
}
}
diff --git a/apps/app_shim/extension_app_shim_handler_mac.cc b/apps/app_shim/extension_app_shim_handler_mac.cc
index d9917bc..2f51e43 100644
--- a/apps/app_shim/extension_app_shim_handler_mac.cc
+++ b/apps/app_shim/extension_app_shim_handler_mac.cc
@@ -7,9 +7,9 @@
#include "apps/app_lifetime_monitor_factory.h"
#include "apps/app_shim/app_shim_host_manager_mac.h"
#include "apps/app_shim/app_shim_messages.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "apps/launcher.h"
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
#include "apps/ui/native_app_window.h"
#include "base/files/file_path.h"
#include "base/logging.h"
@@ -34,7 +34,7 @@ using extensions::ExtensionRegistry;
namespace {
-typedef apps::ShellWindowRegistry::ShellWindowList ShellWindowList;
+typedef apps::AppWindowRegistry::AppWindowList AppWindowList;
void ProfileLoadedCallback(base::Callback<void(Profile*)> callback,
Profile* profile,
@@ -49,10 +49,11 @@ void ProfileLoadedCallback(base::Callback<void(Profile*)> callback,
}
void SetAppHidden(Profile* profile, const std::string& app_id, bool hidden) {
- ShellWindowList windows =
- apps::ShellWindowRegistry::Get(profile)->GetShellWindowsForApp(app_id);
- for (ShellWindowList::const_reverse_iterator it = windows.rbegin();
- it != windows.rend(); ++it) {
+ AppWindowList windows =
+ apps::AppWindowRegistry::Get(profile)->GetAppWindowsForApp(app_id);
+ for (AppWindowList::const_reverse_iterator it = windows.rbegin();
+ it != windows.rend();
+ ++it) {
if (hidden)
(*it)->GetBaseWindow()->HideWithApp();
else
@@ -60,13 +61,13 @@ void SetAppHidden(Profile* profile, const std::string& app_id, bool hidden) {
}
}
-bool FocusWindows(const ShellWindowList& windows) {
+bool FocusWindows(const AppWindowList& windows) {
if (windows.empty())
return false;
std::set<gfx::NativeWindow> native_windows;
- for (ShellWindowList::const_iterator it = windows.begin();
- it != windows.end(); ++it) {
+ for (AppWindowList::const_iterator it = windows.begin(); it != windows.end();
+ ++it) {
native_windows.insert((*it)->GetNativeWindow());
}
// Allow workspace switching. For the browser process, we can reasonably rely
@@ -153,10 +154,10 @@ void ExtensionAppShimHandler::Delegate::LoadProfileAsync(
base::string16(), base::string16(), std::string());
}
-ShellWindowList ExtensionAppShimHandler::Delegate::GetWindows(
+AppWindowList ExtensionAppShimHandler::Delegate::GetWindows(
Profile* profile,
const std::string& extension_id) {
- return ShellWindowRegistry::Get(profile)->GetShellWindowsForApp(extension_id);
+ return AppWindowRegistry::Get(profile)->GetAppWindowsForApp(extension_id);
}
const extensions::Extension*
@@ -226,44 +227,41 @@ AppShimHandler::Host* ExtensionAppShimHandler::FindHost(
}
// static
-void ExtensionAppShimHandler::QuitAppForWindow(ShellWindow* shell_window) {
+void ExtensionAppShimHandler::QuitAppForWindow(AppWindow* app_window) {
ExtensionAppShimHandler* handler =
g_browser_process->platform_part()->app_shim_host_manager()->
extension_app_shim_handler();
Host* host = handler->FindHost(
- Profile::FromBrowserContext(shell_window->browser_context()),
- shell_window->extension_id());
+ Profile::FromBrowserContext(app_window->browser_context()),
+ app_window->extension_id());
if (host) {
handler->OnShimQuit(host);
} else {
// App shims might be disabled or the shim is still starting up.
- ShellWindowRegistry::Get(
- Profile::FromBrowserContext(shell_window->browser_context()))
- ->CloseAllShellWindowsForApp(shell_window->extension_id());
+ AppWindowRegistry::Get(
+ Profile::FromBrowserContext(app_window->browser_context()))
+ ->CloseAllAppWindowsForApp(app_window->extension_id());
}
}
-void ExtensionAppShimHandler::HideAppForWindow(ShellWindow* shell_window) {
+void ExtensionAppShimHandler::HideAppForWindow(AppWindow* app_window) {
ExtensionAppShimHandler* handler =
g_browser_process->platform_part()->app_shim_host_manager()->
extension_app_shim_handler();
- Profile* profile =
- Profile::FromBrowserContext(shell_window->browser_context());
- Host* host = handler->FindHost(profile, shell_window->extension_id());
+ Profile* profile = Profile::FromBrowserContext(app_window->browser_context());
+ Host* host = handler->FindHost(profile, app_window->extension_id());
if (host)
host->OnAppHide();
else
- SetAppHidden(profile, shell_window->extension_id(), true);
+ SetAppHidden(profile, app_window->extension_id(), true);
}
-
-void ExtensionAppShimHandler::FocusAppForWindow(ShellWindow* shell_window) {
+void ExtensionAppShimHandler::FocusAppForWindow(AppWindow* app_window) {
ExtensionAppShimHandler* handler =
g_browser_process->platform_part()->app_shim_host_manager()->
extension_app_shim_handler();
- Profile* profile =
- Profile::FromBrowserContext(shell_window->browser_context());
- const std::string& app_id = shell_window->extension_id();
+ Profile* profile = Profile::FromBrowserContext(app_window->browser_context());
+ const std::string& app_id = app_window->extension_id();
Host* host = handler->FindHost(profile, app_id);
if (host) {
handler->OnShimFocus(host,
@@ -271,27 +269,26 @@ void ExtensionAppShimHandler::FocusAppForWindow(ShellWindow* shell_window) {
std::vector<base::FilePath>());
} else {
FocusWindows(
- apps::ShellWindowRegistry::Get(profile)->GetShellWindowsForApp(app_id));
+ apps::AppWindowRegistry::Get(profile)->GetAppWindowsForApp(app_id));
}
}
// static
bool ExtensionAppShimHandler::RequestUserAttentionForWindow(
- ShellWindow* shell_window) {
+ AppWindow* app_window) {
ExtensionAppShimHandler* handler =
g_browser_process->platform_part()->app_shim_host_manager()->
extension_app_shim_handler();
- Profile* profile =
- Profile::FromBrowserContext(shell_window->browser_context());
- Host* host = handler->FindHost(profile, shell_window->extension_id());
+ Profile* profile = Profile::FromBrowserContext(app_window->browser_context());
+ Host* host = handler->FindHost(profile, app_window->extension_id());
if (host) {
// Bring the window to the front without showing it.
- ShellWindowRegistry::Get(profile)->ShellWindowActivated(shell_window);
+ AppWindowRegistry::Get(profile)->AppWindowActivated(app_window);
host->OnAppRequestUserAttention();
return true;
} else {
// Just show the app.
- SetAppHidden(profile, shell_window->extension_id(), false);
+ SetAppHidden(profile, app_window->extension_id(), false);
return false;
}
}
@@ -418,7 +415,7 @@ void ExtensionAppShimHandler::OnShimFocus(
DCHECK(delegate_->ProfileExistsForPath(host->GetProfilePath()));
Profile* profile = delegate_->ProfileForPath(host->GetProfilePath());
- const ShellWindowList windows =
+ const AppWindowList windows =
delegate_->GetWindows(profile, host->GetAppId());
bool windows_focused = FocusWindows(windows);
@@ -450,10 +447,10 @@ void ExtensionAppShimHandler::OnShimQuit(Host* host) {
Profile* profile = delegate_->ProfileForPath(host->GetProfilePath());
const std::string& app_id = host->GetAppId();
- const ShellWindowList windows =
- delegate_->GetWindows(profile, app_id);
- for (ShellWindowRegistry::const_iterator it = windows.begin();
- it != windows.end(); ++it) {
+ const AppWindowList windows = delegate_->GetWindows(profile, app_id);
+ for (AppWindowRegistry::const_iterator it = windows.begin();
+ it != windows.end();
+ ++it) {
(*it)->GetBaseWindow()->Close();
}
// Once the last window closes, flow will end up in OnAppDeactivated via
diff --git a/apps/app_shim/extension_app_shim_handler_mac.h b/apps/app_shim/extension_app_shim_handler_mac.h
index c8069ce2..0fc8a84 100644
--- a/apps/app_shim/extension_app_shim_handler_mac.h
+++ b/apps/app_shim/extension_app_shim_handler_mac.h
@@ -11,7 +11,7 @@
#include "apps/app_lifetime_monitor.h"
#include "apps/app_shim/app_shim_handler_mac.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window_registry.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "content/public/browser/notification_observer.h"
@@ -33,7 +33,7 @@ class Extension;
namespace apps {
-class ShellWindow;
+class AppWindow;
// This app shim handler that handles events for app shims that correspond to an
// extension.
@@ -50,8 +50,9 @@ class ExtensionAppShimHandler : public AppShimHandler,
virtual void LoadProfileAsync(const base::FilePath& path,
base::Callback<void(Profile*)> callback);
- virtual ShellWindowRegistry::ShellWindowList GetWindows(
- Profile* profile, const std::string& extension_id);
+ virtual AppWindowRegistry::AppWindowList GetWindows(
+ Profile* profile,
+ const std::string& extension_id);
virtual const extensions::Extension* GetAppExtension(
Profile* profile, const std::string& extension_id);
@@ -72,15 +73,15 @@ class ExtensionAppShimHandler : public AppShimHandler,
AppShimHandler::Host* FindHost(Profile* profile, const std::string& app_id);
- static void QuitAppForWindow(ShellWindow* shell_window);
+ static void QuitAppForWindow(AppWindow* app_window);
- static void HideAppForWindow(ShellWindow* shell_window);
+ static void HideAppForWindow(AppWindow* app_window);
- static void FocusAppForWindow(ShellWindow* shell_window);
+ static void FocusAppForWindow(AppWindow* app_window);
// Brings the window to the front without showing it and instructs the shim to
// request user attention. Returns false if there is no shim for this window.
- static bool RequestUserAttentionForWindow(ShellWindow* shell_window);
+ static bool RequestUserAttentionForWindow(AppWindow* app_window);
// AppShimHandler overrides:
virtual void OnShimLaunch(Host* host,
diff --git a/apps/app_shim/extension_app_shim_handler_mac_unittest.cc b/apps/app_shim/extension_app_shim_handler_mac_unittest.cc
index 4e528f3..753bd516 100644
--- a/apps/app_shim/extension_app_shim_handler_mac_unittest.cc
+++ b/apps/app_shim/extension_app_shim_handler_mac_unittest.cc
@@ -18,7 +18,7 @@
namespace apps {
using extensions::Extension;
-typedef ShellWindowRegistry::ShellWindowList ShellWindowList;
+typedef AppWindowRegistry::AppWindowList AppWindowList;
using ::testing::_;
using ::testing::Invoke;
@@ -35,7 +35,7 @@ class MockDelegate : public ExtensionAppShimHandler::Delegate {
void(const base::FilePath&,
base::Callback<void(Profile*)>));
- MOCK_METHOD2(GetWindows, ShellWindowList(Profile*, const std::string&));
+ MOCK_METHOD2(GetWindows, AppWindowList(Profile*, const std::string&));
MOCK_METHOD2(GetAppExtension, const Extension*(Profile*, const std::string&));
MOCK_METHOD3(EnableExtension, void(Profile*,
@@ -175,10 +175,10 @@ class ExtensionAppShimHandlerTest : public testing::Test {
// In most tests, we don't care about the result of GetWindows, it just
// needs to be non-empty.
- ShellWindowList shell_window_list;
- shell_window_list.push_back(static_cast<ShellWindow*>(NULL));
+ AppWindowList app_window_list;
+ app_window_list.push_back(static_cast<AppWindow*>(NULL));
EXPECT_CALL(*delegate_, GetWindows(_, _))
- .WillRepeatedly(Return(shell_window_list));
+ .WillRepeatedly(Return(app_window_list));
EXPECT_CALL(*delegate_, GetAppExtension(_, kTestAppIdA))
.WillRepeatedly(Return(extension_a_.get()));
@@ -302,10 +302,10 @@ TEST_F(ExtensionAppShimHandlerTest, AppLifetime) {
RegisterOnlyLaunch(&host_aa_);
EXPECT_EQ(&host_aa_, handler_->FindHost(&profile_a_, kTestAppIdA));
- // Return no shell windows for OnShimFocus and OnShimQuit.
- ShellWindowList shell_window_list;
+ // Return no app windows for OnShimFocus and OnShimQuit.
+ AppWindowList app_window_list;
EXPECT_CALL(*delegate_, GetWindows(&profile_a_, kTestAppIdA))
- .WillRepeatedly(Return(shell_window_list));
+ .WillRepeatedly(Return(app_window_list));
// Non-reopen focus does nothing.
EXPECT_CALL(*handler_, OnShimFocus(&host_aa_, APP_SHIM_FOCUS_NORMAL, _))
@@ -351,9 +351,9 @@ TEST_F(ExtensionAppShimHandlerTest, MaybeTerminate) {
EXPECT_EQ(&host_ab_, handler_->FindHost(&profile_a_, kTestAppIdB));
// Return empty window list.
- ShellWindowList shell_window_list;
+ AppWindowList app_window_list;
EXPECT_CALL(*delegate_, GetWindows(_, _))
- .WillRepeatedly(Return(shell_window_list));
+ .WillRepeatedly(Return(app_window_list));
// Quitting when there's another shim should not terminate.
EXPECT_CALL(*delegate_, MaybeTerminate())
diff --git a/apps/shell_window.cc b/apps/app_window.cc
index 8bb6262..d13500d 100644
--- a/apps/shell_window.cc
+++ b/apps/app_window.cc
@@ -1,11 +1,11 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "apps/shell_window.h"
+#include "apps/app_window.h"
-#include "apps/shell_window_geometry_cache.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window_geometry_cache.h"
+#include "apps/app_window_registry.h"
#include "apps/ui/native_app_window.h"
#include "base/command_line.h"
#include "base/strings/string_util.h"
@@ -57,26 +57,23 @@ const int kDefaultWidth = 512;
const int kDefaultHeight = 384;
bool IsFullscreen(int fullscreen_types) {
- return fullscreen_types != apps::ShellWindow::FULLSCREEN_TYPE_NONE;
+ return fullscreen_types != apps::AppWindow::FULLSCREEN_TYPE_NONE;
}
} // namespace
namespace apps {
-ShellWindow::SizeConstraints::SizeConstraints()
- : maximum_size_(kUnboundedSize, kUnboundedSize) {
-}
+AppWindow::SizeConstraints::SizeConstraints()
+ : maximum_size_(kUnboundedSize, kUnboundedSize) {}
-ShellWindow::SizeConstraints::SizeConstraints(const gfx::Size& min_size,
- const gfx::Size& max_size)
- : minimum_size_(min_size),
- maximum_size_(max_size) {
-}
+AppWindow::SizeConstraints::SizeConstraints(const gfx::Size& min_size,
+ const gfx::Size& max_size)
+ : minimum_size_(min_size), maximum_size_(max_size) {}
-ShellWindow::SizeConstraints::~SizeConstraints() {}
+AppWindow::SizeConstraints::~SizeConstraints() {}
-gfx::Size ShellWindow::SizeConstraints::ClampSize(gfx::Size size) const {
+gfx::Size AppWindow::SizeConstraints::ClampSize(gfx::Size size) const {
const gfx::Size max_size = GetMaximumSize();
if (max_size.width() != kUnboundedSize)
size.set_width(std::min(size.width(), GetMaximumSize().width()));
@@ -86,62 +83,62 @@ gfx::Size ShellWindow::SizeConstraints::ClampSize(gfx::Size size) const {
return size;
}
-bool ShellWindow::SizeConstraints::HasMinimumSize() const {
+bool AppWindow::SizeConstraints::HasMinimumSize() const {
return GetMinimumSize().width() != kUnboundedSize ||
- GetMinimumSize().height() != kUnboundedSize;
+ GetMinimumSize().height() != kUnboundedSize;
}
-bool ShellWindow::SizeConstraints::HasMaximumSize() const {
+bool AppWindow::SizeConstraints::HasMaximumSize() const {
const gfx::Size max_size = GetMaximumSize();
return max_size.width() != kUnboundedSize ||
- max_size.height() != kUnboundedSize;
+ max_size.height() != kUnboundedSize;
}
-bool ShellWindow::SizeConstraints::HasFixedSize() const {
+bool AppWindow::SizeConstraints::HasFixedSize() const {
return !GetMinimumSize().IsEmpty() && GetMinimumSize() == GetMaximumSize();
}
-gfx::Size ShellWindow::SizeConstraints::GetMinimumSize() const {
+gfx::Size AppWindow::SizeConstraints::GetMinimumSize() const {
return minimum_size_;
}
-gfx::Size ShellWindow::SizeConstraints::GetMaximumSize() const {
+gfx::Size AppWindow::SizeConstraints::GetMaximumSize() const {
return gfx::Size(
- maximum_size_.width() == kUnboundedSize ?
- kUnboundedSize :
- std::max(maximum_size_.width(), minimum_size_.width()),
- maximum_size_.height() == kUnboundedSize ?
- kUnboundedSize :
- std::max(maximum_size_.height(), minimum_size_.height()));
+ maximum_size_.width() == kUnboundedSize
+ ? kUnboundedSize
+ : std::max(maximum_size_.width(), minimum_size_.width()),
+ maximum_size_.height() == kUnboundedSize
+ ? kUnboundedSize
+ : std::max(maximum_size_.height(), minimum_size_.height()));
}
-void ShellWindow::SizeConstraints::set_minimum_size(const gfx::Size& min_size) {
+void AppWindow::SizeConstraints::set_minimum_size(const gfx::Size& min_size) {
minimum_size_ = min_size;
}
-void ShellWindow::SizeConstraints::set_maximum_size(const gfx::Size& max_size) {
+void AppWindow::SizeConstraints::set_maximum_size(const gfx::Size& max_size) {
maximum_size_ = max_size;
}
-ShellWindow::CreateParams::CreateParams()
- : window_type(ShellWindow::WINDOW_TYPE_DEFAULT),
- frame(ShellWindow::FRAME_CHROME),
- transparent_background(false),
- bounds(INT_MIN, INT_MIN, 0, 0),
- creator_process_id(0),
- state(ui::SHOW_STATE_DEFAULT),
- hidden(false),
- resizable(true),
- focused(true),
- always_on_top(false) {}
+AppWindow::CreateParams::CreateParams()
+ : window_type(AppWindow::WINDOW_TYPE_DEFAULT),
+ frame(AppWindow::FRAME_CHROME),
+ transparent_background(false),
+ bounds(INT_MIN, INT_MIN, 0, 0),
+ creator_process_id(0),
+ state(ui::SHOW_STATE_DEFAULT),
+ hidden(false),
+ resizable(true),
+ focused(true),
+ always_on_top(false) {}
-ShellWindow::CreateParams::~CreateParams() {}
+AppWindow::CreateParams::~CreateParams() {}
-ShellWindow::Delegate::~Delegate() {}
+AppWindow::Delegate::~Delegate() {}
-ShellWindow::ShellWindow(BrowserContext* context,
- Delegate* delegate,
- const extensions::Extension* extension)
+AppWindow::AppWindow(BrowserContext* context,
+ Delegate* delegate,
+ const extensions::Extension* extension)
: browser_context_(context),
extension_(extension),
extension_id_(extension->id()),
@@ -158,15 +155,15 @@ ShellWindow::ShellWindow(BrowserContext* context,
<< "Only off the record window may be opened in the guest mode.";
}
-void ShellWindow::Init(const GURL& url,
- ShellWindowContents* shell_window_contents,
- const CreateParams& params) {
+void AppWindow::Init(const GURL& url,
+ AppWindowContents* app_window_contents,
+ const CreateParams& params) {
// Initialize the render interface and web contents
- shell_window_contents_.reset(shell_window_contents);
- shell_window_contents_->Initialize(browser_context(), url);
- WebContents* web_contents = shell_window_contents_->GetWebContents();
+ app_window_contents_.reset(app_window_contents);
+ app_window_contents_->Initialize(browser_context(), url);
+ WebContents* web_contents = app_window_contents_->GetWebContents();
if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableAppsShowOnFirstPaint)) {
+ switches::kEnableAppsShowOnFirstPaint)) {
content::WebContentsObserver::Observe(web_contents);
}
delegate_->InitWebContents(web_contents);
@@ -174,16 +171,16 @@ void ShellWindow::Init(const GURL& url,
extensions::ExtensionWebContentsObserver::CreateForWebContents(web_contents);
web_contents->SetDelegate(this);
- WebContentsModalDialogManager::FromWebContents(web_contents)->
- SetDelegate(this);
+ WebContentsModalDialogManager::FromWebContents(web_contents)
+ ->SetDelegate(this);
extensions::SetViewType(web_contents, extensions::VIEW_TYPE_APP_SHELL);
// Initialize the window
CreateParams new_params = LoadDefaultsAndConstrain(params);
window_type_ = new_params.window_type;
window_key_ = new_params.window_key;
- size_constraints_ = SizeConstraints(new_params.minimum_size,
- new_params.maximum_size);
+ size_constraints_ =
+ SizeConstraints(new_params.minimum_size, new_params.maximum_size);
// Windows cannot be always-on-top in fullscreen mode for security reasons.
cached_always_on_top_ = new_params.always_on_top;
@@ -218,13 +215,14 @@ void ShellWindow::Init(const GURL& url,
content::Source<content::BrowserContext>(
client->GetOriginalContext(browser_context_)));
// Close when the browser process is exiting.
- registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING,
+ registrar_.Add(this,
+ chrome::NOTIFICATION_APP_TERMINATING,
content::NotificationService::AllSources());
- shell_window_contents_->LoadContents(new_params.creator_process_id);
+ app_window_contents_->LoadContents(new_params.creator_process_id);
if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableAppsShowOnFirstPaint)) {
+ switches::kEnableAppsShowOnFirstPaint)) {
// We want to show the window only when the content has been painted. For
// that to happen, we need to define a size for the content, otherwise the
// layout will happen in a 0x0 area.
@@ -237,10 +235,10 @@ void ShellWindow::Init(const GURL& url,
UpdateExtensionAppIcon();
- ShellWindowRegistry::Get(browser_context_)->AddShellWindow(this);
+ AppWindowRegistry::Get(browser_context_)->AddAppWindow(this);
}
-ShellWindow::~ShellWindow() {
+AppWindow::~AppWindow() {
// Unregister now to prevent getting NOTIFICATION_APP_TERMINATING if we're the
// last window open.
registrar_.RemoveAll();
@@ -249,16 +247,16 @@ ShellWindow::~ShellWindow() {
chrome::EndKeepAlive();
}
-void ShellWindow::RequestMediaAccessPermission(
+void AppWindow::RequestMediaAccessPermission(
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
const content::MediaResponseCallback& callback) {
- delegate_->RequestMediaAccessPermission(web_contents, request, callback,
- extension());
+ delegate_->RequestMediaAccessPermission(
+ web_contents, request, callback, extension());
}
-WebContents* ShellWindow::OpenURLFromTab(WebContents* source,
- const content::OpenURLParams& params) {
+WebContents* AppWindow::OpenURLFromTab(WebContents* source,
+ const content::OpenURLParams& params) {
// Don't allow the current tab to be navigated. It would be nice to map all
// anchor tags (even those without target="_blank") to new tabs, but right
// now we can't distinguish between those and <meta> refreshes or window.href
@@ -293,12 +291,12 @@ WebContents* ShellWindow::OpenURLFromTab(WebContents* source,
return contents;
}
-void ShellWindow::AddNewContents(WebContents* source,
- WebContents* new_contents,
- WindowOpenDisposition disposition,
- const gfx::Rect& initial_pos,
- bool user_gesture,
- bool* was_blocked) {
+void AppWindow::AddNewContents(WebContents* source,
+ WebContents* new_contents,
+ WindowOpenDisposition disposition,
+ const gfx::Rect& initial_pos,
+ bool user_gesture,
+ bool* was_blocked) {
DCHECK(new_contents->GetBrowserContext() == browser_context_);
delegate_->AddNewContents(browser_context_,
new_contents,
@@ -308,7 +306,7 @@ void ShellWindow::AddNewContents(WebContents* source,
was_blocked);
}
-bool ShellWindow::PreHandleKeyboardEvent(
+bool AppWindow::PreHandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event,
bool* is_keyboard_shortcut) {
@@ -331,7 +329,7 @@ bool ShellWindow::PreHandleKeyboardEvent(
return false;
}
-void ShellWindow::HandleKeyboardEvent(
+void AppWindow::HandleKeyboardEvent(
WebContents* source,
const content::NativeWebKeyboardEvent& event) {
// If the window is currently fullscreen and not forced, ESC should leave
@@ -347,9 +345,9 @@ void ShellWindow::HandleKeyboardEvent(
native_app_window_->HandleKeyboardEvent(event);
}
-void ShellWindow::RequestToLockMouse(WebContents* web_contents,
- bool user_gesture,
- bool last_unlocked_by_target) {
+void AppWindow::RequestToLockMouse(WebContents* web_contents,
+ bool user_gesture,
+ bool last_unlocked_by_target) {
bool has_permission = IsExtensionWithPermissionOrSuggestInConsole(
APIPermission::kPointerLock,
extension_,
@@ -358,16 +356,15 @@ void ShellWindow::RequestToLockMouse(WebContents* web_contents,
web_contents->GotResponseToLockMouseRequest(has_permission);
}
-bool ShellWindow::PreHandleGestureEvent(
- WebContents* source,
- const blink::WebGestureEvent& event) {
- // Disable pinch zooming in shell windows.
+bool AppWindow::PreHandleGestureEvent(WebContents* source,
+ const blink::WebGestureEvent& event) {
+ // Disable pinch zooming in app windows.
return event.type == blink::WebGestureEvent::GesturePinchBegin ||
- event.type == blink::WebGestureEvent::GesturePinchUpdate ||
- event.type == blink::WebGestureEvent::GesturePinchEnd;
+ event.type == blink::WebGestureEvent::GesturePinchUpdate ||
+ event.type == blink::WebGestureEvent::GesturePinchEnd;
}
-void ShellWindow::DidFirstVisuallyNonEmptyPaint(int32 page_id) {
+void AppWindow::DidFirstVisuallyNonEmptyPaint(int32 page_id) {
first_paint_complete_ = true;
if (show_on_first_paint_) {
DCHECK(delayed_show_type_ == SHOW_ACTIVE ||
@@ -376,74 +373,69 @@ void ShellWindow::DidFirstVisuallyNonEmptyPaint(int32 page_id) {
}
}
-void ShellWindow::OnNativeClose() {
- ShellWindowRegistry::Get(browser_context_)->RemoveShellWindow(this);
- if (shell_window_contents_) {
- WebContents* web_contents = shell_window_contents_->GetWebContents();
- WebContentsModalDialogManager::FromWebContents(web_contents)->
- SetDelegate(NULL);
- shell_window_contents_->NativeWindowClosed();
+void AppWindow::OnNativeClose() {
+ AppWindowRegistry::Get(browser_context_)->RemoveAppWindow(this);
+ if (app_window_contents_) {
+ WebContents* web_contents = app_window_contents_->GetWebContents();
+ WebContentsModalDialogManager::FromWebContents(web_contents)
+ ->SetDelegate(NULL);
+ app_window_contents_->NativeWindowClosed();
}
delete this;
}
-void ShellWindow::OnNativeWindowChanged() {
+void AppWindow::OnNativeWindowChanged() {
SaveWindowPosition();
#if defined(OS_WIN)
- if (native_app_window_ &&
- cached_always_on_top_ &&
- !IsFullscreen(fullscreen_types_) &&
- !native_app_window_->IsMaximized() &&
+ if (native_app_window_ && cached_always_on_top_ &&
+ !IsFullscreen(fullscreen_types_) && !native_app_window_->IsMaximized() &&
!native_app_window_->IsMinimized()) {
UpdateNativeAlwaysOnTop();
}
#endif
- if (shell_window_contents_ && native_app_window_)
- shell_window_contents_->NativeWindowChanged(native_app_window_.get());
+ if (app_window_contents_ && native_app_window_)
+ app_window_contents_->NativeWindowChanged(native_app_window_.get());
}
-void ShellWindow::OnNativeWindowActivated() {
- ShellWindowRegistry::Get(browser_context_)->ShellWindowActivated(this);
+void AppWindow::OnNativeWindowActivated() {
+ AppWindowRegistry::Get(browser_context_)->AppWindowActivated(this);
}
-content::WebContents* ShellWindow::web_contents() const {
- return shell_window_contents_->GetWebContents();
+content::WebContents* AppWindow::web_contents() const {
+ return app_window_contents_->GetWebContents();
}
-NativeAppWindow* ShellWindow::GetBaseWindow() {
- return native_app_window_.get();
-}
+NativeAppWindow* AppWindow::GetBaseWindow() { return native_app_window_.get(); }
-gfx::NativeWindow ShellWindow::GetNativeWindow() {
+gfx::NativeWindow AppWindow::GetNativeWindow() {
return GetBaseWindow()->GetNativeWindow();
}
-gfx::Rect ShellWindow::GetClientBounds() const {
+gfx::Rect AppWindow::GetClientBounds() const {
gfx::Rect bounds = native_app_window_->GetBounds();
bounds.Inset(native_app_window_->GetFrameInsets());
return bounds;
}
-base::string16 ShellWindow::GetTitle() const {
+base::string16 AppWindow::GetTitle() const {
// WebContents::GetTitle() will return the page's URL if there's no <title>
// specified. However, we'd prefer to show the name of the extension in that
// case, so we directly inspect the NavigationEntry's title.
base::string16 title;
- if (!web_contents() ||
- !web_contents()->GetController().GetActiveEntry() ||
+ if (!web_contents() || !web_contents()->GetController().GetActiveEntry() ||
web_contents()->GetController().GetActiveEntry()->GetTitle().empty()) {
title = base::UTF8ToUTF16(extension()->name());
} else {
title = web_contents()->GetTitle();
}
- const base::char16 kBadChars[] = { '\n', 0 };
+ const base::char16 kBadChars[] = {'\n', 0};
base::RemoveChars(title, kBadChars, &title);
return title;
}
-void ShellWindow::SetAppIconUrl(const GURL& url) {
+void AppWindow::SetAppIconUrl(const GURL& url) {
// If the same url is being used for the badge, ignore it.
if (url == badge_icon_url_)
return;
@@ -458,12 +450,12 @@ void ShellWindow::SetAppIconUrl(const GURL& url) {
web_contents()->DownloadImage(
url,
true, // is a favicon
- 0, // no maximum size
- base::Bind(&ShellWindow::DidDownloadFavicon,
+ 0, // no maximum size
+ base::Bind(&AppWindow::DidDownloadFavicon,
image_loader_ptr_factory_.GetWeakPtr()));
}
-void ShellWindow::SetBadgeIconUrl(const GURL& url) {
+void AppWindow::SetBadgeIconUrl(const GURL& url) {
// Avoid using any previous icons that were being downloaded.
image_loader_ptr_factory_.InvalidateWeakPtrs();
@@ -474,35 +466,35 @@ void ShellWindow::SetBadgeIconUrl(const GURL& url) {
web_contents()->DownloadImage(
url,
true, // is a favicon
- 0, // no maximum size
- base::Bind(&ShellWindow::DidDownloadFavicon,
+ 0, // no maximum size
+ base::Bind(&AppWindow::DidDownloadFavicon,
image_loader_ptr_factory_.GetWeakPtr()));
}
-void ShellWindow::ClearBadge() {
+void AppWindow::ClearBadge() {
badge_icon_image_.reset();
badge_icon_url_ = GURL();
UpdateBadgeIcon(gfx::Image());
}
-void ShellWindow::UpdateShape(scoped_ptr<SkRegion> region) {
+void AppWindow::UpdateShape(scoped_ptr<SkRegion> region) {
native_app_window_->UpdateShape(region.Pass());
}
-void ShellWindow::UpdateDraggableRegions(
+void AppWindow::UpdateDraggableRegions(
const std::vector<extensions::DraggableRegion>& regions) {
native_app_window_->UpdateDraggableRegions(regions);
}
-void ShellWindow::UpdateAppIcon(const gfx::Image& image) {
+void AppWindow::UpdateAppIcon(const gfx::Image& image) {
if (image.IsEmpty())
return;
app_icon_ = image;
native_app_window_->UpdateWindowIcon();
- ShellWindowRegistry::Get(browser_context_)->ShellWindowIconChanged(this);
+ AppWindowRegistry::Get(browser_context_)->AppWindowIconChanged(this);
}
-void ShellWindow::Fullscreen() {
+void AppWindow::Fullscreen() {
#if !defined(OS_MACOSX)
// Do not enter fullscreen mode if disallowed by pref.
PrefService* prefs =
@@ -515,15 +507,11 @@ void ShellWindow::Fullscreen() {
SetNativeWindowFullscreen();
}
-void ShellWindow::Maximize() {
- GetBaseWindow()->Maximize();
-}
+void AppWindow::Maximize() { GetBaseWindow()->Maximize(); }
-void ShellWindow::Minimize() {
- GetBaseWindow()->Minimize();
-}
+void AppWindow::Minimize() { GetBaseWindow()->Minimize(); }
-void ShellWindow::Restore() {
+void AppWindow::Restore() {
if (IsFullscreen(fullscreen_types_)) {
fullscreen_types_ = FULLSCREEN_TYPE_NONE;
SetNativeWindowFullscreen();
@@ -532,7 +520,7 @@ void ShellWindow::Restore() {
}
}
-void ShellWindow::OSFullscreen() {
+void AppWindow::OSFullscreen() {
#if !defined(OS_MACOSX)
// Do not enter fullscreen mode if disallowed by pref.
PrefService* prefs =
@@ -545,24 +533,24 @@ void ShellWindow::OSFullscreen() {
SetNativeWindowFullscreen();
}
-void ShellWindow::ForcedFullscreen() {
+void AppWindow::ForcedFullscreen() {
fullscreen_types_ |= FULLSCREEN_TYPE_FORCED;
SetNativeWindowFullscreen();
}
-void ShellWindow::SetMinimumSize(const gfx::Size& min_size) {
+void AppWindow::SetMinimumSize(const gfx::Size& min_size) {
size_constraints_.set_minimum_size(min_size);
OnSizeConstraintsChanged();
}
-void ShellWindow::SetMaximumSize(const gfx::Size& max_size) {
+void AppWindow::SetMaximumSize(const gfx::Size& max_size) {
size_constraints_.set_maximum_size(max_size);
OnSizeConstraintsChanged();
}
-void ShellWindow::Show(ShowType show_type) {
+void AppWindow::Show(ShowType show_type) {
if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableAppsShowOnFirstPaint)) {
+ switches::kEnableAppsShowOnFirstPaint)) {
show_on_first_paint_ = true;
if (!first_paint_complete_) {
@@ -581,7 +569,7 @@ void ShellWindow::Show(ShowType show_type) {
}
}
-void ShellWindow::Hide() {
+void AppWindow::Hide() {
// This is there to prevent race conditions with Hide() being called before
// there was a non-empty paint. It should have no effect in a non-racy
// scenario where the application is hiding then showing a window: the second
@@ -590,7 +578,7 @@ void ShellWindow::Hide() {
GetBaseWindow()->Hide();
}
-void ShellWindow::SetAlwaysOnTop(bool always_on_top) {
+void AppWindow::SetAlwaysOnTop(bool always_on_top) {
if (cached_always_on_top_ == always_on_top)
return;
@@ -605,15 +593,13 @@ void ShellWindow::SetAlwaysOnTop(bool always_on_top) {
OnNativeWindowChanged();
}
-bool ShellWindow::IsAlwaysOnTop() const {
- return cached_always_on_top_;
-}
+bool AppWindow::IsAlwaysOnTop() const { return cached_always_on_top_; }
-void ShellWindow::GetSerializedState(base::DictionaryValue* properties) const {
+void AppWindow::GetSerializedState(base::DictionaryValue* properties) const {
DCHECK(properties);
properties->SetBoolean("fullscreen",
- native_app_window_->IsFullscreenOrPending());
+ native_app_window_->IsFullscreenOrPending());
properties->SetBoolean("minimized", native_app_window_->IsMinimized());
properties->SetBoolean("maximized", native_app_window_->IsMaximized());
properties->SetBoolean("alwaysOnTop", IsAlwaysOnTop());
@@ -641,12 +627,12 @@ void ShellWindow::GetSerializedState(base::DictionaryValue* properties) const {
//------------------------------------------------------------------------------
// Private methods
-void ShellWindow::UpdateBadgeIcon(const gfx::Image& image) {
+void AppWindow::UpdateBadgeIcon(const gfx::Image& image) {
badge_icon_ = image;
native_app_window_->UpdateBadgeIcon();
}
-void ShellWindow::DidDownloadFavicon(
+void AppWindow::DidDownloadFavicon(
int id,
int http_status_code,
const GURL& image_url,
@@ -674,13 +660,13 @@ void ShellWindow::DidDownloadFavicon(
UpdateBadgeIcon(gfx::Image::CreateFrom1xBitmap(largest));
}
-void ShellWindow::OnExtensionIconImageChanged(extensions::IconImage* image) {
+void AppWindow::OnExtensionIconImageChanged(extensions::IconImage* image) {
DCHECK_EQ(app_icon_image_.get(), image);
UpdateAppIcon(gfx::Image(app_icon_image_->image_skia()));
}
-void ShellWindow::UpdateExtensionAppIcon() {
+void AppWindow::UpdateExtensionAppIcon() {
// Avoid using any previous app icons were being downloaded.
image_loader_ptr_factory_.InvalidateWeakPtrs();
@@ -697,7 +683,7 @@ void ShellWindow::UpdateExtensionAppIcon() {
app_icon_image_->image_skia().GetRepresentation(1.0f);
}
-void ShellWindow::OnSizeConstraintsChanged() {
+void AppWindow::OnSizeConstraintsChanged() {
native_app_window_->UpdateWindowMinMaxSize();
gfx::Rect bounds = GetClientBounds();
gfx::Size constrained_size = size_constraints_.ClampSize(bounds.size());
@@ -708,21 +694,22 @@ void ShellWindow::OnSizeConstraintsChanged() {
OnNativeWindowChanged();
}
-void ShellWindow::SetNativeWindowFullscreen() {
+void AppWindow::SetNativeWindowFullscreen() {
native_app_window_->SetFullscreen(fullscreen_types_);
if (cached_always_on_top_)
UpdateNativeAlwaysOnTop();
}
-bool ShellWindow::IntersectsWithTaskbar() const {
+bool AppWindow::IntersectsWithTaskbar() const {
#if defined(OS_WIN)
gfx::Screen* screen = gfx::Screen::GetNativeScreen();
gfx::Rect window_bounds = native_app_window_->GetRestoredBounds();
std::vector<gfx::Display> displays = screen->GetAllDisplays();
for (std::vector<gfx::Display>::const_iterator it = displays.begin();
- it != displays.end(); ++it) {
+ it != displays.end();
+ ++it) {
gfx::Rect taskbar_bounds = it->bounds();
taskbar_bounds.Subtract(it->work_area());
if (taskbar_bounds.IsEmpty())
@@ -736,7 +723,7 @@ bool ShellWindow::IntersectsWithTaskbar() const {
return false;
}
-void ShellWindow::UpdateNativeAlwaysOnTop() {
+void AppWindow::UpdateNativeAlwaysOnTop() {
DCHECK(cached_always_on_top_);
bool is_on_top = native_app_window_->IsAlwaysOnTop();
bool fullscreen = IsFullscreen(fullscreen_types_);
@@ -753,23 +740,21 @@ void ShellWindow::UpdateNativeAlwaysOnTop() {
}
}
-void ShellWindow::CloseContents(WebContents* contents) {
+void AppWindow::CloseContents(WebContents* contents) {
native_app_window_->Close();
}
-bool ShellWindow::ShouldSuppressDialogs() {
- return true;
-}
+bool AppWindow::ShouldSuppressDialogs() { return true; }
-content::ColorChooser* ShellWindow::OpenColorChooser(
- WebContents* web_contents,
- SkColor initial_color,
- const std::vector<content::ColorSuggestion>& suggestionss) {
+content::ColorChooser* AppWindow::OpenColorChooser(
+ WebContents* web_contents,
+ SkColor initial_color,
+ const std::vector<content::ColorSuggestion>& suggestionss) {
return delegate_->ShowColorChooser(web_contents, initial_color);
}
-void ShellWindow::RunFileChooser(WebContents* tab,
- const content::FileChooserParams& params) {
+void AppWindow::RunFileChooser(WebContents* tab,
+ const content::FileChooserParams& params) {
if (window_type_is_panel()) {
// Panels can't host a file dialog, abort. TODO(stevenjb): allow file
// dialogs to be unhosted but still close with the owning web contents.
@@ -781,24 +766,22 @@ void ShellWindow::RunFileChooser(WebContents* tab,
delegate_->RunFileChooser(tab, params);
}
-bool ShellWindow::IsPopupOrPanel(const WebContents* source) const {
- return true;
-}
+bool AppWindow::IsPopupOrPanel(const WebContents* source) const { return true; }
-void ShellWindow::MoveContents(WebContents* source, const gfx::Rect& pos) {
+void AppWindow::MoveContents(WebContents* source, const gfx::Rect& pos) {
native_app_window_->SetBounds(pos);
}
-void ShellWindow::NavigationStateChanged(
- const content::WebContents* source, unsigned changed_flags) {
+void AppWindow::NavigationStateChanged(const content::WebContents* source,
+ unsigned changed_flags) {
if (changed_flags & content::INVALIDATE_TYPE_TITLE)
native_app_window_->UpdateWindowTitle();
else if (changed_flags & content::INVALIDATE_TYPE_TAB)
native_app_window_->UpdateWindowIcon();
}
-void ShellWindow::ToggleFullscreenModeForTab(content::WebContents* source,
- bool enter_fullscreen) {
+void AppWindow::ToggleFullscreenModeForTab(content::WebContents* source,
+ bool enter_fullscreen) {
#if !defined(OS_MACOSX)
// Do not enter fullscreen mode if disallowed by pref.
// TODO(bartfab): Add a test once it becomes possible to simulate a user
@@ -812,9 +795,9 @@ void ShellWindow::ToggleFullscreenModeForTab(content::WebContents* source,
#endif
if (!IsExtensionWithPermissionOrSuggestInConsole(
- APIPermission::kFullscreen,
- extension_,
- source->GetRenderViewHost())) {
+ APIPermission::kFullscreen,
+ extension_,
+ source->GetRenderViewHost())) {
return;
}
@@ -825,19 +808,19 @@ void ShellWindow::ToggleFullscreenModeForTab(content::WebContents* source,
SetNativeWindowFullscreen();
}
-bool ShellWindow::IsFullscreenForTabOrPending(
- const content::WebContents* source) const {
+bool AppWindow::IsFullscreenForTabOrPending(const content::WebContents* source)
+ const {
return ((fullscreen_types_ & FULLSCREEN_TYPE_HTML_API) != 0);
}
-void ShellWindow::Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
+void AppWindow::Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) {
switch (type) {
case chrome::NOTIFICATION_EXTENSION_UNLOADED: {
const extensions::Extension* unloaded_extension =
- content::Details<extensions::UnloadedExtensionInfo>(
- details)->extension;
+ content::Details<extensions::UnloadedExtensionInfo>(details)
+ ->extension;
if (extension_ == unloaded_extension)
native_app_window_->Close();
break;
@@ -850,54 +833,51 @@ void ShellWindow::Observe(int type,
}
}
-void ShellWindow::SetWebContentsBlocked(content::WebContents* web_contents,
- bool blocked) {
+void AppWindow::SetWebContentsBlocked(content::WebContents* web_contents,
+ bool blocked) {
delegate_->SetWebContentsBlocked(web_contents, blocked);
}
-bool ShellWindow::IsWebContentsVisible(content::WebContents* web_contents) {
+bool AppWindow::IsWebContentsVisible(content::WebContents* web_contents) {
return delegate_->IsWebContentsVisible(web_contents);
}
extensions::ActiveTabPermissionGranter*
- ShellWindow::GetActiveTabPermissionGranter() {
- // Shell windows don't support the activeTab permission.
+AppWindow::GetActiveTabPermissionGranter() {
+ // App windows don't support the activeTab permission.
return NULL;
}
-WebContentsModalDialogHost* ShellWindow::GetWebContentsModalDialogHost() {
+WebContentsModalDialogHost* AppWindow::GetWebContentsModalDialogHost() {
return native_app_window_.get();
}
-void ShellWindow::AddMessageToDevToolsConsole(ConsoleMessageLevel level,
- const std::string& message) {
+void AppWindow::AddMessageToDevToolsConsole(ConsoleMessageLevel level,
+ const std::string& message) {
content::RenderViewHost* rvh = web_contents()->GetRenderViewHost();
rvh->Send(new ExtensionMsg_AddMessageToConsole(
rvh->GetRoutingID(), level, message));
}
-void ShellWindow::SaveWindowPosition() {
+void AppWindow::SaveWindowPosition() {
if (window_key_.empty())
return;
if (!native_app_window_)
return;
- ShellWindowGeometryCache* cache =
- ShellWindowGeometryCache::Get(browser_context());
+ AppWindowGeometryCache* cache =
+ AppWindowGeometryCache::Get(browser_context());
gfx::Rect bounds = native_app_window_->GetRestoredBounds();
bounds.Inset(native_app_window_->GetFrameInsets());
gfx::Rect screen_bounds =
gfx::Screen::GetNativeScreen()->GetDisplayMatching(bounds).work_area();
ui::WindowShowState window_state = native_app_window_->GetRestoredState();
- cache->SaveGeometry(extension()->id(),
- window_key_,
- bounds,
- screen_bounds,
- window_state);
+ cache->SaveGeometry(
+ extension()->id(), window_key_, bounds, screen_bounds, window_state);
}
-void ShellWindow::AdjustBoundsToBeVisibleOnScreen(
+void AppWindow::AdjustBoundsToBeVisibleOnScreen(
const gfx::Rect& cached_bounds,
const gfx::Rect& cached_screen_bounds,
const gfx::Rect& current_screen_bounds,
@@ -927,26 +907,28 @@ void ShellWindow::AdjustBoundsToBeVisibleOnScreen(
}
}
-ShellWindow::CreateParams ShellWindow::LoadDefaultsAndConstrain(
- CreateParams params) const {
+AppWindow::CreateParams AppWindow::LoadDefaultsAndConstrain(CreateParams params)
+ const {
if (params.bounds.width() == 0)
params.bounds.set_width(kDefaultWidth);
if (params.bounds.height() == 0)
params.bounds.set_height(kDefaultHeight);
- // If left and top are left undefined, the native shell window will center
+ // If left and top are left undefined, the native app window will center
// the window on the main screen in a platform-defined manner.
// Load cached state if it exists.
if (!params.window_key.empty()) {
- ShellWindowGeometryCache* cache =
- ShellWindowGeometryCache::Get(browser_context());
+ AppWindowGeometryCache* cache =
+ AppWindowGeometryCache::Get(browser_context());
gfx::Rect cached_bounds;
gfx::Rect cached_screen_bounds;
ui::WindowShowState cached_state = ui::SHOW_STATE_DEFAULT;
- if (cache->GetGeometry(extension()->id(), params.window_key,
- &cached_bounds, &cached_screen_bounds,
+ if (cache->GetGeometry(extension()->id(),
+ params.window_key,
+ &cached_bounds,
+ &cached_screen_bounds,
&cached_state)) {
// App window has cached screen bounds, make sure it fits on screen in
// case the screen resolution changed.
@@ -971,12 +953,13 @@ ShellWindow::CreateParams ShellWindow::LoadDefaultsAndConstrain(
}
// static
-SkRegion* ShellWindow::RawDraggableRegionsToSkRegion(
- const std::vector<extensions::DraggableRegion>& regions) {
+SkRegion* AppWindow::RawDraggableRegionsToSkRegion(
+ const std::vector<extensions::DraggableRegion>& regions) {
SkRegion* sk_region = new SkRegion;
for (std::vector<extensions::DraggableRegion>::const_iterator iter =
regions.begin();
- iter != regions.end(); ++iter) {
+ iter != regions.end();
+ ++iter) {
const extensions::DraggableRegion& region = *iter;
sk_region->op(
region.bounds.x(),
diff --git a/apps/shell_window.h b/apps/app_window.h
index 2901376..46933c9 100644
--- a/apps/shell_window.h
+++ b/apps/app_window.h
@@ -1,9 +1,9 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef APPS_SHELL_WINDOW_H_
-#define APPS_SHELL_WINDOW_H_
+#ifndef APPS_APP_WINDOW_H_
+#define APPS_APP_WINDOW_H_
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
@@ -48,14 +48,14 @@ namespace apps {
class NativeAppWindow;
-// Manages the web contents for Shell Windows. The implementation for this
+// Manages the web contents for app windows. The implementation for this
// class should create and maintain the WebContents for the window, and handle
// any message passing between the web contents and the extension system or
// native window.
-class ShellWindowContents {
+class AppWindowContents {
public:
- ShellWindowContents() {}
- virtual ~ShellWindowContents() {}
+ AppWindowContents() {}
+ virtual ~AppWindowContents() {}
// Called to initialize the WebContents, before the app window is created.
virtual void Initialize(content::BrowserContext* context,
@@ -73,28 +73,28 @@ class ShellWindowContents {
virtual content::WebContents* GetWebContents() const = 0;
private:
- DISALLOW_COPY_AND_ASSIGN(ShellWindowContents);
+ DISALLOW_COPY_AND_ASSIGN(AppWindowContents);
};
-// ShellWindow is the type of window used by platform apps. Shell windows
+// AppWindow is the type of window used by platform apps. App windows
// have a WebContents but none of the chrome of normal browser windows.
-class ShellWindow : public content::NotificationObserver,
- public content::WebContentsDelegate,
- public content::WebContentsObserver,
- public web_modal::WebContentsModalDialogManagerDelegate,
- public extensions::ExtensionKeybindingRegistry::Delegate,
- public extensions::IconImage::Observer {
+class AppWindow : public content::NotificationObserver,
+ public content::WebContentsDelegate,
+ public content::WebContentsObserver,
+ public web_modal::WebContentsModalDialogManagerDelegate,
+ public extensions::ExtensionKeybindingRegistry::Delegate,
+ public extensions::IconImage::Observer {
public:
enum WindowType {
- WINDOW_TYPE_DEFAULT = 1 << 0, // Default shell window.
- WINDOW_TYPE_PANEL = 1 << 1, // OS controlled panel window (Ash only).
+ WINDOW_TYPE_DEFAULT = 1 << 0, // Default app window.
+ WINDOW_TYPE_PANEL = 1 << 1, // OS controlled panel window (Ash only).
WINDOW_TYPE_V1_PANEL = 1 << 2, // For apps v1 support in Ash; deprecate
// with v1 apps.
};
enum Frame {
FRAME_CHROME, // Chrome-style window frame.
- FRAME_NONE, // Frameless window.
+ FRAME_NONE, // Frameless window.
};
enum FullscreenType {
@@ -197,7 +197,7 @@ class ShellWindow : public content::NotificationObserver,
// General initialization.
virtual void InitWebContents(content::WebContents* web_contents) = 0;
virtual NativeAppWindow* CreateNativeAppWindow(
- ShellWindow* window,
+ AppWindow* window,
const CreateParams& params) = 0;
// Link handling.
@@ -222,7 +222,7 @@ class ShellWindow : public content::NotificationObserver,
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
const content::MediaResponseCallback& callback,
- const extensions::Extension* extension) = 0;
+ const extensions::Extension* extension) = 0;
virtual int PreferredIconSize() = 0;
// Web contents modal dialog support.
@@ -236,21 +236,20 @@ class ShellWindow : public content::NotificationObserver,
static SkRegion* RawDraggableRegionsToSkRegion(
const std::vector<extensions::DraggableRegion>& regions);
- // The constructor and Init methods are public for constructing a ShellWindow
+ // The constructor and Init methods are public for constructing a AppWindow
// with a non-standard render interface (e.g. v1 apps using Ash Panels).
- // Normally ShellWindow::Create should be used.
- // The constructed shell window takes ownership of |delegate|.
- ShellWindow(content::BrowserContext* context,
- Delegate* delegate,
- const extensions::Extension* extension);
+ // Normally AppWindow::Create should be used.
+ // The constructed app window takes ownership of |delegate|.
+ AppWindow(content::BrowserContext* context,
+ Delegate* delegate,
+ const extensions::Extension* extension);
// Initializes the render interface, web contents, and native window.
- // |shell_window_contents| will become owned by ShellWindow.
+ // |app_window_contents| will become owned by AppWindow.
void Init(const GURL& url,
- ShellWindowContents* shell_window_contents,
+ AppWindowContents* app_window_contents,
const CreateParams& params);
-
const std::string& window_key() const { return window_key_; }
const SessionID& session_id() const { return session_id_; }
const extensions::Extension* extension() const { return extension_; }
@@ -326,10 +325,7 @@ class ShellWindow : public content::NotificationObserver,
void SetMinimumSize(const gfx::Size& min_size);
void SetMaximumSize(const gfx::Size& max_size);
- enum ShowType {
- SHOW_ACTIVE,
- SHOW_INACTIVE
- };
+ enum ShowType { SHOW_ACTIVE, SHOW_INACTIVE };
// Shows the window if its contents have been painted; otherwise flags the
// window to be shown as soon as its contents are painted for the first time.
@@ -339,14 +335,12 @@ class ShellWindow : public content::NotificationObserver,
// first paint, it will be unflagged.
void Hide();
- ShellWindowContents* shell_window_contents_for_test() {
- return shell_window_contents_.get();
+ AppWindowContents* app_window_contents_for_test() {
+ return app_window_contents_.get();
}
// Get the size constraints.
- const SizeConstraints& size_constraints() const {
- return size_constraints_;
- }
+ const SizeConstraints& size_constraints() const { return size_constraints_; }
// Set whether the window should stay above other windows which are not
// configured to be always-on-top.
@@ -362,7 +356,7 @@ class ShellWindow : public content::NotificationObserver,
void GetSerializedState(base::DictionaryValue* properties) const;
protected:
- virtual ~ShellWindow();
+ virtual ~AppWindow();
private:
// PlatformAppBrowserTest needs access to web_contents()
@@ -375,19 +369,19 @@ class ShellWindow : public content::NotificationObserver,
content::WebContents* web_contents,
SkColor color,
const std::vector<content::ColorSuggestion>& suggestions) OVERRIDE;
- virtual void RunFileChooser(
- content::WebContents* tab,
- const content::FileChooserParams& params) OVERRIDE;
- virtual bool IsPopupOrPanel(
- const content::WebContents* source) const OVERRIDE;
- virtual void MoveContents(
- content::WebContents* source, const gfx::Rect& pos) OVERRIDE;
+ virtual void RunFileChooser(content::WebContents* tab,
+ const content::FileChooserParams& params)
+ OVERRIDE;
+ virtual bool IsPopupOrPanel(const content::WebContents* source)
+ const OVERRIDE;
+ virtual void MoveContents(content::WebContents* source,
+ const gfx::Rect& pos) OVERRIDE;
virtual void NavigationStateChanged(const content::WebContents* source,
unsigned changed_flags) OVERRIDE;
virtual void ToggleFullscreenModeForTab(content::WebContents* source,
bool enter_fullscreen) OVERRIDE;
- virtual bool IsFullscreenForTabOrPending(
- const content::WebContents* source) const OVERRIDE;
+ virtual bool IsFullscreenForTabOrPending(const content::WebContents* source)
+ const OVERRIDE;
virtual void RequestMediaAccessPermission(
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
@@ -405,15 +399,15 @@ class ShellWindow : public content::NotificationObserver,
content::WebContents* source,
const content::NativeWebKeyboardEvent& event,
bool* is_keyboard_shortcut) OVERRIDE;
- virtual void HandleKeyboardEvent(
- content::WebContents* source,
- const content::NativeWebKeyboardEvent& event) OVERRIDE;
+ virtual void HandleKeyboardEvent(content::WebContents* source,
+ const content::NativeWebKeyboardEvent& event)
+ OVERRIDE;
virtual void RequestToLockMouse(content::WebContents* web_contents,
bool user_gesture,
bool last_unlocked_by_target) OVERRIDE;
- virtual bool PreHandleGestureEvent(
- content::WebContents* source,
- const blink::WebGestureEvent& event) OVERRIDE;
+ virtual bool PreHandleGestureEvent(content::WebContents* source,
+ const blink::WebGestureEvent& event)
+ OVERRIDE;
// content::WebContentsObserver implementation.
virtual void DidFirstVisuallyNonEmptyPaint(int32 page_id) OVERRIDE;
@@ -426,8 +420,8 @@ class ShellWindow : public content::NotificationObserver,
// web_modal::WebContentsModalDialogManagerDelegate implementation.
virtual void SetWebContentsBlocked(content::WebContents* web_contents,
bool blocked) OVERRIDE;
- virtual bool IsWebContentsVisible(
- content::WebContents* web_contents) OVERRIDE;
+ virtual bool IsWebContentsVisible(content::WebContents* web_contents)
+ OVERRIDE;
// Helper method to add a message to the renderer's DevTools console.
void AddMessageToDevToolsConsole(content::ConsoleMessageLevel level,
@@ -438,12 +432,11 @@ class ShellWindow : public content::NotificationObserver,
// Helper method to adjust the cached bounds so that we can make sure it can
// be visible on the screen. See http://crbug.com/145752 .
- void AdjustBoundsToBeVisibleOnScreen(
- const gfx::Rect& cached_bounds,
- const gfx::Rect& cached_screen_bounds,
- const gfx::Rect& current_screen_bounds,
- const gfx::Size& minimum_size,
- gfx::Rect* bounds) const;
+ void AdjustBoundsToBeVisibleOnScreen(const gfx::Rect& cached_bounds,
+ const gfx::Rect& cached_screen_bounds,
+ const gfx::Rect& current_screen_bounds,
+ const gfx::Size& minimum_size,
+ gfx::Rect* bounds) const;
// Loads the appropriate default or cached window bounds and constrains them
// based on screen size and minimum/maximum size. Returns a new CreateParams
@@ -471,8 +464,8 @@ class ShellWindow : public content::NotificationObserver,
GetActiveTabPermissionGranter() OVERRIDE;
// web_modal::WebContentsModalDialogManagerDelegate implementation.
- virtual web_modal::WebContentsModalDialogHost*
- GetWebContentsModalDialogHost() OVERRIDE;
+ virtual web_modal::WebContentsModalDialogHost* GetWebContentsModalDialogHost()
+ OVERRIDE;
// Updates the badge to |image|. Called internally from the image loader
// callback.
@@ -486,10 +479,10 @@ class ShellWindow : public content::NotificationObserver,
const std::vector<gfx::Size>& original_bitmap_sizes);
// extensions::IconImage::Observer implementation.
- virtual void OnExtensionIconImageChanged(
- extensions::IconImage* image) OVERRIDE;
+ virtual void OnExtensionIconImageChanged(extensions::IconImage* image)
+ OVERRIDE;
- // The browser context with which this window is associated. ShellWindow does
+ // The browser context with which this window is associated. AppWindow does
// not own this object.
content::BrowserContext* browser_context_;
@@ -525,10 +518,10 @@ class ShellWindow : public content::NotificationObserver,
scoped_ptr<extensions::IconImage> badge_icon_image_;
scoped_ptr<NativeAppWindow> native_app_window_;
- scoped_ptr<ShellWindowContents> shell_window_contents_;
+ scoped_ptr<AppWindowContents> app_window_contents_;
scoped_ptr<Delegate> delegate_;
- base::WeakPtrFactory<ShellWindow> image_loader_ptr_factory_;
+ base::WeakPtrFactory<AppWindow> image_loader_ptr_factory_;
// Bit field of FullscreenType.
int fullscreen_types_;
@@ -553,9 +546,9 @@ class ShellWindow : public content::NotificationObserver,
// taskbar.
bool cached_always_on_top_;
- DISALLOW_COPY_AND_ASSIGN(ShellWindow);
+ DISALLOW_COPY_AND_ASSIGN(AppWindow);
};
} // namespace apps
-#endif // APPS_SHELL_WINDOW_H_
+#endif // APPS_APP_WINDOW_H_
diff --git a/apps/app_window_contents.cc b/apps/app_window_contents.cc
index fbe70cc..8fa3c46 100644
--- a/apps/app_window_contents.cc
+++ b/apps/app_window_contents.cc
@@ -21,15 +21,12 @@ namespace app_window = extensions::api::app_window;
namespace apps {
-AppWindowContents::AppWindowContents(ShellWindow* host)
- : host_(host) {
-}
+AppWindowContentsImpl::AppWindowContentsImpl(AppWindow* host) : host_(host) {}
-AppWindowContents::~AppWindowContents() {
-}
+AppWindowContentsImpl::~AppWindowContentsImpl() {}
-void AppWindowContents::Initialize(content::BrowserContext* context,
- const GURL& url) {
+void AppWindowContentsImpl::Initialize(content::BrowserContext* context,
+ const GURL& url) {
url_ = url;
extension_function_dispatcher_.reset(
@@ -45,7 +42,7 @@ void AppWindowContents::Initialize(content::BrowserContext* context,
web_contents_->GetRenderViewHost()->SyncRendererPrefs();
}
-void AppWindowContents::LoadContents(int32 creator_process_id) {
+void AppWindowContentsImpl::LoadContents(int32 creator_process_id) {
// If the new view is in the same process as the creator, block the created
// RVH from loading anything until the background page has had a chance to
// do any initialization it wants. If it's a different process, the new RVH
@@ -54,10 +51,9 @@ void AppWindowContents::LoadContents(int32 creator_process_id) {
creator_process_id) {
SuspendRenderViewHost(web_contents_->GetRenderViewHost());
} else {
- VLOG(1) << "ShellWindow created in new process ("
+ VLOG(1) << "AppWindow created in new process ("
<< web_contents_->GetRenderViewHost()->GetProcess()->GetID()
- << ") != creator (" << creator_process_id
- << "). Routing disabled.";
+ << ") != creator (" << creator_process_id << "). Routing disabled.";
}
// TODO(jeremya): there's a bug where navigating a web contents to an
@@ -76,7 +72,7 @@ void AppWindowContents::LoadContents(int32 creator_process_id) {
registrar_.RemoveAll();
}
-void AppWindowContents::NativeWindowChanged(
+void AppWindowContentsImpl::NativeWindowChanged(
NativeAppWindow* native_app_window) {
base::ListValue args;
base::DictionaryValue* dictionary = new base::DictionaryValue();
@@ -92,16 +88,16 @@ void AppWindowContents::NativeWindowChanged(
false));
}
-void AppWindowContents::NativeWindowClosed() {
+void AppWindowContentsImpl::NativeWindowClosed() {
content::RenderViewHost* rvh = web_contents_->GetRenderViewHost();
rvh->Send(new ExtensionMsg_AppWindowClosed(rvh->GetRoutingID()));
}
-content::WebContents* AppWindowContents::GetWebContents() const {
+content::WebContents* AppWindowContentsImpl::GetWebContents() const {
return web_contents_.get();
}
-void AppWindowContents::Observe(
+void AppWindowContentsImpl::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
@@ -122,9 +118,9 @@ void AppWindowContents::Observe(
}
}
-bool AppWindowContents::OnMessageReceived(const IPC::Message& message) {
+bool AppWindowContentsImpl::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(AppWindowContents, message)
+ IPC_BEGIN_MESSAGE_MAP(AppWindowContentsImpl, message)
IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest)
IPC_MESSAGE_HANDLER(ExtensionHostMsg_UpdateDraggableRegions,
UpdateDraggableRegions)
@@ -134,26 +130,26 @@ bool AppWindowContents::OnMessageReceived(const IPC::Message& message) {
}
extensions::WindowController*
-AppWindowContents::GetExtensionWindowController() const {
+AppWindowContentsImpl::GetExtensionWindowController() const {
return NULL;
}
-content::WebContents* AppWindowContents::GetAssociatedWebContents() const {
+content::WebContents* AppWindowContentsImpl::GetAssociatedWebContents() const {
return web_contents_.get();
}
-void AppWindowContents::OnRequest(
+void AppWindowContentsImpl::OnRequest(
const ExtensionHostMsg_Request_Params& params) {
extension_function_dispatcher_->Dispatch(
params, web_contents_->GetRenderViewHost());
}
-void AppWindowContents::UpdateDraggableRegions(
+void AppWindowContentsImpl::UpdateDraggableRegions(
const std::vector<extensions::DraggableRegion>& regions) {
host_->UpdateDraggableRegions(regions);
}
-void AppWindowContents::SuspendRenderViewHost(
+void AppWindowContentsImpl::SuspendRenderViewHost(
content::RenderViewHost* rvh) {
DCHECK(rvh);
content::BrowserThread::PostTask(
diff --git a/apps/app_window_contents.h b/apps/app_window_contents.h
index ea09f83..b5c691d 100644
--- a/apps/app_window_contents.h
+++ b/apps/app_window_contents.h
@@ -7,7 +7,7 @@
#include <vector>
-#include "apps/shell_window.h"
+#include "apps/app_window.h"
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/extension_function_dispatcher.h"
@@ -26,18 +26,18 @@ struct DraggableRegion;
namespace apps {
-// ShellWindowContents class specific to app windows. It maintains a
+// AppWindowContents class specific to app windows. It maintains a
// WebContents instance and observes it for the purpose of passing
// messages to the extensions system.
-class AppWindowContents : public ShellWindowContents,
- public content::NotificationObserver,
- public content::WebContentsObserver,
- public ExtensionFunctionDispatcher::Delegate {
+class AppWindowContentsImpl : public AppWindowContents,
+ public content::NotificationObserver,
+ public content::WebContentsObserver,
+ public ExtensionFunctionDispatcher::Delegate {
public:
- explicit AppWindowContents(ShellWindow* host);
- virtual ~AppWindowContents();
+ explicit AppWindowContentsImpl(AppWindow* host);
+ virtual ~AppWindowContentsImpl();
- // ShellWindowContents
+ // AppWindowContents
virtual void Initialize(content::BrowserContext* context,
const GURL& url) OVERRIDE;
virtual void LoadContents(int32 creator_process_id) OVERRIDE;
@@ -64,13 +64,13 @@ class AppWindowContents : public ShellWindowContents,
const std::vector<extensions::DraggableRegion>& regions);
void SuspendRenderViewHost(content::RenderViewHost* rvh);
- ShellWindow* host_; // This class is owned by |host_|
+ AppWindow* host_; // This class is owned by |host_|
GURL url_;
content::NotificationRegistrar registrar_;
scoped_ptr<content::WebContents> web_contents_;
scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_;
- DISALLOW_COPY_AND_ASSIGN(AppWindowContents);
+ DISALLOW_COPY_AND_ASSIGN(AppWindowContentsImpl);
};
} // namespace apps
diff --git a/apps/shell_window_geometry_cache.cc b/apps/app_window_geometry_cache.cc
index 09ad3b3..deefc7a 100644
--- a/apps/shell_window_geometry_cache.cc
+++ b/apps/app_window_geometry_cache.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "apps/shell_window_geometry_cache.h"
+#include "apps/app_window_geometry_cache.h"
#include "base/bind.h"
#include "base/stl_util.h"
@@ -24,35 +24,36 @@ namespace {
// StateStore.
const int kSyncTimeoutMilliseconds = 1000;
-} // namespace
+} // namespace
namespace apps {
-ShellWindowGeometryCache::ShellWindowGeometryCache(
- Profile* profile, extensions::ExtensionPrefs* prefs)
+AppWindowGeometryCache::AppWindowGeometryCache(
+ Profile* profile,
+ extensions::ExtensionPrefs* prefs)
: prefs_(prefs),
sync_delay_(base::TimeDelta::FromMilliseconds(kSyncTimeoutMilliseconds)) {
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
+ registrar_.Add(this,
+ chrome::NOTIFICATION_EXTENSION_LOADED,
content::Source<Profile>(profile));
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
+ registrar_.Add(this,
+ chrome::NOTIFICATION_EXTENSION_UNLOADED,
content::Source<Profile>(profile));
}
-ShellWindowGeometryCache::~ShellWindowGeometryCache() {
-}
+AppWindowGeometryCache::~AppWindowGeometryCache() {}
// static
-ShellWindowGeometryCache* ShellWindowGeometryCache::Get(
+AppWindowGeometryCache* AppWindowGeometryCache::Get(
content::BrowserContext* context) {
return Factory::GetForContext(context, true /* create */);
}
-void ShellWindowGeometryCache::SaveGeometry(
- const std::string& extension_id,
- const std::string& window_id,
- const gfx::Rect& bounds,
- const gfx::Rect& screen_bounds,
- ui::WindowShowState window_state) {
+void AppWindowGeometryCache::SaveGeometry(const std::string& extension_id,
+ const std::string& window_id,
+ const gfx::Rect& bounds,
+ const gfx::Rect& screen_bounds,
+ ui::WindowShowState window_state) {
ExtensionData& extension_data = cache_[extension_id];
// If we don't have any unsynced changes and this is a duplicate of what's
@@ -74,9 +75,11 @@ void ShellWindowGeometryCache::SaveGeometry(
ExtensionData::iterator oldest = extension_data.end();
// Too many windows in the cache, find the oldest one to remove.
for (ExtensionData::iterator it = extension_data.begin();
- it != extension_data.end(); ++it) {
+ it != extension_data.end();
+ ++it) {
// Don't expunge the window that was just added.
- if (it->first == window_id) continue;
+ if (it->first == window_id)
+ continue;
// If time is in the future, reset it to now to minimize weirdness.
if (it->second.last_change > now)
@@ -94,21 +97,25 @@ void ShellWindowGeometryCache::SaveGeometry(
// We don't use Reset() because the timer may not yet be running.
// (In that case Stop() is a no-op.)
sync_timer_.Stop();
- sync_timer_.Start(FROM_HERE, sync_delay_, this,
- &ShellWindowGeometryCache::SyncToStorage);
+ sync_timer_.Start(
+ FROM_HERE, sync_delay_, this, &AppWindowGeometryCache::SyncToStorage);
}
-void ShellWindowGeometryCache::SyncToStorage() {
+void AppWindowGeometryCache::SyncToStorage() {
std::set<std::string> tosync;
tosync.swap(unsynced_extensions_);
for (std::set<std::string>::const_iterator it = tosync.begin(),
- eit = tosync.end(); it != eit; ++it) {
+ eit = tosync.end();
+ it != eit;
+ ++it) {
const std::string& extension_id = *it;
const ExtensionData& extension_data = cache_[extension_id];
scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
for (ExtensionData::const_iterator it = extension_data.begin(),
- eit = extension_data.end(); it != eit; ++it) {
+ eit = extension_data.end();
+ it != eit;
+ ++it) {
base::DictionaryValue* value = new base::DictionaryValue;
const gfx::Rect& bounds = it->second.bounds;
const gfx::Rect& screen_bounds = it->second.screen_bounds;
@@ -129,24 +136,23 @@ void ShellWindowGeometryCache::SyncToStorage() {
dict->SetWithoutPathExpansion(it->first, value);
FOR_EACH_OBSERVER(
- Observer,
- observers_,
- OnGeometryCacheChanged(extension_id, it->first, bounds));
+ Observer,
+ observers_,
+ OnGeometryCacheChanged(extension_id, it->first, bounds));
}
prefs_->SetGeometryCache(extension_id, dict.Pass());
}
}
-bool ShellWindowGeometryCache::GetGeometry(
- const std::string& extension_id,
- const std::string& window_id,
- gfx::Rect* bounds,
- gfx::Rect* screen_bounds,
- ui::WindowShowState* window_state) {
+bool AppWindowGeometryCache::GetGeometry(const std::string& extension_id,
+ const std::string& window_id,
+ gfx::Rect* bounds,
+ gfx::Rect* screen_bounds,
+ ui::WindowShowState* window_state) {
- std::map<std::string, ExtensionData>::const_iterator
- extension_data_it = cache_.find(extension_id);
+ std::map<std::string, ExtensionData>::const_iterator extension_data_it =
+ cache_.find(extension_id);
// Not in the map means loading data for the extension didn't finish yet or
// the cache was not constructed until after the extension was loaded.
@@ -157,8 +163,8 @@ bool ShellWindowGeometryCache::GetGeometry(
DCHECK(extension_data_it != cache_.end());
}
- ExtensionData::const_iterator window_data_it = extension_data_it->second.find(
- window_id);
+ ExtensionData::const_iterator window_data_it =
+ extension_data_it->second.find(window_id);
if (window_data_it == extension_data_it->second.end())
return false;
@@ -180,20 +186,16 @@ bool ShellWindowGeometryCache::GetGeometry(
return true;
}
-void ShellWindowGeometryCache::Shutdown() {
- SyncToStorage();
-}
+void AppWindowGeometryCache::Shutdown() { SyncToStorage(); }
+AppWindowGeometryCache::WindowData::WindowData()
+ : window_state(ui::SHOW_STATE_DEFAULT) {}
-ShellWindowGeometryCache::WindowData::WindowData()
- : window_state(ui::SHOW_STATE_DEFAULT) {
-}
+AppWindowGeometryCache::WindowData::~WindowData() {}
-ShellWindowGeometryCache::WindowData::~WindowData() {
-}
-
-void ShellWindowGeometryCache::Observe(
- int type, const content::NotificationSource& source,
+void AppWindowGeometryCache::Observe(
+ int type,
+ const content::NotificationSource& source,
const content::NotificationDetails& details) {
switch (type) {
case chrome::NOTIFICATION_EXTENSION_LOADED: {
@@ -204,8 +206,9 @@ void ShellWindowGeometryCache::Observe(
}
case chrome::NOTIFICATION_EXTENSION_UNLOADED: {
std::string extension_id =
- content::Details<const extensions::UnloadedExtensionInfo>(details).
- ptr()->extension->id();
+ content::Details<const extensions::UnloadedExtensionInfo>(details)
+ .ptr()
+ ->extension->id();
OnExtensionUnloaded(extension_id);
break;
}
@@ -215,11 +218,11 @@ void ShellWindowGeometryCache::Observe(
}
}
-void ShellWindowGeometryCache::SetSyncDelayForTests(int timeout_ms) {
+void AppWindowGeometryCache::SetSyncDelayForTests(int timeout_ms) {
sync_delay_ = base::TimeDelta::FromMilliseconds(timeout_ms);
}
-void ShellWindowGeometryCache::LoadGeometryFromStorage(
+void AppWindowGeometryCache::LoadGeometryFromStorage(
const std::string& extension_id) {
ExtensionData& extension_data = cache_[extension_id];
@@ -258,8 +261,7 @@ void ShellWindowGeometryCache::LoadGeometryFromStorage(
if (stored_window->GetInteger("screen_bounds_h", &i))
window_data.screen_bounds.set_height(i);
if (stored_window->GetInteger("state", &i)) {
- window_data.window_state =
- static_cast<ui::WindowShowState>(i);
+ window_data.window_state = static_cast<ui::WindowShowState>(i);
}
std::string ts_as_string;
if (stored_window->GetString("ts", &ts_as_string)) {
@@ -273,7 +275,7 @@ void ShellWindowGeometryCache::LoadGeometryFromStorage(
}
}
-void ShellWindowGeometryCache::OnExtensionUnloaded(
+void AppWindowGeometryCache::OnExtensionUnloaded(
const std::string& extension_id) {
SyncToStorage();
cache_.erase(extension_id);
@@ -283,53 +285,52 @@ void ShellWindowGeometryCache::OnExtensionUnloaded(
// Factory boilerplate
// static
-ShellWindowGeometryCache* ShellWindowGeometryCache::Factory::GetForContext(
- content::BrowserContext* context, bool create) {
- return static_cast<ShellWindowGeometryCache*>(
+AppWindowGeometryCache* AppWindowGeometryCache::Factory::GetForContext(
+ content::BrowserContext* context,
+ bool create) {
+ return static_cast<AppWindowGeometryCache*>(
GetInstance()->GetServiceForBrowserContext(context, create));
}
-ShellWindowGeometryCache::Factory*
-ShellWindowGeometryCache::Factory::GetInstance() {
- return Singleton<ShellWindowGeometryCache::Factory>::get();
+AppWindowGeometryCache::Factory*
+AppWindowGeometryCache::Factory::GetInstance() {
+ return Singleton<AppWindowGeometryCache::Factory>::get();
}
-ShellWindowGeometryCache::Factory::Factory()
+AppWindowGeometryCache::Factory::Factory()
: BrowserContextKeyedServiceFactory(
- "ShellWindowGeometryCache",
- BrowserContextDependencyManager::GetInstance()) {
+ "AppWindowGeometryCache",
+ BrowserContextDependencyManager::GetInstance()) {
DependsOn(extensions::ExtensionPrefsFactory::GetInstance());
}
-ShellWindowGeometryCache::Factory::~Factory() {
-}
+AppWindowGeometryCache::Factory::~Factory() {}
BrowserContextKeyedService*
-ShellWindowGeometryCache::Factory::BuildServiceInstanceFor(
+AppWindowGeometryCache::Factory::BuildServiceInstanceFor(
content::BrowserContext* context) const {
Profile* profile = Profile::FromBrowserContext(context);
- return new ShellWindowGeometryCache(
- profile,
- extensions::ExtensionPrefs::Get(profile));
+ return new AppWindowGeometryCache(profile,
+ extensions::ExtensionPrefs::Get(profile));
}
-bool ShellWindowGeometryCache::Factory::ServiceIsNULLWhileTesting() const {
+bool AppWindowGeometryCache::Factory::ServiceIsNULLWhileTesting() const {
return false;
}
content::BrowserContext*
-ShellWindowGeometryCache::Factory::GetBrowserContextToUse(
+AppWindowGeometryCache::Factory::GetBrowserContextToUse(
content::BrowserContext* context) const {
- return extensions::ExtensionsBrowserClient::Get()->
- GetOriginalContext(context);
+ return extensions::ExtensionsBrowserClient::Get()->GetOriginalContext(
+ context);
}
-void ShellWindowGeometryCache::AddObserver(Observer* observer) {
+void AppWindowGeometryCache::AddObserver(Observer* observer) {
observers_.AddObserver(observer);
}
-void ShellWindowGeometryCache::RemoveObserver(Observer* observer) {
+void AppWindowGeometryCache::RemoveObserver(Observer* observer) {
observers_.RemoveObserver(observer);
}
-} // namespace apps
+} // namespace apps
diff --git a/apps/shell_window_geometry_cache.h b/apps/app_window_geometry_cache.h
index 6af1886..372be6d 100644
--- a/apps/shell_window_geometry_cache.h
+++ b/apps/app_window_geometry_cache.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_EXTENSIONS_SHELL_WINDOW_GEOMETRY_CACHE_H_
-#define CHROME_BROWSER_EXTENSIONS_SHELL_WINDOW_GEOMETRY_CACHE_H_
+#ifndef APPS_APP_WINDOW_GEOMETRY_CACHE_H_
+#define APPS_APP_WINDOW_GEOMETRY_CACHE_H_
#include <map>
#include <set>
@@ -30,20 +30,20 @@ class ExtensionPrefs;
namespace apps {
-// A cache for persisted geometry of shell windows, both to not have to wait
+// A cache for persisted geometry of app windows, both to not have to wait
// for IO when creating a new window, and to not cause IO on every window
// geometry change.
-class ShellWindowGeometryCache
- : public BrowserContextKeyedService,
- public content::NotificationObserver {
+class AppWindowGeometryCache : public BrowserContextKeyedService,
+ public content::NotificationObserver {
public:
class Factory : public BrowserContextKeyedServiceFactory {
public:
- static ShellWindowGeometryCache* GetForContext(
+ static AppWindowGeometryCache* GetForContext(
content::BrowserContext* context,
bool create);
static Factory* GetInstance();
+
private:
friend struct DefaultSingletonTraits<Factory>;
@@ -68,13 +68,12 @@ class ShellWindowGeometryCache
virtual ~Observer() {};
};
- ShellWindowGeometryCache(Profile* profile,
- extensions::ExtensionPrefs* prefs);
+ AppWindowGeometryCache(Profile* profile, extensions::ExtensionPrefs* prefs);
- virtual ~ShellWindowGeometryCache();
+ virtual ~AppWindowGeometryCache();
// Returns the instance for the given browsing context.
- static ShellWindowGeometryCache* Get(content::BrowserContext* context);
+ static AppWindowGeometryCache* Get(content::BrowserContext* context);
// Save the geometry and state associated with |extension_id| and |window_id|.
void SaveGeometry(const std::string& extension_id,
@@ -102,7 +101,7 @@ class ShellWindowGeometryCache
static const size_t kMaxCachedWindows = 100;
protected:
- friend class ShellWindowGeometryCacheTest;
+ friend class AppWindowGeometryCacheTest;
// For tests, this modifies the timeout delay for saving changes from calls
// to SaveGeometry. (Note that even if this is set to 0, you still need to
@@ -142,7 +141,7 @@ class ShellWindowGeometryCache
std::set<std::string> unsynced_extensions_;
// The timer used to save the data
- base::OneShotTimer<ShellWindowGeometryCache> sync_timer_;
+ base::OneShotTimer<AppWindowGeometryCache> sync_timer_;
// The timeout value we'll use for |sync_timer_|.
base::TimeDelta sync_delay_;
@@ -153,4 +152,4 @@ class ShellWindowGeometryCache
} // namespace apps
-#endif // CHROME_BROWSER_EXTENSIONS_SHELL_WINDOW_GEOMETRY_CACHE_H_
+#endif // APPS_APP_WINDOW_GEOMETRY_CACHE_H_
diff --git a/apps/shell_window_geometry_cache_unittest.cc b/apps/app_window_geometry_cache_unittest.cc
index 2b6d15c..deda109 100644
--- a/apps/shell_window_geometry_cache_unittest.cc
+++ b/apps/app_window_geometry_cache_unittest.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "apps/shell_window_geometry_cache.h"
+#include "apps/app_window_geometry_cache.h"
#include "base/memory/scoped_ptr.h"
#include "base/prefs/mock_pref_change_callback.h"
#include "base/strings/string_number_conversions.h"
@@ -21,22 +21,21 @@ using content::BrowserThread;
namespace apps {
// Base class for tests.
-class ShellWindowGeometryCacheTest : public testing::Test {
+class AppWindowGeometryCacheTest : public testing::Test {
public:
- ShellWindowGeometryCacheTest() :
- ui_thread_(BrowserThread::UI, &ui_message_loop_) {
+ AppWindowGeometryCacheTest()
+ : ui_thread_(BrowserThread::UI, &ui_message_loop_) {
prefs_.reset(new extensions::TestExtensionPrefs(
ui_message_loop_.message_loop_proxy().get()));
- cache_.reset(new ShellWindowGeometryCache(&profile_, prefs_->prefs()));
+ cache_.reset(new AppWindowGeometryCache(&profile_, prefs_->prefs()));
cache_->SetSyncDelayForTests(0);
}
- void AddGeometryAndLoadExtension(
- const std::string& extension_id,
- const std::string& window_id,
- const gfx::Rect& bounds,
- const gfx::Rect& screen_bounds,
- ui::WindowShowState state);
+ void AddGeometryAndLoadExtension(const std::string& extension_id,
+ const std::string& window_id,
+ const gfx::Rect& bounds,
+ const gfx::Rect& screen_bounds,
+ ui::WindowShowState state);
// Spins the UI threads' message loops to make sure any task
// posted to sync the geometry to the value store gets a chance to run.
@@ -50,10 +49,10 @@ class ShellWindowGeometryCacheTest : public testing::Test {
base::MessageLoopForUI ui_message_loop_;
content::TestBrowserThread ui_thread_;
scoped_ptr<extensions::TestExtensionPrefs> prefs_;
- scoped_ptr<ShellWindowGeometryCache> cache_;
+ scoped_ptr<AppWindowGeometryCache> cache_;
};
-void ShellWindowGeometryCacheTest::AddGeometryAndLoadExtension(
+void AppWindowGeometryCacheTest::AddGeometryAndLoadExtension(
const std::string& extension_id,
const std::string& window_id,
const gfx::Rect& bounds,
@@ -75,33 +74,34 @@ void ShellWindowGeometryCacheTest::AddGeometryAndLoadExtension(
LoadExtension(extension_id);
}
-void ShellWindowGeometryCacheTest::WaitForSync() {
+void AppWindowGeometryCacheTest::WaitForSync() {
content::RunAllPendingInMessageLoop();
}
-void ShellWindowGeometryCacheTest::LoadExtension(
+void AppWindowGeometryCacheTest::LoadExtension(
const std::string& extension_id) {
cache_->LoadGeometryFromStorage(extension_id);
WaitForSync();
}
-void ShellWindowGeometryCacheTest::UnloadExtension(
+void AppWindowGeometryCacheTest::UnloadExtension(
const std::string& extension_id) {
cache_->OnExtensionUnloaded(extension_id);
WaitForSync();
}
// Test getting geometry from an empty store.
-TEST_F(ShellWindowGeometryCacheTest, GetGeometryEmptyStore) {
+TEST_F(AppWindowGeometryCacheTest, GetGeometryEmptyStore) {
const std::string extension_id = prefs_->AddExtensionAndReturnId("ext1");
ASSERT_FALSE(cache_->GetGeometry(extension_id, kWindowId, NULL, NULL, NULL));
}
// Test getting geometry for an unknown extension.
-TEST_F(ShellWindowGeometryCacheTest, GetGeometryUnkownExtension) {
+TEST_F(AppWindowGeometryCacheTest, GetGeometryUnkownExtension) {
const std::string extension_id1 = prefs_->AddExtensionAndReturnId("ext1");
const std::string extension_id2 = prefs_->AddExtensionAndReturnId("ext2");
- AddGeometryAndLoadExtension(extension_id1, kWindowId,
+ AddGeometryAndLoadExtension(extension_id1,
+ kWindowId,
gfx::Rect(4, 5, 31, 43),
gfx::Rect(0, 0, 1600, 900),
ui::SHOW_STATE_NORMAL);
@@ -109,9 +109,10 @@ TEST_F(ShellWindowGeometryCacheTest, GetGeometryUnkownExtension) {
}
// Test getting geometry for an unknown window in a known extension.
-TEST_F(ShellWindowGeometryCacheTest, GetGeometryUnkownWindow) {
+TEST_F(AppWindowGeometryCacheTest, GetGeometryUnkownWindow) {
const std::string extension_id = prefs_->AddExtensionAndReturnId("ext1");
- AddGeometryAndLoadExtension(extension_id, kWindowId,
+ AddGeometryAndLoadExtension(extension_id,
+ kWindowId,
gfx::Rect(4, 5, 31, 43),
gfx::Rect(0, 0, 1600, 900),
ui::SHOW_STATE_NORMAL);
@@ -120,13 +121,13 @@ TEST_F(ShellWindowGeometryCacheTest, GetGeometryUnkownWindow) {
// Test that loading geometry, screen_bounds and state from the store works
// correctly.
-TEST_F(ShellWindowGeometryCacheTest, GetGeometryAndStateFromStore) {
+TEST_F(AppWindowGeometryCacheTest, GetGeometryAndStateFromStore) {
const std::string extension_id = prefs_->AddExtensionAndReturnId("ext1");
gfx::Rect bounds(4, 5, 31, 43);
gfx::Rect screen_bounds(0, 0, 1600, 900);
ui::WindowShowState state = ui::SHOW_STATE_NORMAL;
- AddGeometryAndLoadExtension(extension_id, kWindowId, bounds,
- screen_bounds, state);
+ AddGeometryAndLoadExtension(
+ extension_id, kWindowId, bounds, screen_bounds, state);
gfx::Rect new_bounds;
gfx::Rect new_screen_bounds;
ui::WindowShowState new_state = ui::SHOW_STATE_DEFAULT;
@@ -138,13 +139,13 @@ TEST_F(ShellWindowGeometryCacheTest, GetGeometryAndStateFromStore) {
}
// Test corrupt bounds will not be loaded.
-TEST_F(ShellWindowGeometryCacheTest, CorruptBounds) {
+TEST_F(AppWindowGeometryCacheTest, CorruptBounds) {
const std::string extension_id = prefs_->AddExtensionAndReturnId("ext1");
gfx::Rect bounds;
gfx::Rect screen_bounds(0, 0, 1600, 900);
ui::WindowShowState state = ui::SHOW_STATE_NORMAL;
- AddGeometryAndLoadExtension(extension_id, kWindowId, bounds,
- screen_bounds, state);
+ AddGeometryAndLoadExtension(
+ extension_id, kWindowId, bounds, screen_bounds, state);
gfx::Rect new_bounds;
gfx::Rect new_screen_bounds;
ui::WindowShowState new_state = ui::SHOW_STATE_DEFAULT;
@@ -156,13 +157,13 @@ TEST_F(ShellWindowGeometryCacheTest, CorruptBounds) {
}
// Test corrupt screen bounds will not be loaded.
-TEST_F(ShellWindowGeometryCacheTest, CorruptScreenBounds) {
+TEST_F(AppWindowGeometryCacheTest, CorruptScreenBounds) {
const std::string extension_id = prefs_->AddExtensionAndReturnId("ext1");
gfx::Rect bounds(4, 5, 31, 43);
gfx::Rect screen_bounds;
ui::WindowShowState state = ui::SHOW_STATE_NORMAL;
- AddGeometryAndLoadExtension(extension_id, kWindowId, bounds,
- screen_bounds, state);
+ AddGeometryAndLoadExtension(
+ extension_id, kWindowId, bounds, screen_bounds, state);
gfx::Rect new_bounds;
gfx::Rect new_screen_bounds;
ui::WindowShowState new_state = ui::SHOW_STATE_DEFAULT;
@@ -174,13 +175,13 @@ TEST_F(ShellWindowGeometryCacheTest, CorruptScreenBounds) {
}
// Test corrupt state will not be loaded.
-TEST_F(ShellWindowGeometryCacheTest, CorruptState) {
+TEST_F(AppWindowGeometryCacheTest, CorruptState) {
const std::string extension_id = prefs_->AddExtensionAndReturnId("ext1");
gfx::Rect bounds(4, 5, 31, 43);
gfx::Rect screen_bounds(0, 0, 1600, 900);
ui::WindowShowState state = ui::SHOW_STATE_DEFAULT;
- AddGeometryAndLoadExtension(extension_id, kWindowId, bounds,
- screen_bounds, state);
+ AddGeometryAndLoadExtension(
+ extension_id, kWindowId, bounds, screen_bounds, state);
gfx::Rect new_bounds;
gfx::Rect new_screen_bounds;
ui::WindowShowState new_state = ui::SHOW_STATE_DEFAULT;
@@ -193,7 +194,7 @@ TEST_F(ShellWindowGeometryCacheTest, CorruptState) {
// Test saving geometry, screen_bounds and state to the cache and state store,
// and reading it back.
-TEST_F(ShellWindowGeometryCacheTest, SaveGeometryAndStateToStore) {
+TEST_F(AppWindowGeometryCacheTest, SaveGeometryAndStateToStore) {
const std::string extension_id = prefs_->AddExtensionAndReturnId("ext1");
const std::string window_id(kWindowId);
@@ -257,7 +258,7 @@ TEST_F(ShellWindowGeometryCacheTest, SaveGeometryAndStateToStore) {
// Tests that we won't do writes to the state store for SaveGeometry calls
// which don't change the state we already have.
-TEST_F(ShellWindowGeometryCacheTest, NoDuplicateWrites) {
+TEST_F(AppWindowGeometryCacheTest, NoDuplicateWrites) {
using testing::_;
using testing::Mock;
@@ -277,62 +278,68 @@ TEST_F(ShellWindowGeometryCacheTest, NoDuplicateWrites) {
// Write the first bounds - it should do > 0 writes.
EXPECT_CALL(observer, OnPreferenceChanged(_));
- cache_->SaveGeometry(extension_id, kWindowId, bounds1,
- screen_bounds1, ui::SHOW_STATE_NORMAL);
+ cache_->SaveGeometry(
+ extension_id, kWindowId, bounds1, screen_bounds1, ui::SHOW_STATE_NORMAL);
WaitForSync();
Mock::VerifyAndClearExpectations(&observer);
// Write a different bounds - it should also do > 0 writes.
EXPECT_CALL(observer, OnPreferenceChanged(_));
- cache_->SaveGeometry(extension_id, kWindowId, bounds2,
- screen_bounds1, ui::SHOW_STATE_NORMAL);
+ cache_->SaveGeometry(
+ extension_id, kWindowId, bounds2, screen_bounds1, ui::SHOW_STATE_NORMAL);
WaitForSync();
Mock::VerifyAndClearExpectations(&observer);
// Write a different screen bounds - it should also do > 0 writes.
EXPECT_CALL(observer, OnPreferenceChanged(_));
- cache_->SaveGeometry(extension_id, kWindowId, bounds2,
- screen_bounds2, ui::SHOW_STATE_NORMAL);
+ cache_->SaveGeometry(
+ extension_id, kWindowId, bounds2, screen_bounds2, ui::SHOW_STATE_NORMAL);
WaitForSync();
Mock::VerifyAndClearExpectations(&observer);
// Write a different state - it should also do > 0 writes.
EXPECT_CALL(observer, OnPreferenceChanged(_));
- cache_->SaveGeometry(extension_id, kWindowId, bounds2,
- screen_bounds2, ui::SHOW_STATE_MAXIMIZED);
+ cache_->SaveGeometry(extension_id,
+ kWindowId,
+ bounds2,
+ screen_bounds2,
+ ui::SHOW_STATE_MAXIMIZED);
WaitForSync();
Mock::VerifyAndClearExpectations(&observer);
// Write a bounds, screen bounds and state that's a duplicate of what we
// already have. This should not do any writes.
EXPECT_CALL(observer, OnPreferenceChanged(_)).Times(0);
- cache_->SaveGeometry(extension_id, kWindowId, bounds2_duplicate,
- screen_bounds2_duplicate, ui::SHOW_STATE_MAXIMIZED);
+ cache_->SaveGeometry(extension_id,
+ kWindowId,
+ bounds2_duplicate,
+ screen_bounds2_duplicate,
+ ui::SHOW_STATE_MAXIMIZED);
WaitForSync();
Mock::VerifyAndClearExpectations(&observer);
}
// Tests that no more than kMaxCachedWindows windows will be cached.
-TEST_F(ShellWindowGeometryCacheTest, MaxWindows) {
+TEST_F(AppWindowGeometryCacheTest, MaxWindows) {
const std::string extension_id = prefs_->AddExtensionAndReturnId("ext1");
// inform cache of extension
LoadExtension(extension_id);
gfx::Rect bounds(4, 5, 31, 43);
gfx::Rect screen_bounds(0, 0, 1600, 900);
- for (size_t i = 0; i < ShellWindowGeometryCache::kMaxCachedWindows + 1; ++i) {
+ for (size_t i = 0; i < AppWindowGeometryCache::kMaxCachedWindows + 1; ++i) {
std::string window_id = "window_" + base::IntToString(i);
- cache_->SaveGeometry(extension_id, window_id, bounds,
- screen_bounds, ui::SHOW_STATE_NORMAL);
+ cache_->SaveGeometry(
+ extension_id, window_id, bounds, screen_bounds, ui::SHOW_STATE_NORMAL);
}
// The first added window should no longer have cached geometry.
EXPECT_FALSE(cache_->GetGeometry(extension_id, "window_0", NULL, NULL, NULL));
// All other windows should still exist.
- for (size_t i = 1; i < ShellWindowGeometryCache::kMaxCachedWindows + 1; ++i) {
+ for (size_t i = 1; i < AppWindowGeometryCache::kMaxCachedWindows + 1; ++i) {
std::string window_id = "window_" + base::IntToString(i);
EXPECT_TRUE(cache_->GetGeometry(extension_id, window_id, NULL, NULL, NULL));
}
}
-} // namespace extensions
+} // namespace extensions
diff --git a/apps/shell_window_interactive_uitest.cc b/apps/app_window_interactive_uitest.cc
index 69f5563..69d30f9 100644
--- a/apps/shell_window_interactive_uitest.cc
+++ b/apps/app_window_interactive_uitest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,17 +13,18 @@ namespace apps {
namespace {
+// TODO(jamescook): Move this to app_window/generic. http://crbug.com/344073
const char kDefaultTestApp[] = "shell_window/generic";
-class ShellWindowTest : public PlatformAppBrowserTest {
+class AppWindowTest : public PlatformAppBrowserTest {
protected:
// Load the test app and create a window. The window must be closed by the
// caller in order to terminate the test.
// |app_path| is the name of the test.
// |window_create_options| are the options that will be passed to
// chrome.app.window.create() in the test app.
- ShellWindow* OpenWindow(const char* app_path,
- const char* window_create_options) {
+ AppWindow* OpenWindow(const char* app_path,
+ const char* window_create_options) {
ExtensionTestMessageListener launched_listener("launched", true);
ExtensionTestMessageListener loaded_listener("window_loaded", false);
@@ -38,12 +39,12 @@ class ShellWindowTest : public PlatformAppBrowserTest {
// Wait for the window to be opened and loaded.
EXPECT_TRUE(loaded_listener.WaitUntilSatisfied());
- EXPECT_EQ(1U, GetShellWindowCount());
- ShellWindow* shell_window = GetFirstShellWindow();
- return shell_window;
+ EXPECT_EQ(1U, GetAppWindowCount());
+ AppWindow* app_window = GetFirstAppWindow();
+ return app_window;
}
- void CheckAlwaysOnTopToFullscreen(ShellWindow* window) {
+ void CheckAlwaysOnTopToFullscreen(AppWindow* window) {
ASSERT_TRUE(window->GetBaseWindow()->IsAlwaysOnTop());
// The always-on-top property should be temporarily disabled when the window
@@ -59,7 +60,7 @@ class ShellWindowTest : public PlatformAppBrowserTest {
EXPECT_TRUE(window->GetBaseWindow()->IsAlwaysOnTop());
}
- void CheckNormalToFullscreen(ShellWindow* window) {
+ void CheckNormalToFullscreen(AppWindow* window) {
// If the always-on-top property is false, it should remain this way when
// entering and exiting fullscreen mode.
ASSERT_FALSE(window->GetBaseWindow()->IsAlwaysOnTop());
@@ -69,7 +70,7 @@ class ShellWindowTest : public PlatformAppBrowserTest {
EXPECT_FALSE(window->GetBaseWindow()->IsAlwaysOnTop());
}
- void CheckFullscreenToAlwaysOnTop(ShellWindow* window) {
+ void CheckFullscreenToAlwaysOnTop(AppWindow* window) {
ASSERT_TRUE(window->GetBaseWindow()->IsFullscreenOrPending());
// Now enable always-on-top at runtime and ensure the property does not get
@@ -98,36 +99,35 @@ class ShellWindowTest : public PlatformAppBrowserTest {
// Tests a window created with always-on-top enabled and ensures that the
// property is temporarily switched off when entering fullscreen mode.
-IN_PROC_BROWSER_TEST_F(ShellWindowTest, MAYBE_InitAlwaysOnTopToFullscreen) {
- ShellWindow* window = OpenWindow(
- kDefaultTestApp, "{ \"alwaysOnTop\": true }");
+IN_PROC_BROWSER_TEST_F(AppWindowTest, MAYBE_InitAlwaysOnTopToFullscreen) {
+ AppWindow* window = OpenWindow(kDefaultTestApp, "{ \"alwaysOnTop\": true }");
ASSERT_TRUE(window);
CheckAlwaysOnTopToFullscreen(window);
window->SetAlwaysOnTop(false);
CheckNormalToFullscreen(window);
- CloseShellWindow(window);
+ CloseAppWindow(window);
}
#if defined(OS_MACOSX)
-#define MAYBE_RuntimeAlwaysOnTopToFullscreen DISABLED_RuntimeAlwaysOnTopToFullscreen
+#define MAYBE_RuntimeAlwaysOnTopToFullscreen \
+ DISABLED_RuntimeAlwaysOnTopToFullscreen
#else
#define MAYBE_RuntimeAlwaysOnTopToFullscreen RuntimeAlwaysOnTopToFullscreen
#endif
// Tests a window with always-on-top enabled at runtime and ensures that the
// property is temporarily switched off when entering fullscreen mode.
-IN_PROC_BROWSER_TEST_F(ShellWindowTest, MAYBE_RuntimeAlwaysOnTopToFullscreen) {
- ShellWindow* window = OpenWindow(
- kDefaultTestApp, "{}");
+IN_PROC_BROWSER_TEST_F(AppWindowTest, MAYBE_RuntimeAlwaysOnTopToFullscreen) {
+ AppWindow* window = OpenWindow(kDefaultTestApp, "{}");
ASSERT_TRUE(window);
CheckNormalToFullscreen(window);
window->SetAlwaysOnTop(true);
CheckAlwaysOnTopToFullscreen(window);
- CloseShellWindow(window);
+ CloseAppWindow(window);
}
#if defined(OS_MACOSX)
@@ -138,32 +138,32 @@ IN_PROC_BROWSER_TEST_F(ShellWindowTest, MAYBE_RuntimeAlwaysOnTopToFullscreen) {
// Tests a window created initially in fullscreen mode and ensures that the
// always-on-top property does not get applied until it exits fullscreen.
-IN_PROC_BROWSER_TEST_F(ShellWindowTest, MAYBE_InitFullscreenToAlwaysOnTop) {
- ShellWindow* window = OpenWindow(
- kDefaultTestApp, "{ \"state\": \"fullscreen\" }");
+IN_PROC_BROWSER_TEST_F(AppWindowTest, MAYBE_InitFullscreenToAlwaysOnTop) {
+ AppWindow* window =
+ OpenWindow(kDefaultTestApp, "{ \"state\": \"fullscreen\" }");
ASSERT_TRUE(window);
CheckFullscreenToAlwaysOnTop(window);
- CloseShellWindow(window);
+ CloseAppWindow(window);
}
#if defined(OS_MACOSX)
-#define MAYBE_RuntimeFullscreenToAlwaysOnTop DISABLED_RuntimeFullscreenToAlwaysOnTop
+#define MAYBE_RuntimeFullscreenToAlwaysOnTop \
+ DISABLED_RuntimeFullscreenToAlwaysOnTop
#else
#define MAYBE_RuntimeFullscreenToAlwaysOnTop RuntimeFullscreenToAlwaysOnTop
#endif
// Tests a window that enters fullscreen mode at runtime and ensures that the
// always-on-top property does not get applied until it exits fullscreen.
-IN_PROC_BROWSER_TEST_F(ShellWindowTest, MAYBE_RuntimeFullscreenToAlwaysOnTop) {
- ShellWindow* window = OpenWindow(
- kDefaultTestApp, "{}");
+IN_PROC_BROWSER_TEST_F(AppWindowTest, MAYBE_RuntimeFullscreenToAlwaysOnTop) {
+ AppWindow* window = OpenWindow(kDefaultTestApp, "{}");
ASSERT_TRUE(window);
window->Fullscreen();
CheckFullscreenToAlwaysOnTop(window);
- CloseShellWindow(window);
+ CloseAppWindow(window);
}
#if defined(OS_MACOSX)
@@ -174,8 +174,8 @@ IN_PROC_BROWSER_TEST_F(ShellWindowTest, MAYBE_RuntimeFullscreenToAlwaysOnTop) {
// Tests a window created with both fullscreen and always-on-top enabled. Ensure
// that always-on-top is only applied when the window exits fullscreen.
-IN_PROC_BROWSER_TEST_F(ShellWindowTest, MAYBE_InitFullscreenAndAlwaysOnTop) {
- ShellWindow* window = OpenWindow(
+IN_PROC_BROWSER_TEST_F(AppWindowTest, MAYBE_InitFullscreenAndAlwaysOnTop) {
+ AppWindow* window = OpenWindow(
kDefaultTestApp, "{ \"alwaysOnTop\": true, \"state\": \"fullscreen\" }");
ASSERT_TRUE(window);
@@ -188,11 +188,12 @@ IN_PROC_BROWSER_TEST_F(ShellWindowTest, MAYBE_InitFullscreenAndAlwaysOnTop) {
window->Restore();
EXPECT_TRUE(window->GetBaseWindow()->IsAlwaysOnTop());
- CloseShellWindow(window);
+ CloseAppWindow(window);
}
#if defined(OS_MACOSX)
-#define MAYBE_DisableAlwaysOnTopInFullscreen DISABLED_DisableAlwaysOnTopInFullscreen
+#define MAYBE_DisableAlwaysOnTopInFullscreen \
+ DISABLED_DisableAlwaysOnTopInFullscreen
#else
#define MAYBE_DisableAlwaysOnTopInFullscreen DisableAlwaysOnTopInFullscreen
#endif
@@ -200,9 +201,8 @@ IN_PROC_BROWSER_TEST_F(ShellWindowTest, MAYBE_InitFullscreenAndAlwaysOnTop) {
// Tests a window created with always-on-top enabled, but then disabled while
// in fullscreen mode. After exiting fullscreen, always-on-top should remain
// disabled.
-IN_PROC_BROWSER_TEST_F(ShellWindowTest, MAYBE_DisableAlwaysOnTopInFullscreen) {
- ShellWindow* window = OpenWindow(
- kDefaultTestApp, "{ \"alwaysOnTop\": true }");
+IN_PROC_BROWSER_TEST_F(AppWindowTest, MAYBE_DisableAlwaysOnTopInFullscreen) {
+ AppWindow* window = OpenWindow(kDefaultTestApp, "{ \"alwaysOnTop\": true }");
ASSERT_TRUE(window);
// Disable always-on-top while in fullscreen mode.
@@ -215,7 +215,7 @@ IN_PROC_BROWSER_TEST_F(ShellWindowTest, MAYBE_DisableAlwaysOnTopInFullscreen) {
window->Restore();
EXPECT_FALSE(window->GetBaseWindow()->IsAlwaysOnTop());
- CloseShellWindow(window);
+ CloseAppWindow(window);
}
} // namespace apps
diff --git a/apps/app_window_registry.cc b/apps/app_window_registry.cc
new file mode 100644
index 0000000..42b9465
--- /dev/null
+++ b/apps/app_window_registry.cc
@@ -0,0 +1,307 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
+#include "apps/apps_client.h"
+#include "apps/ui/native_app_window.h"
+#include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
+#include "content/public/browser/browser_context.h"
+#include "content/public/browser/devtools_agent_host.h"
+#include "content/public/browser/devtools_manager.h"
+#include "content/public/browser/render_process_host.h"
+#include "content/public/browser/render_view_host.h"
+#include "content/public/browser/site_instance.h"
+#include "content/public/browser/web_contents.h"
+#include "extensions/browser/extensions_browser_client.h"
+#include "extensions/common/extension.h"
+
+namespace {
+
+// Create a key that identifies a AppWindow in a RenderViewHost across App
+// reloads. If the window was given an id in CreateParams, the key is the
+// extension id, a colon separator, and the AppWindow's |id|. If there is no
+// |id|, the chrome-extension://extension-id/page.html URL will be used. If the
+// RenderViewHost is not for a AppWindow, return an empty string.
+std::string GetWindowKeyForRenderViewHost(
+ const apps::AppWindowRegistry* registry,
+ content::RenderViewHost* render_view_host) {
+ apps::AppWindow* app_window =
+ registry->GetAppWindowForRenderViewHost(render_view_host);
+ if (!app_window)
+ return std::string(); // Not a AppWindow.
+
+ if (app_window->window_key().empty())
+ return app_window->web_contents()->GetURL().possibly_invalid_spec();
+
+ std::string key = app_window->extension()->id();
+ key += ':';
+ key += app_window->window_key();
+ return key;
+}
+
+} // namespace
+
+namespace apps {
+
+AppWindowRegistry::AppWindowRegistry(content::BrowserContext* context)
+ : context_(context),
+ devtools_callback_(base::Bind(&AppWindowRegistry::OnDevToolsStateChanged,
+ base::Unretained(this))) {
+ content::DevToolsManager::GetInstance()->AddAgentStateCallback(
+ devtools_callback_);
+}
+
+AppWindowRegistry::~AppWindowRegistry() {
+ content::DevToolsManager::GetInstance()->RemoveAgentStateCallback(
+ devtools_callback_);
+}
+
+// static
+AppWindowRegistry* AppWindowRegistry::Get(content::BrowserContext* context) {
+ return Factory::GetForBrowserContext(context, true /* create */);
+}
+
+void AppWindowRegistry::AddAppWindow(AppWindow* app_window) {
+ BringToFront(app_window);
+ FOR_EACH_OBSERVER(Observer, observers_, OnAppWindowAdded(app_window));
+}
+
+void AppWindowRegistry::AppWindowIconChanged(AppWindow* app_window) {
+ AddAppWindowToList(app_window);
+ FOR_EACH_OBSERVER(Observer, observers_, OnAppWindowIconChanged(app_window));
+}
+
+void AppWindowRegistry::AppWindowActivated(AppWindow* app_window) {
+ BringToFront(app_window);
+}
+
+void AppWindowRegistry::RemoveAppWindow(AppWindow* app_window) {
+ const AppWindowList::iterator it =
+ std::find(app_windows_.begin(), app_windows_.end(), app_window);
+ if (it != app_windows_.end())
+ app_windows_.erase(it);
+ FOR_EACH_OBSERVER(Observer, observers_, OnAppWindowRemoved(app_window));
+}
+
+void AppWindowRegistry::AddObserver(Observer* observer) {
+ observers_.AddObserver(observer);
+}
+
+void AppWindowRegistry::RemoveObserver(Observer* observer) {
+ observers_.RemoveObserver(observer);
+}
+
+AppWindowRegistry::AppWindowList AppWindowRegistry::GetAppWindowsForApp(
+ const std::string& app_id) const {
+ AppWindowList app_windows;
+ for (AppWindowList::const_iterator i = app_windows_.begin();
+ i != app_windows_.end();
+ ++i) {
+ if ((*i)->extension_id() == app_id)
+ app_windows.push_back(*i);
+ }
+ return app_windows;
+}
+
+void AppWindowRegistry::CloseAllAppWindowsForApp(const std::string& app_id) {
+ for (AppWindowList::const_iterator i = app_windows_.begin();
+ i != app_windows_.end();) {
+ AppWindow* app_window = *(i++);
+ if (app_window->extension_id() == app_id)
+ app_window->GetBaseWindow()->Close();
+ }
+}
+
+AppWindow* AppWindowRegistry::GetAppWindowForRenderViewHost(
+ content::RenderViewHost* render_view_host) const {
+ for (AppWindowList::const_iterator i = app_windows_.begin();
+ i != app_windows_.end();
+ ++i) {
+ if ((*i)->web_contents()->GetRenderViewHost() == render_view_host)
+ return *i;
+ }
+
+ return NULL;
+}
+
+AppWindow* AppWindowRegistry::GetAppWindowForNativeWindow(
+ gfx::NativeWindow window) const {
+ for (AppWindowList::const_iterator i = app_windows_.begin();
+ i != app_windows_.end();
+ ++i) {
+ if ((*i)->GetNativeWindow() == window)
+ return *i;
+ }
+
+ return NULL;
+}
+
+AppWindow* AppWindowRegistry::GetCurrentAppWindowForApp(
+ const std::string& app_id) const {
+ AppWindow* result = NULL;
+ for (AppWindowList::const_iterator i = app_windows_.begin();
+ i != app_windows_.end();
+ ++i) {
+ if ((*i)->extension()->id() == app_id) {
+ result = *i;
+ if (result->GetBaseWindow()->IsActive())
+ return result;
+ }
+ }
+
+ return result;
+}
+
+AppWindow* AppWindowRegistry::GetAppWindowForAppAndKey(
+ const std::string& app_id,
+ const std::string& window_key) const {
+ AppWindow* result = NULL;
+ for (AppWindowList::const_iterator i = app_windows_.begin();
+ i != app_windows_.end();
+ ++i) {
+ if ((*i)->extension()->id() == app_id && (*i)->window_key() == window_key) {
+ result = *i;
+ if (result->GetBaseWindow()->IsActive())
+ return result;
+ }
+ }
+ return result;
+}
+
+bool AppWindowRegistry::HadDevToolsAttached(
+ content::RenderViewHost* render_view_host) const {
+ std::string key = GetWindowKeyForRenderViewHost(this, render_view_host);
+ return key.empty() ? false : inspected_windows_.count(key) != 0;
+}
+
+// static
+AppWindow* AppWindowRegistry::GetAppWindowForNativeWindowAnyProfile(
+ gfx::NativeWindow window) {
+ std::vector<content::BrowserContext*> contexts =
+ AppsClient::Get()->GetLoadedBrowserContexts();
+ for (std::vector<content::BrowserContext*>::const_iterator i =
+ contexts.begin();
+ i != contexts.end();
+ ++i) {
+ AppWindowRegistry* registry =
+ Factory::GetForBrowserContext(*i, false /* create */);
+ if (!registry)
+ continue;
+
+ AppWindow* app_window = registry->GetAppWindowForNativeWindow(window);
+ if (app_window)
+ return app_window;
+ }
+
+ return NULL;
+}
+
+// static
+bool AppWindowRegistry::IsAppWindowRegisteredInAnyProfile(
+ int window_type_mask) {
+ std::vector<content::BrowserContext*> contexts =
+ AppsClient::Get()->GetLoadedBrowserContexts();
+ for (std::vector<content::BrowserContext*>::const_iterator i =
+ contexts.begin();
+ i != contexts.end();
+ ++i) {
+ AppWindowRegistry* registry =
+ Factory::GetForBrowserContext(*i, false /* create */);
+ if (!registry)
+ continue;
+
+ const AppWindowList& app_windows = registry->app_windows();
+ if (app_windows.empty())
+ continue;
+
+ if (window_type_mask == 0)
+ return true;
+
+ for (const_iterator j = app_windows.begin(); j != app_windows.end(); ++j) {
+ if ((*j)->window_type() & window_type_mask)
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void AppWindowRegistry::OnDevToolsStateChanged(
+ content::DevToolsAgentHost* agent_host,
+ bool attached) {
+ content::RenderViewHost* rvh = agent_host->GetRenderViewHost();
+ // Ignore unrelated notifications.
+ if (!rvh ||
+ rvh->GetSiteInstance()->GetProcess()->GetBrowserContext() != context_)
+ return;
+
+ std::string key = GetWindowKeyForRenderViewHost(this, rvh);
+ if (key.empty())
+ return;
+
+ if (attached)
+ inspected_windows_.insert(key);
+ else
+ inspected_windows_.erase(key);
+}
+
+void AppWindowRegistry::AddAppWindowToList(AppWindow* app_window) {
+ const AppWindowList::iterator it =
+ std::find(app_windows_.begin(), app_windows_.end(), app_window);
+ if (it != app_windows_.end())
+ return;
+ app_windows_.push_back(app_window);
+}
+
+void AppWindowRegistry::BringToFront(AppWindow* app_window) {
+ const AppWindowList::iterator it =
+ std::find(app_windows_.begin(), app_windows_.end(), app_window);
+ if (it != app_windows_.end())
+ app_windows_.erase(it);
+ app_windows_.push_front(app_window);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Factory boilerplate
+
+// static
+AppWindowRegistry* AppWindowRegistry::Factory::GetForBrowserContext(
+ content::BrowserContext* context,
+ bool create) {
+ return static_cast<AppWindowRegistry*>(
+ GetInstance()->GetServiceForBrowserContext(context, create));
+}
+
+AppWindowRegistry::Factory* AppWindowRegistry::Factory::GetInstance() {
+ return Singleton<AppWindowRegistry::Factory>::get();
+}
+
+AppWindowRegistry::Factory::Factory()
+ : BrowserContextKeyedServiceFactory(
+ "AppWindowRegistry",
+ BrowserContextDependencyManager::GetInstance()) {}
+
+AppWindowRegistry::Factory::~Factory() {}
+
+BrowserContextKeyedService* AppWindowRegistry::Factory::BuildServiceInstanceFor(
+ content::BrowserContext* context) const {
+ return new AppWindowRegistry(context);
+}
+
+bool AppWindowRegistry::Factory::ServiceIsCreatedWithBrowserContext() const {
+ return true;
+}
+
+bool AppWindowRegistry::Factory::ServiceIsNULLWhileTesting() const {
+ return false;
+}
+
+content::BrowserContext* AppWindowRegistry::Factory::GetBrowserContextToUse(
+ content::BrowserContext* context) const {
+ return extensions::ExtensionsBrowserClient::Get()->GetOriginalContext(
+ context);
+}
+
+} // namespace extensions
diff --git a/apps/app_window_registry.h b/apps/app_window_registry.h
new file mode 100644
index 0000000..2a3dfa5
--- /dev/null
+++ b/apps/app_window_registry.h
@@ -0,0 +1,147 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef APPS_APP_WINDOW_REGISTRY_H_
+#define APPS_APP_WINDOW_REGISTRY_H_
+
+#include <list>
+
+#include "base/callback.h"
+#include "base/compiler_specific.h"
+#include "base/memory/singleton.h"
+#include "base/observer_list.h"
+#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
+#include "components/browser_context_keyed_service/browser_context_keyed_service_factory.h"
+#include "ui/gfx/native_widget_types.h"
+
+namespace content {
+class BrowserContext;
+class DevToolsAgentHost;
+class RenderViewHost;
+}
+
+namespace apps {
+
+class AppWindow;
+
+// The AppWindowRegistry tracks the AppWindows for all platform apps for a
+// particular browser context.
+class AppWindowRegistry : public BrowserContextKeyedService {
+ public:
+ class Observer {
+ public:
+ // Called just after a app window was added.
+ virtual void OnAppWindowAdded(apps::AppWindow* app_window) = 0;
+ // Called when the window icon changes.
+ virtual void OnAppWindowIconChanged(apps::AppWindow* app_window) = 0;
+ // Called just after a app window was removed.
+ virtual void OnAppWindowRemoved(apps::AppWindow* app_window) = 0;
+
+ protected:
+ virtual ~Observer() {}
+ };
+
+ typedef std::list<apps::AppWindow*> AppWindowList;
+ typedef AppWindowList::const_iterator const_iterator;
+ typedef std::set<std::string> InspectedWindowSet;
+
+ explicit AppWindowRegistry(content::BrowserContext* context);
+ virtual ~AppWindowRegistry();
+
+ // Returns the instance for the given browser context, or NULL if none. This
+ // is a convenience wrapper around
+ // AppWindowRegistry::Factory::GetForBrowserContext().
+ static AppWindowRegistry* Get(content::BrowserContext* context);
+
+ void AddAppWindow(apps::AppWindow* app_window);
+ void AppWindowIconChanged(apps::AppWindow* app_window);
+ // Called by |app_window| when it is activated.
+ void AppWindowActivated(apps::AppWindow* app_window);
+ void RemoveAppWindow(apps::AppWindow* app_window);
+
+ void AddObserver(Observer* observer);
+ void RemoveObserver(Observer* observer);
+
+ // Returns a set of windows owned by the application identified by app_id.
+ AppWindowList GetAppWindowsForApp(const std::string& app_id) const;
+ const AppWindowList& app_windows() const { return app_windows_; }
+
+ // Close all app windows associated with an app.
+ void CloseAllAppWindowsForApp(const std::string& app_id);
+
+ // Helper functions to find app windows with particular attributes.
+ apps::AppWindow* GetAppWindowForRenderViewHost(
+ content::RenderViewHost* render_view_host) const;
+ apps::AppWindow* GetAppWindowForNativeWindow(gfx::NativeWindow window) const;
+ // Returns an app window for the given app, or NULL if no app windows are
+ // open. If there is a window for the given app that is active, that one will
+ // be returned, otherwise an arbitrary window will be returned.
+ apps::AppWindow* GetCurrentAppWindowForApp(const std::string& app_id) const;
+ // Returns an app window for the given app and window key, or NULL if no app
+ // window with the key are open. If there is a window for the given app and
+ // key that is active, that one will be returned, otherwise an arbitrary
+ // window will be returned.
+ apps::AppWindow* GetAppWindowForAppAndKey(const std::string& app_id,
+ const std::string& window_key)
+ const;
+
+ // Returns whether a AppWindow's ID was last known to have a DevToolsAgent
+ // attached to it, which should be restored during a reload of a corresponding
+ // newly created |render_view_host|.
+ bool HadDevToolsAttached(content::RenderViewHost* render_view_host) const;
+
+ // Returns the app window for |window|, looking in all browser contexts.
+ static apps::AppWindow* GetAppWindowForNativeWindowAnyProfile(
+ gfx::NativeWindow window);
+
+ // Returns true if the number of app windows registered across all browser
+ // contexts is non-zero. |window_type_mask| is a bitwise OR filter of
+ // AppWindow::WindowType, or 0 for any window type.
+ static bool IsAppWindowRegisteredInAnyProfile(int window_type_mask);
+
+ class Factory : public BrowserContextKeyedServiceFactory {
+ public:
+ static AppWindowRegistry* GetForBrowserContext(
+ content::BrowserContext* context,
+ bool create);
+
+ static Factory* GetInstance();
+
+ private:
+ friend struct DefaultSingletonTraits<Factory>;
+
+ Factory();
+ virtual ~Factory();
+
+ // BrowserContextKeyedServiceFactory
+ virtual BrowserContextKeyedService* BuildServiceInstanceFor(
+ content::BrowserContext* context) const OVERRIDE;
+ virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE;
+ virtual bool ServiceIsNULLWhileTesting() const OVERRIDE;
+ virtual content::BrowserContext* GetBrowserContextToUse(
+ content::BrowserContext* context) const OVERRIDE;
+ };
+
+ protected:
+ void OnDevToolsStateChanged(content::DevToolsAgentHost*, bool attached);
+
+ private:
+ // Ensures the specified |app_window| is included in |app_windows_|.
+ // Otherwise adds |app_window| to the back of |app_windows_|.
+ void AddAppWindowToList(apps::AppWindow* app_window);
+
+ // Bring |app_window| to the front of |app_windows_|. If it is not in the
+ // list, add it first.
+ void BringToFront(apps::AppWindow* app_window);
+
+ content::BrowserContext* context_;
+ AppWindowList app_windows_;
+ InspectedWindowSet inspected_windows_;
+ ObserverList<Observer> observers_;
+ base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_;
+};
+
+} // namespace extensions
+
+#endif // APPS_APP_WINDOW_REGISTRY_H_
diff --git a/apps/apps.gypi b/apps/apps.gypi
index da93f13..78dcd5f 100644
--- a/apps/apps.gypi
+++ b/apps/apps.gypi
@@ -39,8 +39,14 @@
'app_restore_service.h',
'app_restore_service_factory.cc',
'app_restore_service_factory.h',
+ 'app_window.cc',
+ 'app_window.h',
'app_window_contents.cc',
'app_window_contents.h',
+ 'app_window_geometry_cache.cc',
+ 'app_window_geometry_cache.h',
+ 'app_window_registry.cc',
+ 'app_window_registry.h',
'apps_client.cc',
'apps_client.h',
'launcher.cc',
@@ -54,17 +60,11 @@
'saved_files_service.h',
'saved_files_service_factory.cc',
'saved_files_service_factory.h',
- 'shell_window.cc',
- 'shell_window.h',
- 'shell_window_geometry_cache.cc',
- 'shell_window_geometry_cache.h',
- 'shell_window_registry.cc',
- 'shell_window_registry.h',
'switches.cc',
'switches.h',
'ui/native_app_window.h',
- 'ui/views/shell_window_frame_view.cc',
- 'ui/views/shell_window_frame_view.h',
+ 'ui/views/app_window_frame_view.cc',
+ 'ui/views/app_window_frame_view.h',
],
'conditions': [
['chromeos==1',
diff --git a/apps/shell_window_registry.cc b/apps/shell_window_registry.cc
deleted file mode 100644
index 093263b..0000000
--- a/apps/shell_window_registry.cc
+++ /dev/null
@@ -1,309 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "apps/apps_client.h"
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
-#include "apps/ui/native_app_window.h"
-#include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
-#include "content/public/browser/browser_context.h"
-#include "content/public/browser/devtools_agent_host.h"
-#include "content/public/browser/devtools_manager.h"
-#include "content/public/browser/render_process_host.h"
-#include "content/public/browser/render_view_host.h"
-#include "content/public/browser/site_instance.h"
-#include "content/public/browser/web_contents.h"
-#include "extensions/browser/extensions_browser_client.h"
-#include "extensions/common/extension.h"
-
-namespace {
-
-// Create a key that identifies a ShellWindow in a RenderViewHost across App
-// reloads. If the window was given an id in CreateParams, the key is the
-// extension id, a colon separator, and the ShellWindow's |id|. If there is no
-// |id|, the chrome-extension://extension-id/page.html URL will be used. If the
-// RenderViewHost is not for a ShellWindow, return an empty string.
-std::string GetWindowKeyForRenderViewHost(
- const apps::ShellWindowRegistry* registry,
- content::RenderViewHost* render_view_host) {
- apps::ShellWindow* shell_window =
- registry->GetShellWindowForRenderViewHost(render_view_host);
- if (!shell_window)
- return std::string(); // Not a ShellWindow.
-
- if (shell_window->window_key().empty())
- return shell_window->web_contents()->GetURL().possibly_invalid_spec();
-
- std::string key = shell_window->extension()->id();
- key += ':';
- key += shell_window->window_key();
- return key;
-}
-
-} // namespace
-
-namespace apps {
-
-ShellWindowRegistry::ShellWindowRegistry(content::BrowserContext* context)
- : context_(context),
- devtools_callback_(base::Bind(
- &ShellWindowRegistry::OnDevToolsStateChanged,
- base::Unretained(this))) {
- content::DevToolsManager::GetInstance()->AddAgentStateCallback(
- devtools_callback_);
-}
-
-ShellWindowRegistry::~ShellWindowRegistry() {
- content::DevToolsManager::GetInstance()->RemoveAgentStateCallback(
- devtools_callback_);
-}
-
-// static
-ShellWindowRegistry* ShellWindowRegistry::Get(
- content::BrowserContext* context) {
- return Factory::GetForBrowserContext(context, true /* create */);
-}
-
-void ShellWindowRegistry::AddShellWindow(ShellWindow* shell_window) {
- BringToFront(shell_window);
- FOR_EACH_OBSERVER(Observer, observers_, OnShellWindowAdded(shell_window));
-}
-
-void ShellWindowRegistry::ShellWindowIconChanged(ShellWindow* shell_window) {
- AddShellWindowToList(shell_window);
- FOR_EACH_OBSERVER(Observer, observers_,
- OnShellWindowIconChanged(shell_window));
-}
-
-void ShellWindowRegistry::ShellWindowActivated(ShellWindow* shell_window) {
- BringToFront(shell_window);
-}
-
-void ShellWindowRegistry::RemoveShellWindow(ShellWindow* shell_window) {
- const ShellWindowList::iterator it = std::find(shell_windows_.begin(),
- shell_windows_.end(),
- shell_window);
- if (it != shell_windows_.end())
- shell_windows_.erase(it);
- FOR_EACH_OBSERVER(Observer, observers_, OnShellWindowRemoved(shell_window));
-}
-
-void ShellWindowRegistry::AddObserver(Observer* observer) {
- observers_.AddObserver(observer);
-}
-
-void ShellWindowRegistry::RemoveObserver(Observer* observer) {
- observers_.RemoveObserver(observer);
-}
-
-ShellWindowRegistry::ShellWindowList ShellWindowRegistry::GetShellWindowsForApp(
- const std::string& app_id) const {
- ShellWindowList app_windows;
- for (ShellWindowList::const_iterator i = shell_windows_.begin();
- i != shell_windows_.end(); ++i) {
- if ((*i)->extension_id() == app_id)
- app_windows.push_back(*i);
- }
- return app_windows;
-}
-
-void ShellWindowRegistry::CloseAllShellWindowsForApp(
- const std::string& app_id) {
- for (ShellWindowList::const_iterator i = shell_windows_.begin();
- i != shell_windows_.end(); ) {
- ShellWindow* shell_window = *(i++);
- if (shell_window->extension_id() == app_id)
- shell_window->GetBaseWindow()->Close();
- }
-}
-
-ShellWindow* ShellWindowRegistry::GetShellWindowForRenderViewHost(
- content::RenderViewHost* render_view_host) const {
- for (ShellWindowList::const_iterator i = shell_windows_.begin();
- i != shell_windows_.end(); ++i) {
- if ((*i)->web_contents()->GetRenderViewHost() == render_view_host)
- return *i;
- }
-
- return NULL;
-}
-
-ShellWindow* ShellWindowRegistry::GetShellWindowForNativeWindow(
- gfx::NativeWindow window) const {
- for (ShellWindowList::const_iterator i = shell_windows_.begin();
- i != shell_windows_.end(); ++i) {
- if ((*i)->GetNativeWindow() == window)
- return *i;
- }
-
- return NULL;
-}
-
-ShellWindow* ShellWindowRegistry::GetCurrentShellWindowForApp(
- const std::string& app_id) const {
- ShellWindow* result = NULL;
- for (ShellWindowList::const_iterator i = shell_windows_.begin();
- i != shell_windows_.end(); ++i) {
- if ((*i)->extension()->id() == app_id) {
- result = *i;
- if (result->GetBaseWindow()->IsActive())
- return result;
- }
- }
-
- return result;
-}
-
-ShellWindow* ShellWindowRegistry::GetShellWindowForAppAndKey(
- const std::string& app_id,
- const std::string& window_key) const {
- ShellWindow* result = NULL;
- for (ShellWindowList::const_iterator i = shell_windows_.begin();
- i != shell_windows_.end(); ++i) {
- if ((*i)->extension()->id() == app_id && (*i)->window_key() == window_key) {
- result = *i;
- if (result->GetBaseWindow()->IsActive())
- return result;
- }
- }
- return result;
-}
-
-bool ShellWindowRegistry::HadDevToolsAttached(
- content::RenderViewHost* render_view_host) const {
- std::string key = GetWindowKeyForRenderViewHost(this, render_view_host);
- return key.empty() ? false : inspected_windows_.count(key) != 0;
-}
-
-// static
-ShellWindow* ShellWindowRegistry::GetShellWindowForNativeWindowAnyProfile(
- gfx::NativeWindow window) {
- std::vector<content::BrowserContext*> contexts =
- AppsClient::Get()->GetLoadedBrowserContexts();
- for (std::vector<content::BrowserContext*>::const_iterator i =
- contexts.begin();
- i != contexts.end(); ++i) {
- ShellWindowRegistry* registry = Factory::GetForBrowserContext(
- *i, false /* create */);
- if (!registry)
- continue;
-
- ShellWindow* shell_window = registry->GetShellWindowForNativeWindow(window);
- if (shell_window)
- return shell_window;
- }
-
- return NULL;
-}
-
-// static
-bool ShellWindowRegistry::IsShellWindowRegisteredInAnyProfile(
- int window_type_mask) {
- std::vector<content::BrowserContext*> contexts =
- AppsClient::Get()->GetLoadedBrowserContexts();
- for (std::vector<content::BrowserContext*>::const_iterator i =
- contexts.begin();
- i != contexts.end(); ++i) {
- ShellWindowRegistry* registry = Factory::GetForBrowserContext(
- *i, false /* create */);
- if (!registry)
- continue;
-
- const ShellWindowList& shell_windows = registry->shell_windows();
- if (shell_windows.empty())
- continue;
-
- if (window_type_mask == 0)
- return true;
-
- for (const_iterator j = shell_windows.begin(); j != shell_windows.end();
- ++j) {
- if ((*j)->window_type() & window_type_mask)
- return true;
- }
- }
-
- return false;
-}
-
-void ShellWindowRegistry::OnDevToolsStateChanged(
- content::DevToolsAgentHost* agent_host, bool attached) {
- content::RenderViewHost* rvh = agent_host->GetRenderViewHost();
- // Ignore unrelated notifications.
- if (!rvh ||
- rvh->GetSiteInstance()->GetProcess()->GetBrowserContext() != context_)
- return;
-
- std::string key = GetWindowKeyForRenderViewHost(this, rvh);
- if (key.empty())
- return;
-
- if (attached)
- inspected_windows_.insert(key);
- else
- inspected_windows_.erase(key);
-}
-
-void ShellWindowRegistry::AddShellWindowToList(ShellWindow* shell_window) {
- const ShellWindowList::iterator it = std::find(shell_windows_.begin(),
- shell_windows_.end(),
- shell_window);
- if (it != shell_windows_.end())
- return;
- shell_windows_.push_back(shell_window);
-}
-
-void ShellWindowRegistry::BringToFront(ShellWindow* shell_window) {
- const ShellWindowList::iterator it = std::find(shell_windows_.begin(),
- shell_windows_.end(),
- shell_window);
- if (it != shell_windows_.end())
- shell_windows_.erase(it);
- shell_windows_.push_front(shell_window);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Factory boilerplate
-
-// static
-ShellWindowRegistry* ShellWindowRegistry::Factory::GetForBrowserContext(
- content::BrowserContext* context, bool create) {
- return static_cast<ShellWindowRegistry*>(
- GetInstance()->GetServiceForBrowserContext(context, create));
-}
-
-ShellWindowRegistry::Factory* ShellWindowRegistry::Factory::GetInstance() {
- return Singleton<ShellWindowRegistry::Factory>::get();
-}
-
-ShellWindowRegistry::Factory::Factory()
- : BrowserContextKeyedServiceFactory(
- "ShellWindowRegistry",
- BrowserContextDependencyManager::GetInstance()) {
-}
-
-ShellWindowRegistry::Factory::~Factory() {
-}
-
-BrowserContextKeyedService*
-ShellWindowRegistry::Factory::BuildServiceInstanceFor(
- content::BrowserContext* context) const {
- return new ShellWindowRegistry(context);
-}
-
-bool ShellWindowRegistry::Factory::ServiceIsCreatedWithBrowserContext() const {
- return true;
-}
-
-bool ShellWindowRegistry::Factory::ServiceIsNULLWhileTesting() const {
- return false;
-}
-
-content::BrowserContext* ShellWindowRegistry::Factory::GetBrowserContextToUse(
- content::BrowserContext* context) const {
- return extensions::ExtensionsBrowserClient::Get()->
- GetOriginalContext(context);
-}
-
-} // namespace extensions
diff --git a/apps/shell_window_registry.h b/apps/shell_window_registry.h
deleted file mode 100644
index f32b39b..0000000
--- a/apps/shell_window_registry.h
+++ /dev/null
@@ -1,147 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef APPS_SHELL_WINDOW_REGISTRY_H_
-#define APPS_SHELL_WINDOW_REGISTRY_H_
-
-#include <list>
-
-#include "base/callback.h"
-#include "base/compiler_specific.h"
-#include "base/memory/singleton.h"
-#include "base/observer_list.h"
-#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
-#include "components/browser_context_keyed_service/browser_context_keyed_service_factory.h"
-#include "ui/gfx/native_widget_types.h"
-
-namespace content {
-class BrowserContext;
-class DevToolsAgentHost;
-class RenderViewHost;
-}
-
-namespace apps {
-
-class ShellWindow;
-
-// The ShellWindowRegistry tracks the ShellWindows for all platform apps for a
-// particular browser context.
-class ShellWindowRegistry : public BrowserContextKeyedService {
- public:
- class Observer {
- public:
- // Called just after a shell window was added.
- virtual void OnShellWindowAdded(apps::ShellWindow* shell_window) = 0;
- // Called when the window icon changes.
- virtual void OnShellWindowIconChanged(apps::ShellWindow* shell_window) = 0;
- // Called just after a shell window was removed.
- virtual void OnShellWindowRemoved(apps::ShellWindow* shell_window) = 0;
-
- protected:
- virtual ~Observer() {}
- };
-
- typedef std::list<apps::ShellWindow*> ShellWindowList;
- typedef ShellWindowList::const_iterator const_iterator;
- typedef std::set<std::string> InspectedWindowSet;
-
- explicit ShellWindowRegistry(content::BrowserContext* context);
- virtual ~ShellWindowRegistry();
-
- // Returns the instance for the given browser context, or NULL if none. This
- // is a convenience wrapper around
- // ShellWindowRegistry::Factory::GetForBrowserContext().
- static ShellWindowRegistry* Get(content::BrowserContext* context);
-
- void AddShellWindow(apps::ShellWindow* shell_window);
- void ShellWindowIconChanged(apps::ShellWindow* shell_window);
- // Called by |shell_window| when it is activated.
- void ShellWindowActivated(apps::ShellWindow* shell_window);
- void RemoveShellWindow(apps::ShellWindow* shell_window);
-
- void AddObserver(Observer* observer);
- void RemoveObserver(Observer* observer);
-
- // Returns a set of windows owned by the application identified by app_id.
- ShellWindowList GetShellWindowsForApp(const std::string& app_id) const;
- const ShellWindowList& shell_windows() const { return shell_windows_; }
-
- // Close all shell windows associated with an app.
- void CloseAllShellWindowsForApp(const std::string& app_id);
-
- // Helper functions to find shell windows with particular attributes.
- apps::ShellWindow* GetShellWindowForRenderViewHost(
- content::RenderViewHost* render_view_host) const;
- apps::ShellWindow* GetShellWindowForNativeWindow(
- gfx::NativeWindow window) const;
- // Returns an app window for the given app, or NULL if no shell windows are
- // open. If there is a window for the given app that is active, that one will
- // be returned, otherwise an arbitrary window will be returned.
- apps::ShellWindow* GetCurrentShellWindowForApp(
- const std::string& app_id) const;
- // Returns an app window for the given app and window key, or NULL if no shell
- // window with the key are open. If there is a window for the given app and
- // key that is active, that one will be returned, otherwise an arbitrary
- // window will be returned.
- apps::ShellWindow* GetShellWindowForAppAndKey(
- const std::string& app_id,
- const std::string& window_key) const;
-
- // Returns whether a ShellWindow's ID was last known to have a DevToolsAgent
- // attached to it, which should be restored during a reload of a corresponding
- // newly created |render_view_host|.
- bool HadDevToolsAttached(content::RenderViewHost* render_view_host) const;
-
- // Returns the shell window for |window|, looking in all browser contexts.
- static apps::ShellWindow* GetShellWindowForNativeWindowAnyProfile(
- gfx::NativeWindow window);
-
- // Returns true if the number of shell windows registered across all browser
- // contexts is non-zero. |window_type_mask| is a bitwise OR filter of
- // ShellWindow::WindowType, or 0 for any window type.
- static bool IsShellWindowRegisteredInAnyProfile(int window_type_mask);
-
- class Factory : public BrowserContextKeyedServiceFactory {
- public:
- static ShellWindowRegistry* GetForBrowserContext(
- content::BrowserContext* context, bool create);
-
- static Factory* GetInstance();
- private:
- friend struct DefaultSingletonTraits<Factory>;
-
- Factory();
- virtual ~Factory();
-
- // BrowserContextKeyedServiceFactory
- virtual BrowserContextKeyedService* BuildServiceInstanceFor(
- content::BrowserContext* context) const OVERRIDE;
- virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE;
- virtual bool ServiceIsNULLWhileTesting() const OVERRIDE;
- virtual content::BrowserContext* GetBrowserContextToUse(
- content::BrowserContext* context) const OVERRIDE;
- };
-
- protected:
- void OnDevToolsStateChanged(content::DevToolsAgentHost*, bool attached);
-
- private:
- // Ensures the specified |shell_window| is included in |shell_windows_|.
- // Otherwise adds |shell_window| to the back of |shell_windows_|.
- void AddShellWindowToList(apps::ShellWindow* shell_window);
-
- // Bring |shell_window| to the front of |shell_windows_|. If it is not in the
- // list, add it first.
- void BringToFront(apps::ShellWindow* shell_window);
-
- content::BrowserContext* context_;
- ShellWindowList shell_windows_;
- InspectedWindowSet inspected_windows_;
- ObserverList<Observer> observers_;
- base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_;
-};
-
-} // namespace extensions
-
-#endif // APPS_SHELL_WINDOW_REGISTRY_H_
diff --git a/apps/ui/native_app_window.h b/apps/ui/native_app_window.h
index 0cc1e99..1668916 100644
--- a/apps/ui/native_app_window.h
+++ b/apps/ui/native_app_window.h
@@ -5,21 +5,21 @@
#ifndef APPS_UI_NATIVE_APP_WINDOW_H_
#define APPS_UI_NATIVE_APP_WINDOW_H_
-#include "apps/shell_window.h"
+#include "apps/app_window.h"
#include "components/web_modal/web_contents_modal_dialog_host.h"
#include "ui/base/base_window.h"
#include "ui/gfx/insets.h"
namespace apps {
-// This is an interface to a native implementation of a shell window, used for
-// new-style packaged apps. Shell windows contain a web contents, but no tabs
+// This is an interface to a native implementation of a app window, used for
+// new-style packaged apps. App windows contain a web contents, but no tabs
// or URL bar.
class NativeAppWindow : public ui::BaseWindow,
public web_modal::WebContentsModalDialogHost {
public:
// Sets whether the window is fullscreen and the type of fullscreen.
- // |fullscreen_types| is a bit field of ShellWindow::FullscreenType.
+ // |fullscreen_types| is a bit field of AppWindow::FullscreenType.
virtual void SetFullscreen(int fullscreen_types) = 0;
// Returns whether the window is fullscreen or about to enter fullscreen.
diff --git a/apps/ui/views/shell_window_frame_view.cc b/apps/ui/views/app_window_frame_view.cc
index fba321d..a74f9e1 100644
--- a/apps/ui/views/shell_window_frame_view.cc
+++ b/apps/ui/views/app_window_frame_view.cc
@@ -1,8 +1,8 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "apps/ui/views/shell_window_frame_view.h"
+#include "apps/ui/views/app_window_frame_view.h"
#include "apps/ui/native_app_window.h"
#include "base/strings/utf_string_conversions.h"
@@ -34,10 +34,10 @@ const int kCaptionHeight = 25;
namespace apps {
-const char ShellWindowFrameView::kViewClassName[] =
- "browser/ui/views/extensions/ShellWindowFrameView";
+const char AppWindowFrameView::kViewClassName[] =
+ "browser/ui/views/extensions/AppWindowFrameView";
-ShellWindowFrameView::ShellWindowFrameView(NativeAppWindow* window)
+AppWindowFrameView::AppWindowFrameView(NativeAppWindow* window)
: window_(window),
frame_(NULL),
close_button_(NULL),
@@ -46,17 +46,15 @@ ShellWindowFrameView::ShellWindowFrameView(NativeAppWindow* window)
minimize_button_(NULL),
resize_inside_bounds_size_(0),
resize_outside_bounds_size_(0),
- resize_area_corner_size_(0) {
-}
+ resize_area_corner_size_(0) {}
-ShellWindowFrameView::~ShellWindowFrameView() {
-}
+AppWindowFrameView::~AppWindowFrameView() {}
-void ShellWindowFrameView::Init(views::Widget* frame,
- int resize_inside_bounds_size,
- int resize_outside_bounds_size,
- int resize_outside_scale_for_touch,
- int resize_area_corner_size) {
+void AppWindowFrameView::Init(views::Widget* frame,
+ int resize_inside_bounds_size,
+ int resize_outside_bounds_size,
+ int resize_outside_scale_for_touch,
+ int resize_area_corner_size) {
frame_ = frame;
resize_inside_bounds_size_ = resize_inside_bounds_size;
resize_outside_bounds_size_ = resize_outside_bounds_size;
@@ -65,43 +63,56 @@ void ShellWindowFrameView::Init(views::Widget* frame,
if (!window_->IsFrameless()) {
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
close_button_ = new views::ImageButton(this);
- close_button_->SetImage(views::CustomButton::STATE_NORMAL,
+ close_button_->SetImage(
+ views::CustomButton::STATE_NORMAL,
rb.GetNativeImageNamed(IDR_APP_WINDOW_CLOSE).ToImageSkia());
- close_button_->SetImage(views::CustomButton::STATE_HOVERED,
+ close_button_->SetImage(
+ views::CustomButton::STATE_HOVERED,
rb.GetNativeImageNamed(IDR_APP_WINDOW_CLOSE_H).ToImageSkia());
- close_button_->SetImage(views::CustomButton::STATE_PRESSED,
+ close_button_->SetImage(
+ views::CustomButton::STATE_PRESSED,
rb.GetNativeImageNamed(IDR_APP_WINDOW_CLOSE_P).ToImageSkia());
close_button_->SetAccessibleName(
l10n_util::GetStringUTF16(IDS_APP_ACCNAME_CLOSE));
AddChildView(close_button_);
maximize_button_ = new views::ImageButton(this);
- maximize_button_->SetImage(views::CustomButton::STATE_NORMAL,
+ maximize_button_->SetImage(
+ views::CustomButton::STATE_NORMAL,
rb.GetNativeImageNamed(IDR_APP_WINDOW_MAXIMIZE).ToImageSkia());
- maximize_button_->SetImage(views::CustomButton::STATE_HOVERED,
+ maximize_button_->SetImage(
+ views::CustomButton::STATE_HOVERED,
rb.GetNativeImageNamed(IDR_APP_WINDOW_MAXIMIZE_H).ToImageSkia());
- maximize_button_->SetImage(views::CustomButton::STATE_PRESSED,
+ maximize_button_->SetImage(
+ views::CustomButton::STATE_PRESSED,
rb.GetNativeImageNamed(IDR_APP_WINDOW_MAXIMIZE_P).ToImageSkia());
- maximize_button_->SetImage(views::CustomButton::STATE_DISABLED,
+ maximize_button_->SetImage(
+ views::CustomButton::STATE_DISABLED,
rb.GetNativeImageNamed(IDR_APP_WINDOW_MAXIMIZE_D).ToImageSkia());
maximize_button_->SetAccessibleName(
l10n_util::GetStringUTF16(IDS_APP_ACCNAME_MAXIMIZE));
AddChildView(maximize_button_);
restore_button_ = new views::ImageButton(this);
- restore_button_->SetImage(views::CustomButton::STATE_NORMAL,
+ restore_button_->SetImage(
+ views::CustomButton::STATE_NORMAL,
rb.GetNativeImageNamed(IDR_APP_WINDOW_RESTORE).ToImageSkia());
- restore_button_->SetImage(views::CustomButton::STATE_HOVERED,
+ restore_button_->SetImage(
+ views::CustomButton::STATE_HOVERED,
rb.GetNativeImageNamed(IDR_APP_WINDOW_RESTORE_H).ToImageSkia());
- restore_button_->SetImage(views::CustomButton::STATE_PRESSED,
+ restore_button_->SetImage(
+ views::CustomButton::STATE_PRESSED,
rb.GetNativeImageNamed(IDR_APP_WINDOW_RESTORE_P).ToImageSkia());
restore_button_->SetAccessibleName(
l10n_util::GetStringUTF16(IDS_APP_ACCNAME_RESTORE));
AddChildView(restore_button_);
minimize_button_ = new views::ImageButton(this);
- minimize_button_->SetImage(views::CustomButton::STATE_NORMAL,
+ minimize_button_->SetImage(
+ views::CustomButton::STATE_NORMAL,
rb.GetNativeImageNamed(IDR_APP_WINDOW_MINIMIZE).ToImageSkia());
- minimize_button_->SetImage(views::CustomButton::STATE_HOVERED,
+ minimize_button_->SetImage(
+ views::CustomButton::STATE_HOVERED,
rb.GetNativeImageNamed(IDR_APP_WINDOW_MINIMIZE_H).ToImageSkia());
- minimize_button_->SetImage(views::CustomButton::STATE_PRESSED,
+ minimize_button_->SetImage(
+ views::CustomButton::STATE_PRESSED,
rb.GetNativeImageNamed(IDR_APP_WINDOW_MINIMIZE_P).ToImageSkia());
minimize_button_->SetAccessibleName(
l10n_util::GetStringUTF16(IDS_APP_ACCNAME_MINIMIZE));
@@ -113,22 +124,24 @@ void ShellWindowFrameView::Init(views::Widget* frame,
// Ensure we get resize cursors just inside our bounds as well.
// TODO(jeremya): do we need to update these when in fullscreen/maximized?
window->set_hit_test_bounds_override_inner(
- gfx::Insets(resize_inside_bounds_size_, resize_inside_bounds_size_,
- resize_inside_bounds_size_, resize_inside_bounds_size_));
+ gfx::Insets(resize_inside_bounds_size_,
+ resize_inside_bounds_size_,
+ resize_inside_bounds_size_,
+ resize_inside_bounds_size_));
#endif
}
// views::NonClientFrameView implementation.
-gfx::Rect ShellWindowFrameView::GetBoundsForClientView() const {
+gfx::Rect AppWindowFrameView::GetBoundsForClientView() const {
if (window_->IsFrameless() || frame_->IsFullscreen())
return bounds();
- return gfx::Rect(0, kCaptionHeight, width(),
- std::max(0, height() - kCaptionHeight));
+ return gfx::Rect(
+ 0, kCaptionHeight, width(), std::max(0, height() - kCaptionHeight));
}
-gfx::Rect ShellWindowFrameView::GetWindowBoundsForClientBounds(
- const gfx::Rect& client_bounds) const {
+gfx::Rect AppWindowFrameView::GetWindowBoundsForClientBounds(
+ const gfx::Rect& client_bounds) const {
if (window_->IsFrameless()) {
gfx::Rect window_bounds = client_bounds;
// Enforce minimum size (1, 1) in case that client_bounds is passed with
@@ -141,8 +154,7 @@ gfx::Rect ShellWindowFrameView::GetWindowBoundsForClientBounds(
return window_bounds;
}
- int closeButtonOffsetX =
- (kCaptionHeight - close_button_->height()) / 2;
+ int closeButtonOffsetX = (kCaptionHeight - close_button_->height()) / 2;
int header_width = close_button_->width() + closeButtonOffsetX * 2;
return gfx::Rect(client_bounds.x(),
std::max(0, client_bounds.y() - kCaptionHeight),
@@ -150,7 +162,7 @@ gfx::Rect ShellWindowFrameView::GetWindowBoundsForClientBounds(
client_bounds.height() + kCaptionHeight);
}
-int ShellWindowFrameView::NonClientHitTest(const gfx::Point& point) {
+int AppWindowFrameView::NonClientHitTest(const gfx::Point& point) {
if (frame_->IsFullscreen())
return HTCLIENT;
@@ -166,14 +178,14 @@ int ShellWindowFrameView::NonClientHitTest(const gfx::Point& point) {
// Check the frame first, as we allow a small area overlapping the contents
// to be used for resize handles.
- bool can_ever_resize = frame_->widget_delegate() ?
- frame_->widget_delegate()->CanResize() :
- false;
+ bool can_ever_resize = frame_->widget_delegate()
+ ? frame_->widget_delegate()->CanResize()
+ : false;
// Don't allow overlapping resize handles when the window is maximized or
// fullscreen, as it can't be resized in those states.
- int resize_border =
- (frame_->IsMaximized() || frame_->IsFullscreen()) ? 0 :
- resize_inside_bounds_size_;
+ int resize_border = (frame_->IsMaximized() || frame_->IsFullscreen())
+ ? 0
+ : resize_inside_bounds_size_;
int frame_component = GetHTComponentForFrame(point,
resize_border,
resize_border,
@@ -215,21 +227,22 @@ int ShellWindowFrameView::NonClientHitTest(const gfx::Point& point) {
return HTCAPTION;
}
-void ShellWindowFrameView::GetWindowMask(const gfx::Size& size,
- gfx::Path* window_mask) {
+void AppWindowFrameView::GetWindowMask(const gfx::Size& size,
+ gfx::Path* window_mask) {
// We got nothing to say about no window mask.
}
// views::View implementation.
-gfx::Size ShellWindowFrameView::GetPreferredSize() {
+gfx::Size AppWindowFrameView::GetPreferredSize() {
gfx::Size pref = frame_->client_view()->GetPreferredSize();
gfx::Rect bounds(0, 0, pref.width(), pref.height());
- return frame_->non_client_view()->GetWindowBoundsForClientBounds(
- bounds).size();
+ return frame_->non_client_view()
+ ->GetWindowBoundsForClientBounds(bounds)
+ .size();
}
-void ShellWindowFrameView::Layout() {
+void AppWindowFrameView::Layout() {
if (window_->IsFrameless())
return;
gfx::Size close_size = close_button_->GetPreferredSize();
@@ -237,15 +250,14 @@ void ShellWindowFrameView::Layout() {
const int kButtonSpacing = 1;
const int kRightMargin = 3;
- close_button_->SetBounds(
- width() - kRightMargin - close_size.width(),
- kButtonOffsetY,
- close_size.width(),
- close_size.height());
+ close_button_->SetBounds(width() - kRightMargin - close_size.width(),
+ kButtonOffsetY,
+ close_size.width(),
+ close_size.height());
- bool can_ever_resize = frame_->widget_delegate() ?
- frame_->widget_delegate()->CanResize() :
- false;
+ bool can_ever_resize = frame_->widget_delegate()
+ ? frame_->widget_delegate()->CanResize()
+ : false;
maximize_button_->SetEnabled(can_ever_resize);
gfx::Size maximize_size = maximize_button_->GetPreferredSize();
maximize_button_->SetBounds(
@@ -276,16 +288,18 @@ void ShellWindowFrameView::Layout() {
minimize_size.height());
}
-void ShellWindowFrameView::OnPaint(gfx::Canvas* canvas) {
+void AppWindowFrameView::OnPaint(gfx::Canvas* canvas) {
if (window_->IsFrameless())
return;
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
if (ShouldPaintAsActive()) {
- close_button_->SetImage(views::CustomButton::STATE_NORMAL,
+ close_button_->SetImage(
+ views::CustomButton::STATE_NORMAL,
rb.GetNativeImageNamed(IDR_APP_WINDOW_CLOSE).ToImageSkia());
} else {
- close_button_->SetImage(views::CustomButton::STATE_NORMAL,
+ close_button_->SetImage(
+ views::CustomButton::STATE_NORMAL,
rb.GetNativeImageNamed(IDR_APP_WINDOW_CLOSE_U).ToImageSkia());
}
@@ -303,11 +317,9 @@ void ShellWindowFrameView::OnPaint(gfx::Canvas* canvas) {
canvas->DrawPath(path, paint);
}
-const char* ShellWindowFrameView::GetClassName() const {
- return kViewClassName;
-}
+const char* AppWindowFrameView::GetClassName() const { return kViewClassName; }
-gfx::Size ShellWindowFrameView::GetMinimumSize() {
+gfx::Size AppWindowFrameView::GetMinimumSize() {
gfx::Size min_size = frame_->client_view()->GetMinimumSize();
if (window_->IsFrameless())
return min_size;
@@ -317,15 +329,14 @@ gfx::Size ShellWindowFrameView::GetMinimumSize() {
min_size.Enlarge(0, client_bounds.y());
// Ensure we have enough space for the window icon and buttons. We allow
// the title string to collapse to zero width.
- int closeButtonOffsetX =
- (kCaptionHeight - close_button_->height()) / 2;
+ int closeButtonOffsetX = (kCaptionHeight - close_button_->height()) / 2;
int header_width = close_button_->width() + closeButtonOffsetX * 2;
if (header_width > min_size.width())
min_size.set_width(header_width);
return min_size;
}
-gfx::Size ShellWindowFrameView::GetMaximumSize() {
+gfx::Size AppWindowFrameView::GetMaximumSize() {
gfx::Size max_size = frame_->client_view()->GetMaximumSize();
// Add to the client maximum size the height of any title bar and borders.
@@ -340,8 +351,8 @@ gfx::Size ShellWindowFrameView::GetMaximumSize() {
// views::ButtonListener implementation.
-void ShellWindowFrameView::ButtonPressed(views::Button* sender,
- const ui::Event& event) {
+void AppWindowFrameView::ButtonPressed(views::Button* sender,
+ const ui::Event& event) {
DCHECK(!window_->IsFrameless());
if (sender == close_button_)
frame_->Close();
diff --git a/apps/ui/views/shell_window_frame_view.h b/apps/ui/views/app_window_frame_view.h
index 31b7857..77c3859 100644
--- a/apps/ui/views/shell_window_frame_view.h
+++ b/apps/ui/views/app_window_frame_view.h
@@ -1,9 +1,9 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef APPS_UI_VIEWS_SHELL_WINDOW_FRAME_VIEW_H_
-#define APPS_UI_VIEWS_SHELL_WINDOW_FRAME_VIEW_H_
+#ifndef APPS_UI_VIEWS_APP_WINDOW_FRAME_VIEW_H_
+#define APPS_UI_VIEWS_APP_WINDOW_FRAME_VIEW_H_
#include <string>
@@ -32,13 +32,13 @@ namespace apps {
class NativeAppWindow;
// A frameless or non-Ash, non-panel NonClientFrameView for app windows.
-class ShellWindowFrameView : public views::NonClientFrameView,
- public views::ButtonListener {
+class AppWindowFrameView : public views::NonClientFrameView,
+ public views::ButtonListener {
public:
static const char kViewClassName[];
- explicit ShellWindowFrameView(NativeAppWindow* window);
- virtual ~ShellWindowFrameView();
+ explicit AppWindowFrameView(NativeAppWindow* window);
+ virtual ~AppWindowFrameView();
// Initializes this for the window |frame|. Sets the number of pixels for
// which a click is interpreted as a resize for the inner and outer border of
@@ -70,8 +70,8 @@ class ShellWindowFrameView : public views::NonClientFrameView,
virtual gfx::Size GetMaximumSize() OVERRIDE;
// views::ButtonListener implementation.
- virtual void ButtonPressed(views::Button* sender, const ui::Event& event)
- OVERRIDE;
+ virtual void ButtonPressed(views::Button* sender,
+ const ui::Event& event) OVERRIDE;
NativeAppWindow* window_;
views::Widget* frame_;
@@ -89,9 +89,9 @@ class ShellWindowFrameView : public views::NonClientFrameView,
// Size in pixels of the lower-right corner resize handle.
int resize_area_corner_size_;
- DISALLOW_COPY_AND_ASSIGN(ShellWindowFrameView);
+ DISALLOW_COPY_AND_ASSIGN(AppWindowFrameView);
};
} // namespace apps
-#endif // APPS_UI_VIEWS_SHELL_WINDOW_FRAME_VIEW_H_
+#endif // APPS_UI_VIEWS_APP_WINDOW_FRAME_VIEW_H_
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index f7066a6..6d48663 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -6,7 +6,7 @@
#include "apps/app_shim/app_shim_mac.h"
#include "apps/app_shim/extension_app_shim_handler_mac.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window_registry.h"
#include "base/auto_reset.h"
#include "base/bind.h"
#include "base/command_line.h"
@@ -417,7 +417,7 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)app {
// If there are no windows, quit immediately.
if (chrome::BrowserIterator().done() &&
- !apps::ShellWindowRegistry::IsShellWindowRegisteredInAnyProfile(0)) {
+ !apps::AppWindowRegistry::IsAppWindowRegisteredInAnyProfile(0)) {
return NSTerminateNow;
}
diff --git a/chrome/browser/app_controller_mac_browsertest.mm b/chrome/browser/app_controller_mac_browsertest.mm
index 70498ec..d094111 100644
--- a/chrome/browser/app_controller_mac_browsertest.mm
+++ b/chrome/browser/app_controller_mac_browsertest.mm
@@ -4,18 +4,18 @@
#import <Cocoa/Cocoa.h>
-#include "apps/shell_window_registry.h"
+#include "apps/app_window_registry.h"
#include "base/command_line.h"
#include "base/mac/scoped_nsobject.h"
#include "base/prefs/pref_service.h"
#include "chrome/app/chrome_command_ids.h"
#import "chrome/browser/app_controller_mac.h"
#include "chrome/browser/apps/app_browsertest_util.h"
+#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/extension_test_message_listener.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
-#include "chrome/browser/browser_process.h"
#include "chrome/browser/ui/browser_window.h"
#import "chrome/browser/ui/cocoa/user_manager_mac.h"
#include "chrome/browser/ui/host_desktop.h"
@@ -73,8 +73,10 @@ IN_PROC_BROWSER_TEST_F(AppControllerPlatformAppBrowserTest,
InstallAndLaunchPlatformApp("minimal");
ASSERT_TRUE(listener.WaitUntilSatisfied());
- NSWindow* app_window = apps::ShellWindowRegistry::Get(profile())->
- GetShellWindowsForApp(app->id()).front()->GetNativeWindow();
+ NSWindow* app_window = apps::AppWindowRegistry::Get(profile())
+ ->GetAppWindowsForApp(app->id())
+ .front()
+ ->GetNativeWindow();
NSWindow* browser_window = browser()->window()->GetNativeWindow();
EXPECT_LE([[NSApp orderedWindows] indexOfObject:app_window],
diff --git a/chrome/browser/apps/app_browsertest.cc b/chrome/browser/apps/app_browsertest.cc
index baac724..8ac50ed 100644
--- a/chrome/browser/apps/app_browsertest.cc
+++ b/chrome/browser/apps/app_browsertest.cc
@@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "apps/launcher.h"
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
#include "apps/ui/native_app_window.h"
#include "base/bind.h"
#include "base/command_line.h"
@@ -56,8 +56,8 @@
#include "chromeos/dbus/fake_power_manager_client.h"
#endif
-using apps::ShellWindow;
-using apps::ShellWindowRegistry;
+using apps::AppWindow;
+using apps::AppWindowRegistry;
using content::WebContents;
using web_modal::WebContentsModalDialogManager;
@@ -196,13 +196,13 @@ const char kTestFilePath[] = "platform_apps/launch_files/test.txt";
} // namespace
-// Tests that CreateShellWindow doesn't crash if you close it straight away.
+// Tests that CreateAppWindow doesn't crash if you close it straight away.
// LauncherPlatformAppBrowserTest relies on this behaviour, but is only run for
// ash, so we test that it works here.
-IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, CreateAndCloseShellWindow) {
+IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, CreateAndCloseAppWindow) {
const Extension* extension = LoadAndLaunchPlatformApp("minimal");
- ShellWindow* window = CreateShellWindow(extension);
- CloseShellWindow(window);
+ AppWindow* window = CreateAppWindow(extension);
+ CloseAppWindow(window);
}
// Tests that platform apps received the "launch" event when launched.
@@ -225,7 +225,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, EmptyContextMenu) {
// The empty app doesn't add any context menu items, so its menu should
// only include the developer tools.
- WebContents* web_contents = GetFirstShellWindowWebContents();
+ WebContents* web_contents = GetFirstAppWindowWebContents();
ASSERT_TRUE(web_contents);
content::ContextMenuParams params;
scoped_ptr<PlatformAppContextMenu> menu;
@@ -249,7 +249,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenu) {
// The context_menu app has two context menu items. These, along with a
// separator and the developer tools, is all that should be in the menu.
- WebContents* web_contents = GetFirstShellWindowWebContents();
+ WebContents* web_contents = GetFirstAppWindowWebContents();
ASSERT_TRUE(web_contents);
content::ContextMenuParams params;
scoped_ptr<PlatformAppContextMenu> menu;
@@ -276,7 +276,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, InstalledAppWithContextMenu) {
// The context_menu app has two context menu items. For an installed app
// these are all that should be in the menu.
- WebContents* web_contents = GetFirstShellWindowWebContents();
+ WebContents* web_contents = GetFirstAppWindowWebContents();
ASSERT_TRUE(web_contents);
content::ContextMenuParams params;
scoped_ptr<PlatformAppContextMenu> menu;
@@ -303,7 +303,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenuTextField) {
// The context_menu app has one context menu item. This, along with a
// separator and the developer tools, is all that should be in the menu.
- WebContents* web_contents = GetFirstShellWindowWebContents();
+ WebContents* web_contents = GetFirstAppWindowWebContents();
ASSERT_TRUE(web_contents);
content::ContextMenuParams params;
params.is_editable = true;
@@ -331,7 +331,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenuSelection) {
// The context_menu app has one context menu item. This, along with a
// separator and the developer tools, is all that should be in the menu.
- WebContents* web_contents = GetFirstShellWindowWebContents();
+ WebContents* web_contents = GetFirstAppWindowWebContents();
ASSERT_TRUE(web_contents);
content::ContextMenuParams params;
params.selection_text = base::ASCIIToUTF16("Hello World");
@@ -358,7 +358,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenuClicked) {
ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
// Test that the menu item shows up
- WebContents* web_contents = GetFirstShellWindowWebContents();
+ WebContents* web_contents = GetFirstAppWindowWebContents();
ASSERT_TRUE(web_contents);
content::ContextMenuParams params;
params.page_url = GURL("http://foo.bar");
@@ -461,33 +461,33 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_ExtensionWindowingApis) {
test_data_dir_.AppendASCII("common/background_page"));
ASSERT_EQ(1U, RunGetWindowsFunctionForExtension(extension));
- // And no shell windows.
- ASSERT_EQ(0U, GetShellWindowCount());
+ // And no app windows.
+ ASSERT_EQ(0U, GetAppWindowCount());
// Launch a platform app that shows a window.
ExtensionTestMessageListener launched_listener("Launched", false);
LoadAndLaunchPlatformApp("minimal");
ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
- ASSERT_EQ(1U, GetShellWindowCount());
- int shell_window_id = GetFirstShellWindow()->session_id().id();
+ ASSERT_EQ(1U, GetAppWindowCount());
+ int app_window_id = GetFirstAppWindow()->session_id().id();
// But it's not visible to the extensions API, it still thinks there's just
// one browser window.
ASSERT_EQ(1U, RunGetWindowsFunctionForExtension(extension));
// It can't look it up by ID either
- ASSERT_FALSE(RunGetWindowFunctionForExtension(shell_window_id, extension));
+ ASSERT_FALSE(RunGetWindowFunctionForExtension(app_window_id, extension));
// The app can also only see one window (its own).
- // TODO(jeremya): add an extension function to get a shell window by ID, and
- // to get a list of all the shell windows, so we can test this.
+ // TODO(jeremya): add an extension function to get an app window by ID, and
+ // to get a list of all the app windows, so we can test this.
// Launch another platform app that also shows a window.
ExtensionTestMessageListener launched_listener2("Launched", false);
LoadAndLaunchPlatformApp("context_menu");
ASSERT_TRUE(launched_listener2.WaitUntilSatisfied());
- // There are two total shell windows, but each app can only see its own.
- ASSERT_EQ(2U, GetShellWindowCount());
+ // There are two total app windows, but each app can only see its own.
+ ASSERT_EQ(2U, GetAppWindowCount());
// TODO(jeremya): as above, this requires more extension functions.
}
@@ -715,19 +715,18 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MutationEventsDisabled) {
// This appears to be unreliable on linux.
// TODO(stevenjb): Investigate and enable
#if defined(OS_LINUX) && !defined(USE_ASH)
-#define MAYBE_ShellWindowRestoreState DISABLED_ShellWindowRestoreState
+#define MAYBE_AppWindowRestoreState DISABLED_AppWindowRestoreState
#else
-#define MAYBE_ShellWindowRestoreState ShellWindowRestoreState
+#define MAYBE_AppWindowRestoreState AppWindowRestoreState
#endif
-IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
- MAYBE_ShellWindowRestoreState) {
+IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_AppWindowRestoreState) {
ASSERT_TRUE(RunPlatformAppTest("platform_apps/restore_state"));
}
IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
- ShellWindowAdjustBoundsToBeVisibleOnScreen) {
+ AppWindowAdjustBoundsToBeVisibleOnScreen) {
const Extension* extension = LoadAndLaunchPlatformApp("minimal");
- ShellWindow* window = CreateShellWindow(extension);
+ AppWindow* window = CreateAppWindow(extension);
// The screen bounds didn't change, the cached bounds didn't need to adjust.
gfx::Rect cached_bounds(80, 100, 400, 400);
@@ -735,28 +734,28 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
gfx::Rect current_screen_bounds(0, 0, 1600, 900);
gfx::Size minimum_size(200, 200);
gfx::Rect bounds;
- CallAdjustBoundsToBeVisibleOnScreenForShellWindow(window,
- cached_bounds,
- cached_screen_bounds,
- current_screen_bounds,
- minimum_size,
- &bounds);
+ CallAdjustBoundsToBeVisibleOnScreenForAppWindow(window,
+ cached_bounds,
+ cached_screen_bounds,
+ current_screen_bounds,
+ minimum_size,
+ &bounds);
EXPECT_EQ(bounds, cached_bounds);
// We have an empty screen bounds, the cached bounds didn't need to adjust.
gfx::Rect empty_screen_bounds;
- CallAdjustBoundsToBeVisibleOnScreenForShellWindow(window,
- cached_bounds,
- empty_screen_bounds,
- current_screen_bounds,
- minimum_size,
- &bounds);
+ CallAdjustBoundsToBeVisibleOnScreenForAppWindow(window,
+ cached_bounds,
+ empty_screen_bounds,
+ current_screen_bounds,
+ minimum_size,
+ &bounds);
EXPECT_EQ(bounds, cached_bounds);
// Cached bounds is completely off the new screen bounds in horizontal
// locations. Expect to reposition the bounds.
gfx::Rect horizontal_out_of_screen_bounds(-800, 100, 400, 400);
- CallAdjustBoundsToBeVisibleOnScreenForShellWindow(
+ CallAdjustBoundsToBeVisibleOnScreenForAppWindow(
window,
horizontal_out_of_screen_bounds,
gfx::Rect(-1366, 0, 1600, 900),
@@ -768,7 +767,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
// Cached bounds is completely off the new screen bounds in vertical
// locations. Expect to reposition the bounds.
gfx::Rect vertical_out_of_screen_bounds(10, 1000, 400, 400);
- CallAdjustBoundsToBeVisibleOnScreenForShellWindow(
+ CallAdjustBoundsToBeVisibleOnScreenForAppWindow(
window,
vertical_out_of_screen_bounds,
gfx::Rect(-1366, 0, 1600, 900),
@@ -779,24 +778,22 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
// From a large screen resulotion to a small one. Expect it fit on screen.
gfx::Rect big_cache_bounds(10, 10, 1000, 1000);
- CallAdjustBoundsToBeVisibleOnScreenForShellWindow(
- window,
- big_cache_bounds,
- gfx::Rect(0, 0, 1600, 1000),
- gfx::Rect(0, 0, 800, 600),
- minimum_size,
- &bounds);
+ CallAdjustBoundsToBeVisibleOnScreenForAppWindow(window,
+ big_cache_bounds,
+ gfx::Rect(0, 0, 1600, 1000),
+ gfx::Rect(0, 0, 800, 600),
+ minimum_size,
+ &bounds);
EXPECT_EQ(bounds, gfx::Rect(0, 0, 800, 600));
// Don't resize the bounds smaller than minimum size, when the minimum size is
// larger than the screen.
- CallAdjustBoundsToBeVisibleOnScreenForShellWindow(
- window,
- big_cache_bounds,
- gfx::Rect(0, 0, 1600, 1000),
- gfx::Rect(0, 0, 800, 600),
- gfx::Size(900, 900),
- &bounds);
+ CallAdjustBoundsToBeVisibleOnScreenForAppWindow(window,
+ big_cache_bounds,
+ gfx::Rect(0, 0, 1600, 1000),
+ gfx::Rect(0, 0, 800, 600),
+ gfx::Size(900, 900),
+ &bounds);
EXPECT_EQ(bounds, gfx::Rect(0, 0, 900, 900));
}
@@ -808,7 +805,7 @@ class PlatformAppDevToolsBrowserTest : public PlatformAppBrowserTest {
RELAUNCH = 0x1,
HAS_ID = 0x2,
};
- // Runs a test inside a harness that opens DevTools on a shell window.
+ // Runs a test inside a harness that opens DevTools on an app window.
void RunTestWithDevTools(const char* name, int test_flags);
};
@@ -819,30 +816,30 @@ void PlatformAppDevToolsBrowserTest::RunTestWithDevTools(
const Extension* extension = LoadAndLaunchPlatformApp(name);
ASSERT_TRUE(extension);
ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
- ShellWindow* window = GetFirstShellWindow();
+ AppWindow* window = GetFirstAppWindow();
ASSERT_TRUE(window);
ASSERT_EQ(window->window_key().empty(), (test_flags & HAS_ID) == 0);
content::RenderViewHost* rvh = window->web_contents()->GetRenderViewHost();
ASSERT_TRUE(rvh);
- // Ensure no DevTools open for the ShellWindow, then open one.
+ // Ensure no DevTools open for the AppWindow, then open one.
ASSERT_FALSE(DevToolsAgentHost::HasFor(rvh));
DevToolsWindow::OpenDevToolsWindow(rvh);
ASSERT_TRUE(DevToolsAgentHost::HasFor(rvh));
if (test_flags & RELAUNCH) {
- // Close the ShellWindow, and ensure it is gone.
- CloseShellWindow(window);
- ASSERT_FALSE(GetFirstShellWindow());
+ // Close the AppWindow, and ensure it is gone.
+ CloseAppWindow(window);
+ ASSERT_FALSE(GetFirstAppWindow());
- // Relaunch the app and get a new ShellWindow.
+ // Relaunch the app and get a new AppWindow.
content::WindowedNotificationObserver app_loaded_observer(
content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
content::NotificationService::AllSources());
OpenApplication(AppLaunchParams(
browser()->profile(), extension, LAUNCH_CONTAINER_NONE, NEW_WINDOW));
app_loaded_observer.Wait();
- window = GetFirstShellWindow();
+ window = GetFirstAppWindow();
ASSERT_TRUE(window);
// DevTools should have reopened with the relaunch.
@@ -895,10 +892,10 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_ConstrainedWindowRequest) {
LoadAndLaunchPlatformApp("optional_permission_request");
ASSERT_TRUE(extension) << "Failed to load extension.";
- WebContents* web_contents = GetFirstShellWindowWebContents();
+ WebContents* web_contents = GetFirstAppWindowWebContents();
ASSERT_TRUE(web_contents);
- // Verify that the shell window has a dialog attached.
+ // Verify that the app window has a dialog attached.
WebContentsModalDialogManager* web_contents_modal_dialog_manager =
WebContentsModalDialogManager::FromWebContents(web_contents);
EXPECT_TRUE(web_contents_modal_dialog_manager->IsDialogActive());
@@ -919,13 +916,13 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, ReloadRelaunches) {
const Extension* extension = LoadAndLaunchPlatformApp("reload");
ASSERT_TRUE(extension);
ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
- ASSERT_TRUE(GetFirstShellWindow());
+ ASSERT_TRUE(GetFirstAppWindow());
// Now tell the app to reload itself
ExtensionTestMessageListener launched_listener2("Launched", false);
launched_listener.Reply("reload");
ASSERT_TRUE(launched_listener2.WaitUntilSatisfied());
- ASSERT_TRUE(GetFirstShellWindow());
+ ASSERT_TRUE(GetFirstAppWindow());
}
namespace {
@@ -962,7 +959,7 @@ class CheckExtensionInstalledObserver : public content::NotificationObserver {
// Component App Test 1 of 3: ensure that the initial load of a component
// extension utilizing a background page (e.g. a v2 platform app) has its
// background page run and is launchable. Waits for the Launched response from
-// the script resource in the opened shell window.
+// the script resource in the opened app window.
IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
PRE_PRE_ComponentAppBackgroundPage) {
CheckExtensionInstalledObserver should_install;
@@ -1076,9 +1073,11 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_WebContentsHasFocus) {
LoadAndLaunchPlatformApp("minimal");
ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
- EXPECT_EQ(1LU, GetShellWindowCount());
- EXPECT_TRUE(GetFirstShellWindow()->web_contents()->
- GetRenderWidgetHostView()->HasFocus());
+ EXPECT_EQ(1LU, GetAppWindowCount());
+ EXPECT_TRUE(GetFirstAppWindow()
+ ->web_contents()
+ ->GetRenderWidgetHostView()
+ ->HasFocus());
}
// The next three tests will only run automatically with Chrome branded builds
@@ -1126,7 +1125,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
ScopedPreviewTestingDelegate preview_delegate(false);
ASSERT_TRUE(RunPlatformAppTest("platform_apps/print_api")) << message_;
preview_delegate.WaitUntilPreviewIsReady();
- GetFirstShellWindow()->GetBaseWindow()->Close();
+ GetFirstAppWindow()->GetBaseWindow()->Close();
}
// This test currently only passes on OS X (on other platforms the print preview
@@ -1152,14 +1151,14 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
minimum_dialog_size.width());
EXPECT_GE(preview_delegate.dialog_size().height(),
minimum_dialog_size.height());
- GetFirstShellWindow()->GetBaseWindow()->Close();
+ GetFirstAppWindow()->GetBaseWindow()->Close();
}
#if defined(OS_CHROMEOS)
class PlatformAppIncognitoBrowserTest : public PlatformAppBrowserTest,
- public ShellWindowRegistry::Observer {
+ public AppWindowRegistry::Observer {
public:
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
// Tell chromeos to launch in Guest mode, aka incognito.
@@ -1172,15 +1171,15 @@ class PlatformAppIncognitoBrowserTest : public PlatformAppBrowserTest,
PlatformAppBrowserTest::SetUp();
}
- // ShellWindowRegistry::Observer implementation.
- virtual void OnShellWindowAdded(ShellWindow* shell_window) OVERRIDE {
- opener_app_ids_.insert(shell_window->extension()->id());
+ // AppWindowRegistry::Observer implementation.
+ virtual void OnAppWindowAdded(AppWindow* app_window) OVERRIDE {
+ opener_app_ids_.insert(app_window->extension()->id());
}
- virtual void OnShellWindowIconChanged(ShellWindow* shell_window) OVERRIDE {}
- virtual void OnShellWindowRemoved(ShellWindow* shell_window) OVERRIDE {}
+ virtual void OnAppWindowIconChanged(AppWindow* app_window) OVERRIDE {}
+ virtual void OnAppWindowRemoved(AppWindow* app_window) OVERRIDE {}
protected:
- // A set of ids of apps we've seen open a shell window.
+ // A set of ids of apps we've seen open a app window.
std::set<std::string> opener_app_ids_;
};
@@ -1201,8 +1200,8 @@ IN_PROC_BROWSER_TEST_F(PlatformAppIncognitoBrowserTest, IncognitoComponentApp) {
content::RunAllPendingInMessageLoop();
}
- // Listen for new shell windows so we see the file manager app launch itself.
- ShellWindowRegistry* registry = ShellWindowRegistry::Get(incognito_profile);
+ // Listen for new app windows so we see the file manager app launch itself.
+ AppWindowRegistry* registry = AppWindowRegistry::Get(incognito_profile);
ASSERT_TRUE(registry != NULL);
registry->AddObserver(this);
diff --git a/chrome/browser/apps/app_browsertest_util.cc b/chrome/browser/apps/app_browsertest_util.cc
index e2fa045..69479e1 100644
--- a/chrome/browser/apps/app_browsertest_util.cc
+++ b/chrome/browser/apps/app_browsertest_util.cc
@@ -5,7 +5,7 @@
#include "chrome/browser/apps/app_browsertest_util.h"
#include "apps/app_window_contents.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window_registry.h"
#include "apps/ui/native_app_window.h"
#include "base/command_line.h"
#include "base/strings/stringprintf.h"
@@ -19,8 +19,8 @@
#include "content/public/test/test_utils.h"
#include "extensions/common/switches.h"
-using apps::ShellWindow;
-using apps::ShellWindowRegistry;
+using apps::AppWindow;
+using apps::AppWindowRegistry;
using content::WebContents;
namespace utils = extension_function_test_utils;
@@ -41,15 +41,14 @@ void PlatformAppBrowserTest::SetUpCommandLine(CommandLine* command_line) {
}
// static
-ShellWindow* PlatformAppBrowserTest::GetFirstShellWindowForBrowser(
+AppWindow* PlatformAppBrowserTest::GetFirstAppWindowForBrowser(
Browser* browser) {
- ShellWindowRegistry* app_registry =
- ShellWindowRegistry::Get(browser->profile());
- const ShellWindowRegistry::ShellWindowList& shell_windows =
- app_registry->shell_windows();
+ AppWindowRegistry* app_registry = AppWindowRegistry::Get(browser->profile());
+ const AppWindowRegistry::AppWindowList& app_windows =
+ app_registry->app_windows();
- ShellWindowRegistry::const_iterator iter = shell_windows.begin();
- if (iter != shell_windows.end())
+ AppWindowRegistry::const_iterator iter = app_windows.begin();
+ if (iter != app_windows.end())
return *iter;
return NULL;
@@ -101,27 +100,27 @@ void PlatformAppBrowserTest::LaunchPlatformApp(const Extension* extension) {
browser()->profile(), extension, LAUNCH_CONTAINER_NONE, NEW_WINDOW));
}
-WebContents* PlatformAppBrowserTest::GetFirstShellWindowWebContents() {
- ShellWindow* window = GetFirstShellWindow();
+WebContents* PlatformAppBrowserTest::GetFirstAppWindowWebContents() {
+ AppWindow* window = GetFirstAppWindow();
if (window)
return window->web_contents();
return NULL;
}
-ShellWindow* PlatformAppBrowserTest::GetFirstShellWindow() {
- return GetFirstShellWindowForBrowser(browser());
+AppWindow* PlatformAppBrowserTest::GetFirstAppWindow() {
+ return GetFirstAppWindowForBrowser(browser());
}
-apps::ShellWindow* PlatformAppBrowserTest::GetFirstShellWindowForApp(
+apps::AppWindow* PlatformAppBrowserTest::GetFirstAppWindowForApp(
const std::string& app_id) {
- ShellWindowRegistry* app_registry =
- ShellWindowRegistry::Get(browser()->profile());
- const ShellWindowRegistry::ShellWindowList& shell_windows =
- app_registry->GetShellWindowsForApp(app_id);
+ AppWindowRegistry* app_registry =
+ AppWindowRegistry::Get(browser()->profile());
+ const AppWindowRegistry::AppWindowList& app_windows =
+ app_registry->GetAppWindowsForApp(app_id);
- ShellWindowRegistry::const_iterator iter = shell_windows.begin();
- if (iter != shell_windows.end())
+ AppWindowRegistry::const_iterator iter = app_windows.begin();
+ if (iter != app_windows.end())
return *iter;
return NULL;
@@ -151,15 +150,15 @@ bool PlatformAppBrowserTest::RunGetWindowFunctionForExtension(
return function->GetResultList() != NULL;
}
-size_t PlatformAppBrowserTest::GetShellWindowCount() {
- return ShellWindowRegistry::Get(browser()->profile())->
- shell_windows().size();
+size_t PlatformAppBrowserTest::GetAppWindowCount() {
+ return AppWindowRegistry::Get(browser()->profile())->app_windows().size();
}
-size_t PlatformAppBrowserTest::GetShellWindowCountForApp(
+size_t PlatformAppBrowserTest::GetAppWindowCountForApp(
const std::string& app_id) {
- return ShellWindowRegistry::Get(browser()->profile())->
- GetShellWindowsForApp(app_id).size();
+ return AppWindowRegistry::Get(browser()->profile())
+ ->GetAppWindowsForApp(app_id)
+ .size();
}
void PlatformAppBrowserTest::ClearCommandLineArgs() {
@@ -179,31 +178,29 @@ void PlatformAppBrowserTest::SetCommandLineArg(const std::string& test_file) {
command_line->AppendArgPath(test_doc);
}
-ShellWindow* PlatformAppBrowserTest::CreateShellWindow(
- const Extension* extension) {
- return CreateShellWindowFromParams(extension, ShellWindow::CreateParams());
+AppWindow* PlatformAppBrowserTest::CreateAppWindow(const Extension* extension) {
+ return CreateAppWindowFromParams(extension, AppWindow::CreateParams());
}
-ShellWindow* PlatformAppBrowserTest::CreateShellWindowFromParams(
- const Extension* extension, const ShellWindow::CreateParams& params) {
- ShellWindow* window = new ShellWindow(browser()->profile(),
- new ChromeShellWindowDelegate(),
- extension);
- window->Init(GURL(std::string()),
- new apps::AppWindowContents(window),
- params);
+AppWindow* PlatformAppBrowserTest::CreateAppWindowFromParams(
+ const Extension* extension,
+ const AppWindow::CreateParams& params) {
+ AppWindow* window = new AppWindow(
+ browser()->profile(), new ChromeShellWindowDelegate(), extension);
+ window->Init(
+ GURL(std::string()), new apps::AppWindowContentsImpl(window), params);
return window;
}
-void PlatformAppBrowserTest::CloseShellWindow(ShellWindow* window) {
+void PlatformAppBrowserTest::CloseAppWindow(AppWindow* window) {
content::WebContentsDestroyedWatcher destroyed_watcher(
window->web_contents());
window->GetBaseWindow()->Close();
destroyed_watcher.Wait();
}
-void PlatformAppBrowserTest::CallAdjustBoundsToBeVisibleOnScreenForShellWindow(
- ShellWindow* window,
+void PlatformAppBrowserTest::CallAdjustBoundsToBeVisibleOnScreenForAppWindow(
+ AppWindow* window,
const gfx::Rect& cached_bounds,
const gfx::Rect& cached_screen_bounds,
const gfx::Rect& current_screen_bounds,
diff --git a/chrome/browser/apps/app_browsertest_util.h b/chrome/browser/apps/app_browsertest_util.h
index e322fc0..41e883f 100644
--- a/chrome/browser/apps/app_browsertest_util.h
+++ b/chrome/browser/apps/app_browsertest_util.h
@@ -5,8 +5,7 @@
#ifndef CHROME_BROWSER_APPS_APP_BROWSERTEST_UTIL_H_
#define CHROME_BROWSER_APPS_APP_BROWSERTEST_UTIL_H_
-
-#include "apps/shell_window.h"
+#include "apps/app_window.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "content/public/common/page_transition_types.h"
@@ -26,8 +25,8 @@ class PlatformAppBrowserTest : public ExtensionApiTest {
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE;
- // Gets the first shell window that is found for a given browser.
- static apps::ShellWindow* GetFirstShellWindowForBrowser(Browser* browser);
+ // Gets the first app window that is found for a given browser.
+ static apps::AppWindow* GetFirstAppWindowForBrowser(Browser* browser);
protected:
// Runs the app named |name| out of the platform_apps subdirectory. Waits
@@ -44,17 +43,17 @@ class PlatformAppBrowserTest : public ExtensionApiTest {
// Launch the given platform app.
void LaunchPlatformApp(const Extension* extension);
- // Gets the WebContents associated with the first shell window that is found
+ // Gets the WebContents associated with the first app window that is found
// (most tests only deal with one platform app window, so this is good
// enough).
- content::WebContents* GetFirstShellWindowWebContents();
+ content::WebContents* GetFirstAppWindowWebContents();
- // Gets the first shell window that is found (most tests only deal with one
+ // Gets the first app window that is found (most tests only deal with one
// platform app window, so this is good enough).
- apps::ShellWindow* GetFirstShellWindow();
+ apps::AppWindow* GetFirstAppWindow();
- // Gets the first shell window for an app.
- apps::ShellWindow* GetFirstShellWindowForApp(const std::string& app_id);
+ // Gets the first app window for an app.
+ apps::AppWindow* GetFirstAppWindowForApp(const std::string& app_id);
// Runs chrome.windows.getAll for the given extension and returns the number
// of windows that the function returns.
@@ -65,11 +64,11 @@ class PlatformAppBrowserTest : public ExtensionApiTest {
bool RunGetWindowFunctionForExtension(int window_id,
const Extension* extension);
- // Returns the number of shell windows.
- size_t GetShellWindowCount();
+ // Returns the number of app windows.
+ size_t GetAppWindowCount();
- // Returns the number of shell windows for a specific app.
- size_t GetShellWindowCountForApp(const std::string& app_id);
+ // Returns the number of app windows for a specific app.
+ size_t GetAppWindowCountForApp(const std::string& app_id);
// The command line already has an argument on it - about:blank, which
// is set by InProcessBrowserTest::PrepareTestCommandLine. For platform app
@@ -79,19 +78,19 @@ class PlatformAppBrowserTest : public ExtensionApiTest {
// Sets up the command line for running platform apps.
void SetCommandLineArg(const std::string& test_file);
- // Creates an empty shell window for |extension|.
- apps::ShellWindow* CreateShellWindow(const Extension* extension);
+ // Creates an empty app window for |extension|.
+ apps::AppWindow* CreateAppWindow(const Extension* extension);
- apps::ShellWindow* CreateShellWindowFromParams(
+ apps::AppWindow* CreateAppWindowFromParams(
const Extension* extension,
- const apps::ShellWindow::CreateParams& params);
+ const apps::AppWindow::CreateParams& params);
// Closes |window| and waits until it's gone.
- void CloseShellWindow(apps::ShellWindow* window);
+ void CloseAppWindow(apps::AppWindow* window);
// Call AdjustBoundsToBeVisibleOnScreen of |window|.
- void CallAdjustBoundsToBeVisibleOnScreenForShellWindow(
- apps::ShellWindow* window,
+ void CallAdjustBoundsToBeVisibleOnScreenForAppWindow(
+ apps::AppWindow* window,
const gfx::Rect& cached_bounds,
const gfx::Rect& cached_screen_bounds,
const gfx::Rect& current_screen_bounds,
diff --git a/chrome/browser/apps/app_pointer_lock_interactive_uitest.cc b/chrome/browser/apps/app_pointer_lock_interactive_uitest.cc
index f849c81..401b738 100644
--- a/chrome/browser/apps/app_pointer_lock_interactive_uitest.cc
+++ b/chrome/browser/apps/app_pointer_lock_interactive_uitest.cc
@@ -20,7 +20,7 @@ class ExtensionPointerLockTest : public extensions::PlatformAppBrowserTest {
ResultCatcher catcher;
if (!ui_test_utils::ShowAndFocusNativeWindow(
- GetFirstShellWindow()->GetNativeWindow())) {
+ GetFirstAppWindow()->GetNativeWindow())) {
message_ = "Can't focus window";
return false;
}
diff --git a/chrome/browser/apps/app_url_redirector_browsertest.cc b/chrome/browser/apps/app_url_redirector_browsertest.cc
index dd5a4bc..eabb5a6 100644
--- a/chrome/browser/apps/app_url_redirector_browsertest.cc
+++ b/chrome/browser/apps/app_url_redirector_browsertest.cc
@@ -28,7 +28,7 @@ class PlatformAppUrlRedirectorBrowserTest : public PlatformAppBrowserTest {
// subdirectory);
// - navigates the current tab to the HTML page |lancher_page| (ditto);
// - then waits for |handler| to launch and send back a |handler_ack_message|;
- // - finally checks that the resulting shell window count is as expected.
+ // - finally checks that the resulting app window count is as expected.
// The |launcher_page| is supposed to trigger a navigation matching one of the
// url_handlers in the |handler|'s manifest, and thereby launch the |handler|.
void TestNavigationInTab(const char* launcher_page,
@@ -47,7 +47,7 @@ class PlatformAppUrlRedirectorBrowserTest : public PlatformAppBrowserTest {
// url_handlers in |handler|;
// - waits until |xhr_opening_page| gets a response back and changes the tab's
// title to a value indicating success/failure of the XHR;
- // - verifies that no shell windows have been opened, i.e. |handler| wasn't
+ // - verifies that no app windows have been opened, i.e. |handler| wasn't
// launched even though its url_handlers match the URL.
void TestNegativeXhrInTab(const char* xhr_opening_page,
const char* success_tab_title,
@@ -61,7 +61,7 @@ class PlatformAppUrlRedirectorBrowserTest : public PlatformAppBrowserTest {
// - waits for the |launcher| to launch and send back a |launcher_ack_message|
// (to make sure it's not the failing entity, if the test fails overall);
// - waits for the |handler| to launch and send back a |handler_ack_message|;
- // - finally checks that the resulting shell window count is as expected.
+ // - finally checks that the resulting app window count is as expected.
// The |launcher| is supposed to trigger a navigation matching one of the
// url_handlers in the |handler|'s manifest, and thereby launch the |handler|.
void TestNavigationInApp(const char* launcher,
@@ -90,7 +90,7 @@ class PlatformAppUrlRedirectorBrowserTest : public PlatformAppBrowserTest {
// - navigates the current tab to the HTML page |matching_target_page| with
// page transition |transition|;
// - waits for |handler| to launch and send back a |handler_start_message|;
- // - finally checks that the resulting shell window count is as expected.
+ // - finally checks that the resulting app window count is as expected.
void TestNavigationInBrowser(const char* matching_target_page,
content::PageTransition transition,
const char* handler,
@@ -144,7 +144,7 @@ void PlatformAppUrlRedirectorBrowserTest::TestNavigationInTab(
ASSERT_TRUE(handler_listener.WaitUntilSatisfied());
- ASSERT_EQ(1U, GetShellWindowCount());
+ ASSERT_EQ(1U, GetAppWindowCount());
}
void PlatformAppUrlRedirectorBrowserTest::TestMismatchingNavigationInTab(
@@ -169,7 +169,7 @@ void PlatformAppUrlRedirectorBrowserTest::TestMismatchingNavigationInTab(
ASSERT_EQ(success_title, title_watcher.WaitAndGetTitle());
ASSERT_EQ(1, browser()->tab_strip_model()->count());
- ASSERT_EQ(0U, GetShellWindowCount());
+ ASSERT_EQ(0U, GetAppWindowCount());
}
void PlatformAppUrlRedirectorBrowserTest::TestNegativeXhrInTab(
@@ -197,7 +197,7 @@ void PlatformAppUrlRedirectorBrowserTest::TestNegativeXhrInTab(
ASSERT_EQ(success_title, title_watcher.WaitAndGetTitle());
ASSERT_EQ(1, browser()->tab_strip_model()->count());
- ASSERT_EQ(0U, GetShellWindowCount());
+ ASSERT_EQ(0U, GetAppWindowCount());
}
void PlatformAppUrlRedirectorBrowserTest::TestNavigationInApp(
@@ -217,7 +217,7 @@ void PlatformAppUrlRedirectorBrowserTest::TestNavigationInApp(
ASSERT_TRUE(launcher_listener.WaitUntilSatisfied());
ASSERT_TRUE(handler_listener.WaitUntilSatisfied());
- ASSERT_EQ(2U, GetShellWindowCount());
+ ASSERT_EQ(2U, GetAppWindowCount());
}
void PlatformAppUrlRedirectorBrowserTest::TestNegativeNavigationInApp(
@@ -240,7 +240,7 @@ void PlatformAppUrlRedirectorBrowserTest::TestNegativeNavigationInApp(
observer.Wait();
- ASSERT_EQ(1U, GetShellWindowCount());
+ ASSERT_EQ(1U, GetAppWindowCount());
}
void PlatformAppUrlRedirectorBrowserTest::TestMismatchingNavigationInApp(
@@ -261,7 +261,7 @@ void PlatformAppUrlRedirectorBrowserTest::TestMismatchingNavigationInApp(
ASSERT_TRUE(launcher_listener.WaitUntilSatisfied());
observer.Wait();
- ASSERT_EQ(1U, GetShellWindowCount());
+ ASSERT_EQ(1U, GetAppWindowCount());
ASSERT_EQ(2, browser()->tab_strip_model()->count());
}
@@ -285,7 +285,7 @@ void PlatformAppUrlRedirectorBrowserTest::TestNavigationInBrowser(
ASSERT_TRUE(handler_listener.WaitUntilSatisfied());
- ASSERT_EQ(1U, GetShellWindowCount());
+ ASSERT_EQ(1U, GetAppWindowCount());
}
void PlatformAppUrlRedirectorBrowserTest::TestNegativeNavigationInBrowser(
@@ -310,7 +310,7 @@ void PlatformAppUrlRedirectorBrowserTest::TestNegativeNavigationInBrowser(
ui_test_utils::NavigateToURL(&params);
ASSERT_EQ(success_title, title_watcher.WaitAndGetTitle());
- ASSERT_EQ(0U, GetShellWindowCount());
+ ASSERT_EQ(0U, GetAppWindowCount());
}
void PlatformAppUrlRedirectorBrowserTest::TestMismatchingNavigationInBrowser(
diff --git a/chrome/browser/apps/app_window_browsertest.cc b/chrome/browser/apps/app_window_browsertest.cc
index 251abaf..234ee3f 100644
--- a/chrome/browser/apps/app_window_browsertest.cc
+++ b/chrome/browser/apps/app_window_browsertest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "apps/shell_window_geometry_cache.h"
+#include "apps/app_window_geometry_cache.h"
#include "chrome/browser/apps/app_browsertest_util.h"
#include "chrome/browser/extensions/extension_test_message_listener.h"
#include "chrome/browser/profiles/profile.h"
@@ -13,13 +13,13 @@
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
-using apps::ShellWindowGeometryCache;
+using apps::AppWindowGeometryCache;
-// This helper class can be used to wait for changes in the shell window
+// This helper class can be used to wait for changes in the app window
// geometry cache registry for a specific window in a specific extension.
-class GeometryCacheChangeHelper : ShellWindowGeometryCache::Observer {
+class GeometryCacheChangeHelper : AppWindowGeometryCache::Observer {
public:
- GeometryCacheChangeHelper(ShellWindowGeometryCache* cache,
+ GeometryCacheChangeHelper(AppWindowGeometryCache* cache,
const std::string& extension_id,
const std::string& window_id,
const gfx::Rect& bounds)
@@ -32,7 +32,7 @@ class GeometryCacheChangeHelper : ShellWindowGeometryCache::Observer {
cache_->AddObserver(this);
}
- // This method will block until the shell window geometry cache registry will
+ // This method will block until the app window geometry cache registry will
// provide a bound for |window_id_| that is entirely different (as in x/y/w/h)
// from the initial |bounds_|.
void WaitForEntirelyChanged() {
@@ -64,7 +64,7 @@ class GeometryCacheChangeHelper : ShellWindowGeometryCache::Observer {
}
private:
- ShellWindowGeometryCache* cache_;
+ AppWindowGeometryCache* cache_;
std::string extension_id_;
std::string window_id_;
gfx::Rect bounds_;
@@ -189,16 +189,20 @@ IN_PROC_BROWSER_TEST_F(AppWindowAPITest,
ASSERT_TRUE(geometry_listener.WaitUntilSatisfied());
GeometryCacheChangeHelper geo_change_helper_1(
- ShellWindowGeometryCache::Get(browser()->profile()), extension->id(),
+ AppWindowGeometryCache::Get(browser()->profile()),
+ extension->id(),
// The next line has information that has to stay in sync with the app.
- "test-ra", gfx::Rect(200, 200, 200, 200));
+ "test-ra",
+ gfx::Rect(200, 200, 200, 200));
GeometryCacheChangeHelper geo_change_helper_2(
- ShellWindowGeometryCache::Get(browser()->profile()), extension->id(),
+ AppWindowGeometryCache::Get(browser()->profile()),
+ extension->id(),
// The next line has information that has to stay in sync with the app.
- "test-rb", gfx::Rect(200, 200, 200, 200));
+ "test-rb",
+ gfx::Rect(200, 200, 200, 200));
- // These calls will block until the shell window geometry cache will change.
+ // These calls will block until the app window geometry cache will change.
geo_change_helper_1.WaitForEntirelyChanged();
geo_change_helper_2.WaitForEntirelyChanged();
diff --git a/chrome/browser/apps/app_window_interactive_uitest.cc b/chrome/browser/apps/app_window_interactive_uitest.cc
index 406ced9..5b79947 100644
--- a/chrome/browser/apps/app_window_interactive_uitest.cc
+++ b/chrome/browser/apps/app_window_interactive_uitest.cc
@@ -56,12 +56,12 @@ class AppWindowInteractiveTest : public extensions::PlatformAppBrowserTest {
bool SimulateKeyPress(ui::KeyboardCode key) {
return ui_test_utils::SendKeyPressToWindowSync(
- GetFirstShellWindow()->GetNativeWindow(),
- key,
- false,
- false,
- false,
- false);
+ GetFirstAppWindow()->GetNativeWindow(),
+ key,
+ false,
+ false,
+ false,
+ false);
}
// This method will wait until the application is able to ack a key event.
@@ -88,14 +88,14 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, ESCLeavesFullscreenWindow) {
// We start by making sure the window is actually focused.
ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(
- GetFirstShellWindow()->GetNativeWindow()));
+ GetFirstAppWindow()->GetNativeWindow()));
// When receiving the reply, the application will try to go fullscreen using
// the Window API but there is no synchronous way to know if that actually
// succeeded. Also, failure will not be notified. A failure case will only be
// known with a timeout.
{
- FullscreenChangeWaiter fs_changed(GetFirstShellWindow()->GetBaseWindow());
+ FullscreenChangeWaiter fs_changed(GetFirstAppWindow()->GetBaseWindow());
launched_listener.Reply("window");
@@ -111,7 +111,7 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, ESCLeavesFullscreenWindow) {
// Same idea as above but for leaving fullscreen. Fullscreen mode should be
// left when ESC is received.
{
- FullscreenChangeWaiter fs_changed(GetFirstShellWindow()->GetBaseWindow());
+ FullscreenChangeWaiter fs_changed(GetFirstAppWindow()->GetBaseWindow());
ASSERT_TRUE(SimulateKeyPress(ui::VKEY_ESCAPE));
@@ -132,7 +132,7 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, ESCLeavesFullscreenDOM) {
// We start by making sure the window is actually focused.
ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(
- GetFirstShellWindow()->GetNativeWindow()));
+ GetFirstAppWindow()->GetNativeWindow()));
launched_listener.Reply("dom");
@@ -145,7 +145,7 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, ESCLeavesFullscreenDOM) {
// actually succeeded. Also, failure will not be notified. A failure case will
// only be known with a timeout.
{
- FullscreenChangeWaiter fs_changed(GetFirstShellWindow()->GetBaseWindow());
+ FullscreenChangeWaiter fs_changed(GetFirstAppWindow()->GetBaseWindow());
WaitUntilKeyFocus();
ASSERT_TRUE(SimulateKeyPress(ui::VKEY_A));
@@ -162,7 +162,7 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, ESCLeavesFullscreenDOM) {
// Same idea as above but for leaving fullscreen. Fullscreen mode should be
// left when ESC is received.
{
- FullscreenChangeWaiter fs_changed(GetFirstShellWindow()->GetBaseWindow());
+ FullscreenChangeWaiter fs_changed(GetFirstAppWindow()->GetBaseWindow());
ASSERT_TRUE(SimulateKeyPress(ui::VKEY_ESCAPE));
@@ -184,14 +184,14 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest,
// We start by making sure the window is actually focused.
ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(
- GetFirstShellWindow()->GetNativeWindow()));
+ GetFirstAppWindow()->GetNativeWindow()));
// When receiving the reply, the application will try to go fullscreen using
// the Window API but there is no synchronous way to know if that actually
// succeeded. Also, failure will not be notified. A failure case will only be
// known with a timeout.
{
- FullscreenChangeWaiter fs_changed(GetFirstShellWindow()->GetBaseWindow());
+ FullscreenChangeWaiter fs_changed(GetFirstAppWindow()->GetBaseWindow());
launched_listener.Reply("window");
@@ -216,7 +216,7 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest,
// However, by nature, we can not guarantee that and given that we do test
// that nothing happens, we might end up with random-success when the feature
// is broken.
- EXPECT_TRUE(GetFirstShellWindow()->GetBaseWindow()->IsFullscreen());
+ EXPECT_TRUE(GetFirstAppWindow()->GetBaseWindow()->IsFullscreen());
}
IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest,
@@ -233,7 +233,7 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest,
// We start by making sure the window is actually focused.
ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(
- GetFirstShellWindow()->GetNativeWindow()));
+ GetFirstAppWindow()->GetNativeWindow()));
launched_listener.Reply("dom");
@@ -246,7 +246,7 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest,
// actually succeeded. Also, failure will not be notified. A failure case will
// only be known with a timeout.
{
- FullscreenChangeWaiter fs_changed(GetFirstShellWindow()->GetBaseWindow());
+ FullscreenChangeWaiter fs_changed(GetFirstAppWindow()->GetBaseWindow());
WaitUntilKeyFocus();
ASSERT_TRUE(SimulateKeyPress(ui::VKEY_A));
@@ -272,7 +272,7 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest,
// However, by nature, we can not guarantee that and given that we do test
// that nothing happens, we might end up with random-success when the feature
// is broken.
- EXPECT_TRUE(GetFirstShellWindow()->GetBaseWindow()->IsFullscreen());
+ EXPECT_TRUE(GetFirstAppWindow()->GetBaseWindow()->IsFullscreen());
}
// This test does not work on Linux Aura because ShowInactive() is not
diff --git a/chrome/browser/apps/ephemeral_app_browsertest.cc b/chrome/browser/apps/ephemeral_app_browsertest.cc
index 798a725..d18cbeb 100644
--- a/chrome/browser/apps/ephemeral_app_browsertest.cc
+++ b/chrome/browser/apps/ephemeral_app_browsertest.cc
@@ -78,10 +78,10 @@ class EphemeralAppBrowserTest : public PlatformAppBrowserTest {
chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED,
content::Source<Profile>(browser()->profile()));
- EXPECT_EQ(1U, GetShellWindowCountForApp(app_id));
- apps::ShellWindow* shell_window = GetFirstShellWindowForApp(app_id);
- ASSERT_TRUE(shell_window);
- CloseShellWindow(shell_window);
+ EXPECT_EQ(1U, GetAppWindowCountForApp(app_id));
+ apps::AppWindow* app_window = GetFirstAppWindowForApp(app_id);
+ ASSERT_TRUE(app_window);
+ CloseAppWindow(app_window);
event_page_destroyed_signal.Wait();
}
diff --git a/chrome/browser/apps/event_page_browsertest.cc b/chrome/browser/apps/event_page_browsertest.cc
index 2799aee..3cbcb77 100644
--- a/chrome/browser/apps/event_page_browsertest.cc
+++ b/chrome/browser/apps/event_page_browsertest.cc
@@ -28,10 +28,10 @@ class AppEventPageTest : public PlatformAppBrowserTest {
content::NotificationService::AllSources());
// Close the app window.
- EXPECT_EQ(1U, GetShellWindowCount());
- apps::ShellWindow* shell_window = GetFirstShellWindow();
- ASSERT_TRUE(shell_window);
- CloseShellWindow(shell_window);
+ EXPECT_EQ(1U, GetAppWindowCount());
+ apps::AppWindow* app_window = GetFirstAppWindow();
+ ASSERT_TRUE(app_window);
+ CloseAppWindow(app_window);
// Verify that the event page is destroyed.
event_page_suspended.Wait();
diff --git a/chrome/browser/apps/web_view_browsertest.cc b/chrome/browser/apps/web_view_browsertest.cc
index c96a591..bd154fe 100644
--- a/chrome/browser/apps/web_view_browsertest.cc
+++ b/chrome/browser/apps/web_view_browsertest.cc
@@ -520,7 +520,7 @@ class WebViewTest : public extensions::PlatformAppBrowserTest {
content::RunAllPendingInMessageLoop();
content::WebContents* embedder_web_contents =
- GetFirstShellWindowWebContents();
+ GetFirstAppWindowWebContents();
if (!embedder_web_contents) {
LOG(ERROR) << "UNABLE TO FIND EMBEDDER WEB CONTENTS.";
return;
@@ -577,7 +577,7 @@ class WebViewTest : public extensions::PlatformAppBrowserTest {
ASSERT_TRUE(loaded_listener.WaitUntilSatisfied());
content::WebContents* embedder_web_contents =
- GetFirstShellWindowWebContents();
+ GetFirstAppWindowWebContents();
ASSERT_TRUE(embedder_web_contents);
ExtensionTestMessageListener test_run_listener("PASSED", false);
@@ -906,8 +906,7 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestRemoveWebviewOnExit) {
LoadAndLaunchPlatformApp("web_view/shim");
ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
- content::WebContents* embedder_web_contents =
- GetFirstShellWindowWebContents();
+ content::WebContents* embedder_web_contents = GetFirstAppWindowWebContents();
ASSERT_TRUE(embedder_web_contents);
GURL::Replacements replace_host;
@@ -998,8 +997,7 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, InterstitialTeardown) {
SetBrowserClientForTesting(&new_client);
// Now load the guest.
- content::WebContents* embedder_web_contents =
- GetFirstShellWindowWebContents();
+ content::WebContents* embedder_web_contents = GetFirstAppWindowWebContents();
ExtensionTestMessageListener second("GuestAddedToDom", false);
EXPECT_TRUE(content::ExecuteScript(
embedder_web_contents,
@@ -1013,7 +1011,7 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, InterstitialTeardown) {
WaitForInterstitial(guest_web_contents);
// Now close the app while interstitial page being shown in guest.
- apps::ShellWindow* window = GetFirstShellWindow();
+ apps::AppWindow* window = GetFirstAppWindow();
window->GetBaseWindow()->Close();
}
@@ -1490,8 +1488,7 @@ void WebViewTest::MediaAccessAPIAllowTestHelper(const std::string& test_name) {
LoadAndLaunchPlatformApp("web_view/media_access/allow");
ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
- content::WebContents* embedder_web_contents =
- GetFirstShellWindowWebContents();
+ content::WebContents* embedder_web_contents = GetFirstAppWindowWebContents();
ASSERT_TRUE(embedder_web_contents);
MockWebContentsDelegate* mock = new MockWebContentsDelegate;
embedder_web_contents->SetDelegate(mock);
@@ -1581,12 +1578,12 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_TearDownTest) {
const extensions::Extension* extension =
LoadAndLaunchPlatformApp("web_view/teardown");
ASSERT_TRUE(first_loaded_listener.WaitUntilSatisfied());
- apps::ShellWindow* window = NULL;
- if (!GetShellWindowCount())
- window = CreateShellWindow(extension);
+ apps::AppWindow* window = NULL;
+ if (!GetAppWindowCount())
+ window = CreateAppWindow(extension);
else
- window = GetFirstShellWindow();
- CloseShellWindow(window);
+ window = GetFirstAppWindow();
+ CloseAppWindow(window);
// Load the app again.
ExtensionTestMessageListener second_loaded_listener("guest-loaded", false);
diff --git a/chrome/browser/apps/web_view_interactive_browsertest.cc b/chrome/browser/apps/web_view_interactive_browsertest.cc
index 3e66b15..e95e3ae 100644
--- a/chrome/browser/apps/web_view_interactive_browsertest.cc
+++ b/chrome/browser/apps/web_view_interactive_browsertest.cc
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
@@ -27,7 +27,7 @@
#include "ui/base/test/ui_controls.h"
#include "ui/events/keycodes/keyboard_codes.h"
-using apps::ShellWindow;
+using apps::AppWindow;
class WebViewInteractiveTest
: public extensions::PlatformAppBrowserTest {
@@ -63,20 +63,19 @@ class WebViewInteractiveTest
}
gfx::NativeWindow GetPlatformAppWindow() {
- const apps::ShellWindowRegistry::ShellWindowList& shell_windows =
- apps::ShellWindowRegistry::Get(
- browser()->profile())->shell_windows();
- return (*shell_windows.begin())->GetNativeWindow();
+ const apps::AppWindowRegistry::AppWindowList& app_windows =
+ apps::AppWindowRegistry::Get(browser()->profile())->app_windows();
+ return (*app_windows.begin())->GetNativeWindow();
}
void SendKeyPressToPlatformApp(ui::KeyboardCode key) {
- ASSERT_EQ(1U, GetShellWindowCount());
+ ASSERT_EQ(1U, GetAppWindowCount());
ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
GetPlatformAppWindow(), key, false, false, false, false));
}
void SendCopyKeyPressToPlatformApp() {
- ASSERT_EQ(1U, GetShellWindowCount());
+ ASSERT_EQ(1U, GetAppWindowCount());
#if defined(OS_MACOSX)
// Send Cmd+C on MacOSX.
ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
@@ -169,7 +168,7 @@ class WebViewInteractiveTest
// Flush any pending events to make sure we start with a clean slate.
content::RunAllPendingInMessageLoop();
- *embedder_web_contents = GetFirstShellWindowWebContents();
+ *embedder_web_contents = GetFirstAppWindowWebContents();
scoped_ptr<ExtensionTestMessageListener> done_listener(
new ExtensionTestMessageListener("TEST_PASSED", false));
@@ -336,7 +335,7 @@ class WebViewInteractiveTest
SimulateRWHMouseClick(popup_rwh, blink::WebMouseEvent::ButtonLeft, 2, 2);
content::RenderViewHost* embedder_rvh =
- GetFirstShellWindowWebContents()->GetRenderViewHost();
+ GetFirstAppWindowWebContents()->GetRenderViewHost();
gfx::Rect embedder_bounds = embedder_rvh->GetView()->GetViewBounds();
gfx::Vector2d diff = popup_bounds.origin() - embedder_bounds.origin();
LOG(INFO) << "DIFF: x = " << diff.x() << ", y = " << diff.y();
@@ -392,7 +391,7 @@ class WebViewInteractiveTest
// MessageLoop) in it.
// Now check if we got a drop and read the drop data.
- embedder_web_contents_ = GetFirstShellWindowWebContents();
+ embedder_web_contents_ = GetFirstAppWindowWebContents();
ExtensionTestMessageListener drop_listener("guest-got-drop", false);
EXPECT_TRUE(content::ExecuteScript(embedder_web_contents_,
"window.checkIfGuestGotDrop()"));
@@ -688,7 +687,7 @@ IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, DragDropWithinWebView) {
ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(GetPlatformAppWindow()));
gfx::Rect offset;
- embedder_web_contents_ = GetFirstShellWindowWebContents();
+ embedder_web_contents_ = GetFirstAppWindowWebContents();
embedder_web_contents_->GetView()->GetContainerBounds(&offset);
corner_ = gfx::Point(offset.x(), offset.y());
@@ -737,8 +736,7 @@ IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, Navigation_BackForwardKeys) {
// Flush any pending events to make sure we start with a clean slate.
content::RunAllPendingInMessageLoop();
- content::WebContents* embedder_web_contents =
- GetFirstShellWindowWebContents();
+ content::WebContents* embedder_web_contents = GetFirstAppWindowWebContents();
ASSERT_TRUE(embedder_web_contents);
ExtensionTestMessageListener done_listener(
diff --git a/chrome/browser/chromeos/app_mode/app_session_lifetime.cc b/chrome/browser/chromeos/app_mode/app_session_lifetime.cc
index ac4c9fb..bd1670b 100644
--- a/chrome/browser/chromeos/app_mode/app_session_lifetime.cc
+++ b/chrome/browser/chromeos/app_mode/app_session_lifetime.cc
@@ -4,8 +4,8 @@
#include "chrome/browser/chromeos/app_mode/app_session_lifetime.h"
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "base/basictypes.h"
#include "base/bind.h"
#include "base/lazy_instance.h"
@@ -25,7 +25,7 @@
#include "chrome/common/pref_names.h"
#include "content/public/browser/web_contents.h"
-using apps::ShellWindowRegistry;
+using apps::AppWindowRegistry;
namespace chromeos {
@@ -33,31 +33,30 @@ namespace {
// AppWindowHandler watches for app window and exits the session when the
// last app window is closed.
-class AppWindowHandler : public ShellWindowRegistry::Observer {
+class AppWindowHandler : public AppWindowRegistry::Observer {
public:
AppWindowHandler() : window_registry_(NULL) {}
virtual ~AppWindowHandler() {}
void Init(Profile* profile) {
DCHECK(!window_registry_);
- window_registry_ = ShellWindowRegistry::Get(profile);
+ window_registry_ = AppWindowRegistry::Get(profile);
if (window_registry_)
window_registry_->AddObserver(this);
}
private:
- // apps::ShellWindowRegistry::Observer overrides:
- virtual void OnShellWindowAdded(apps::ShellWindow* shell_window) OVERRIDE {}
- virtual void OnShellWindowIconChanged(apps::ShellWindow* shell_window)
- OVERRIDE {}
- virtual void OnShellWindowRemoved(apps::ShellWindow* shell_window) OVERRIDE {
- if (window_registry_->shell_windows().empty()) {
+ // apps::AppWindowRegistry::Observer overrides:
+ virtual void OnAppWindowAdded(apps::AppWindow* app_window) OVERRIDE {}
+ virtual void OnAppWindowIconChanged(apps::AppWindow* app_window) OVERRIDE {}
+ virtual void OnAppWindowRemoved(apps::AppWindow* app_window) OVERRIDE {
+ if (window_registry_->app_windows().empty()) {
chrome::AttemptUserExit();
window_registry_->RemoveObserver(this);
}
}
- apps::ShellWindowRegistry* window_registry_;
+ apps::AppWindowRegistry* window_registry_;
DISALLOW_COPY_AND_ASSIGN(AppWindowHandler);
};
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_misc.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_misc.cc
index 179c309..9c3c543 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_misc.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_misc.cc
@@ -4,8 +4,8 @@
#include "chrome/browser/chromeos/extensions/file_manager/private_api_misc.h"
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "base/files/file_path.h"
#include "base/prefs/pref_service.h"
#include "base/strings/utf_string_conversions.h"
@@ -43,17 +43,16 @@ namespace extensions {
namespace {
const char kCWSScope[] = "https://www.googleapis.com/auth/chromewebstore";
-// Obtains the current shell window.
-apps::ShellWindow*
-GetCurrentShellWindow(ChromeSyncExtensionFunction* function) {
- apps::ShellWindowRegistry* const shell_window_registry =
- apps::ShellWindowRegistry::Get(function->GetProfile());
+// Obtains the current app window.
+apps::AppWindow* GetCurrentAppWindow(ChromeSyncExtensionFunction* function) {
+ apps::AppWindowRegistry* const app_window_registry =
+ apps::AppWindowRegistry::Get(function->GetProfile());
content::WebContents* const contents = function->GetAssociatedWebContents();
content::RenderViewHost* const render_view_host =
contents ? contents->GetRenderViewHost() : NULL;
- return render_view_host ?
- shell_window_registry->GetShellWindowForRenderViewHost(render_view_host) :
- NULL;
+ return render_view_host ? app_window_registry->GetAppWindowForRenderViewHost(
+ render_view_host)
+ : NULL;
}
std::vector<linked_ptr<api::file_browser_private::ProfileInfo> >
@@ -373,15 +372,15 @@ bool FileBrowserPrivateGetProfilesFunction::RunImpl() {
profiles = GetLoggedInProfileInfoList();
// Obtains the display profile ID.
- apps::ShellWindow* const shell_window = GetCurrentShellWindow(this);
+ apps::AppWindow* const app_window = GetCurrentAppWindow(this);
chrome::MultiUserWindowManager* const window_manager =
chrome::MultiUserWindowManager::GetInstance();
const std::string current_profile_id =
multi_user_util::GetUserIDFromProfile(GetProfile());
const std::string display_profile_id =
- window_manager && shell_window ?
- window_manager->GetUserPresentingWindow(shell_window->GetNativeWindow()) :
- "";
+ window_manager && app_window ? window_manager->GetUserPresentingWindow(
+ app_window->GetNativeWindow())
+ : "";
results_ = api::file_browser_private::GetProfiles::Results::Create(
profiles,
@@ -419,9 +418,9 @@ bool FileBrowserPrivateVisitDesktopFunction::RunImpl() {
return false;
}
- // Look for the current shell window.
- apps::ShellWindow* const shell_window = GetCurrentShellWindow(this);
- if (!shell_window) {
+ // Look for the current app window.
+ apps::AppWindow* const app_window = GetCurrentAppWindow(this);
+ if (!app_window) {
SetError("Target window is not found.");
return false;
}
@@ -432,14 +431,12 @@ bool FileBrowserPrivateVisitDesktopFunction::RunImpl() {
event_router->RegisterMultiUserWindowManagerObserver();
// Move the window to the user's desktop.
- window_manager->ShowWindowForUser(
- shell_window->GetNativeWindow(),
- params->profile_id);
+ window_manager->ShowWindowForUser(app_window->GetNativeWindow(),
+ params->profile_id);
// Check the result.
- if (!window_manager->IsWindowOnDesktopOfUser(
- shell_window->GetNativeWindow(),
- params->profile_id)) {
+ if (!window_manager->IsWindowOnDesktopOfUser(app_window->GetNativeWindow(),
+ params->profile_id)) {
SetError("The window cannot visit the desktop.");
return false;
}
diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc
index 7e17544..13e4e6c 100644
--- a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc
+++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc
@@ -11,8 +11,8 @@
#include <deque>
#include <string>
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "ash/session_state_delegate.h"
#include "ash/shell.h"
#include "base/bind.h"
@@ -913,13 +913,13 @@ class MultiProfileFileManagerBrowserTest : public FileManagerBrowserTestBase {
} else if (name == "getWindowOwnerId") {
chrome::MultiUserWindowManager* const window_manager =
chrome::MultiUserWindowManager::GetInstance();
- apps::ShellWindowRegistry* const shell_window_registry =
- apps::ShellWindowRegistry::Get(profile());
+ apps::AppWindowRegistry* const app_window_registry =
+ apps::AppWindowRegistry::Get(profile());
DCHECK(window_manager);
- DCHECK(shell_window_registry);
+ DCHECK(app_window_registry);
- const apps::ShellWindowRegistry::ShellWindowList& list =
- shell_window_registry->GetShellWindowsForApp(
+ const apps::AppWindowRegistry::AppWindowList& list =
+ app_window_registry->GetAppWindowsForApp(
file_manager::kFileManagerAppId);
return list.size() == 1u ?
window_manager->GetUserPresentingWindow(
diff --git a/chrome/browser/chromeos/login/app_launch_controller.cc b/chrome/browser/chromeos/login/app_launch_controller.cc
index fb6904f..7cda1fc 100644
--- a/chrome/browser/chromeos/login/app_launch_controller.cc
+++ b/chrome/browser/chromeos/login/app_launch_controller.cc
@@ -4,8 +4,8 @@
#include "chrome/browser/chromeos/login/app_launch_controller.h"
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "base/bind.h"
#include "base/callback.h"
#include "base/files/file_path.h"
@@ -55,15 +55,15 @@ AppLaunchController::ReturnBoolCallback*
// AppLaunchController::AppWindowWatcher
class AppLaunchController::AppWindowWatcher
- : public apps::ShellWindowRegistry::Observer {
+ : public apps::AppWindowRegistry::Observer {
public:
explicit AppWindowWatcher(AppLaunchController* controller,
const std::string& app_id)
- : controller_(controller),
- app_id_(app_id),
- window_registry_(apps::ShellWindowRegistry::Get(controller->profile_)),
- weak_factory_(this) {
- if (!window_registry_->GetShellWindowsForApp(app_id).empty()) {
+ : controller_(controller),
+ app_id_(app_id),
+ window_registry_(apps::AppWindowRegistry::Get(controller->profile_)),
+ weak_factory_(this) {
+ if (!window_registry_->GetAppWindowsForApp(app_id).empty()) {
base::MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(&AppWindowWatcher::NotifyAppWindowCreated,
@@ -78,16 +78,15 @@ class AppLaunchController::AppWindowWatcher
}
private:
- // apps::ShellWindowRegistry::Observer overrides:
- virtual void OnShellWindowAdded(apps::ShellWindow* shell_window) OVERRIDE {
- if (shell_window->extension_id() == app_id_) {
+ // apps::AppWindowRegistry::Observer overrides:
+ virtual void OnAppWindowAdded(apps::AppWindow* app_window) OVERRIDE {
+ if (app_window->extension_id() == app_id_) {
window_registry_->RemoveObserver(this);
NotifyAppWindowCreated();
}
}
- virtual void OnShellWindowIconChanged(
- apps::ShellWindow* shell_window) OVERRIDE {}
- virtual void OnShellWindowRemoved(apps::ShellWindow* shell_window) OVERRIDE {}
+ virtual void OnAppWindowIconChanged(apps::AppWindow* app_window) OVERRIDE {}
+ virtual void OnAppWindowRemoved(apps::AppWindow* app_window) OVERRIDE {}
void NotifyAppWindowCreated() {
controller_->OnAppWindowCreated();
@@ -95,7 +94,7 @@ class AppLaunchController::AppWindowWatcher
AppLaunchController* controller_;
std::string app_id_;
- apps::ShellWindowRegistry* window_registry_;
+ apps::AppWindowRegistry* window_registry_;
base::WeakPtrFactory<AppWindowWatcher> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(AppWindowWatcher);
diff --git a/chrome/browser/chromeos/login/kiosk_browsertest.cc b/chrome/browser/chromeos/login/kiosk_browsertest.cc
index 4886f4b..4550b1f 100644
--- a/chrome/browser/chromeos/login/kiosk_browsertest.cc
+++ b/chrome/browser/chromeos/login/kiosk_browsertest.cc
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "apps/ui/native_app_window.h"
#include "ash/desktop_background/desktop_background_controller.h"
#include "ash/desktop_background/desktop_background_controller_observer.h"
@@ -212,18 +212,16 @@ class JsConditionWaiter {
} // namespace
// Helper class that monitors app windows to wait for a window to appear.
-class ShellWindowObserver : public apps::ShellWindowRegistry::Observer {
+class AppWindowObserver : public apps::AppWindowRegistry::Observer {
public:
- ShellWindowObserver(apps::ShellWindowRegistry* registry,
- const std::string& app_id)
+ AppWindowObserver(apps::AppWindowRegistry* registry,
+ const std::string& app_id)
: registry_(registry), app_id_(app_id), window_(NULL), running_(false) {
registry_->AddObserver(this);
}
- virtual ~ShellWindowObserver() {
- registry_->RemoveObserver(this);
- }
+ virtual ~AppWindowObserver() { registry_->RemoveObserver(this); }
- apps::ShellWindow* Wait() {
+ apps::AppWindow* Wait() {
running_ = true;
message_loop_runner_ = new content::MessageLoopRunner;
message_loop_runner_->Run();
@@ -231,29 +229,28 @@ class ShellWindowObserver : public apps::ShellWindowRegistry::Observer {
return window_;
}
- // ShellWindowRegistry::Observer
- virtual void OnShellWindowAdded(apps::ShellWindow* shell_window) OVERRIDE {
+ // AppWindowRegistry::Observer
+ virtual void OnAppWindowAdded(apps::AppWindow* app_window) OVERRIDE {
if (!running_)
return;
- if (shell_window->extension_id() == app_id_) {
- window_ = shell_window;
+ if (app_window->extension_id() == app_id_) {
+ window_ = app_window;
message_loop_runner_->Quit();
running_ = false;
}
}
- virtual void OnShellWindowIconChanged(
- apps::ShellWindow* shell_window) OVERRIDE {}
- virtual void OnShellWindowRemoved(apps::ShellWindow* shell_window) OVERRIDE {}
+ virtual void OnAppWindowIconChanged(apps::AppWindow* app_window) OVERRIDE {}
+ virtual void OnAppWindowRemoved(apps::AppWindow* app_window) OVERRIDE {}
private:
- apps::ShellWindowRegistry* registry_;
+ apps::AppWindowRegistry* registry_;
std::string app_id_;
scoped_refptr<content::MessageLoopRunner> message_loop_runner_;
- apps::ShellWindow* window_;
+ apps::AppWindow* window_;
bool running_;
- DISALLOW_COPY_AND_ASSIGN(ShellWindowObserver);
+ DISALLOW_COPY_AND_ASSIGN(AppWindowObserver);
};
class KioskTest : public OobeBaseTest {
@@ -392,10 +389,10 @@ class KioskTest : public OobeBaseTest {
EXPECT_TRUE(app);
// App should appear with its window.
- apps::ShellWindowRegistry* shell_window_registry =
- apps::ShellWindowRegistry::Get(app_profile);
- apps::ShellWindow* window =
- ShellWindowObserver(shell_window_registry, test_app_id_).Wait();
+ apps::AppWindowRegistry* app_window_registry =
+ apps::AppWindowRegistry::Get(app_profile);
+ apps::AppWindow* window =
+ AppWindowObserver(app_window_registry, test_app_id_).Wait();
EXPECT_TRUE(window);
// Login screen should be gone or fading out.
@@ -407,7 +404,7 @@ class KioskTest : public OobeBaseTest {
0.0f);
// Wait until the app terminates if it is still running.
- if (!shell_window_registry->GetShellWindowsForApp(test_app_id_).empty())
+ if (!app_window_registry->GetAppWindowsForApp(test_app_id_).empty())
content::RunMessageLoop();
// Check that the app had been informed that it is running in a kiosk
@@ -1001,9 +998,10 @@ IN_PROC_BROWSER_TEST_F(KioskEnterpriseTest, EnterpriseKioskApp) {
chromeos::KioskAppLaunchError::Get());
// Wait for the window to appear.
- apps::ShellWindow* window = ShellWindowObserver(
- apps::ShellWindowRegistry::Get(ProfileManager::GetPrimaryUserProfile()),
- kTestEnterpriseKioskApp).Wait();
+ apps::AppWindow* window =
+ AppWindowObserver(
+ apps::AppWindowRegistry::Get(ProfileManager::GetPrimaryUserProfile()),
+ kTestEnterpriseKioskApp).Wait();
ASSERT_TRUE(window);
// Check whether the app can retrieve an OAuth2 access token.
diff --git a/chrome/browser/extensions/DEPS b/chrome/browser/extensions/DEPS
index e2e659d..b4ab256 100644
--- a/chrome/browser/extensions/DEPS
+++ b/chrome/browser/extensions/DEPS
@@ -4,8 +4,8 @@ include_rules = [
# chrome/browser/extensions, the restriction of not being able
# to depend on apps will be lifted.
"-apps",
- "+apps/shell_window.h",
- "+apps/shell_window_registry.h",
+ "+apps/app_window.h",
+ "+apps/app_window_registry.h",
"-chrome/browser/apps",
# TODO(tfarina): Remove all these. crbug.com/125846.
diff --git a/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc b/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc
index 208e54d..1e4f876 100644
--- a/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc
+++ b/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc
@@ -4,8 +4,8 @@
#include "chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.h"
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "apps/ui/native_app_window.h"
#include "base/command_line.h"
#include "chrome/browser/profiles/profile.h"
@@ -30,7 +30,7 @@ namespace SetBadgeIcon = app_current_window_internal::SetBadgeIcon;
namespace SetShape = app_current_window_internal::SetShape;
namespace SetAlwaysOnTop = app_current_window_internal::SetAlwaysOnTop;
-using apps::ShellWindow;
+using apps::AppWindow;
using app_current_window_internal::Bounds;
using app_current_window_internal::Region;
using app_current_window_internal::RegionRect;
@@ -39,9 +39,9 @@ namespace extensions {
namespace {
-const char kNoAssociatedShellWindow[] =
+const char kNoAssociatedAppWindow[] =
"The context from which the function was called did not have an "
- "associated shell window.";
+ "associated app window.";
const char kDevChannelOnly[] =
"This function is currently only available in the Dev channel.";
@@ -52,87 +52,84 @@ const char kRequiresFramelessWindow[] =
const char kAlwaysOnTopPermission[] =
"The \"alwaysOnTopWindows\" permission is required.";
-const int kUnboundedSize = apps::ShellWindow::SizeConstraints::kUnboundedSize;
+const int kUnboundedSize = apps::AppWindow::SizeConstraints::kUnboundedSize;
} // namespace
bool AppCurrentWindowInternalExtensionFunction::RunImpl() {
- apps::ShellWindowRegistry* registry =
- apps::ShellWindowRegistry::Get(GetProfile());
+ apps::AppWindowRegistry* registry =
+ apps::AppWindowRegistry::Get(GetProfile());
DCHECK(registry);
content::RenderViewHost* rvh = render_view_host();
if (!rvh)
// No need to set an error, since we won't return to the caller anyway if
// there's no RVH.
return false;
- ShellWindow* window = registry->GetShellWindowForRenderViewHost(rvh);
+ AppWindow* window = registry->GetAppWindowForRenderViewHost(rvh);
if (!window) {
- error_ = kNoAssociatedShellWindow;
+ error_ = kNoAssociatedAppWindow;
return false;
}
return RunWithWindow(window);
}
-bool AppCurrentWindowInternalFocusFunction::RunWithWindow(ShellWindow* window) {
+bool AppCurrentWindowInternalFocusFunction::RunWithWindow(AppWindow* window) {
window->GetBaseWindow()->Activate();
return true;
}
bool AppCurrentWindowInternalFullscreenFunction::RunWithWindow(
- ShellWindow* window) {
+ AppWindow* window) {
window->Fullscreen();
return true;
}
bool AppCurrentWindowInternalMaximizeFunction::RunWithWindow(
- ShellWindow* window) {
+ AppWindow* window) {
window->Maximize();
return true;
}
bool AppCurrentWindowInternalMinimizeFunction::RunWithWindow(
- ShellWindow* window) {
+ AppWindow* window) {
window->Minimize();
return true;
}
-bool AppCurrentWindowInternalRestoreFunction::RunWithWindow(
- ShellWindow* window) {
+bool AppCurrentWindowInternalRestoreFunction::RunWithWindow(AppWindow* window) {
window->Restore();
return true;
}
bool AppCurrentWindowInternalDrawAttentionFunction::RunWithWindow(
- ShellWindow* window) {
+ AppWindow* window) {
window->GetBaseWindow()->FlashFrame(true);
return true;
}
bool AppCurrentWindowInternalClearAttentionFunction::RunWithWindow(
- ShellWindow* window) {
+ AppWindow* window) {
window->GetBaseWindow()->FlashFrame(false);
return true;
}
-bool AppCurrentWindowInternalShowFunction::RunWithWindow(
- ShellWindow* window) {
+bool AppCurrentWindowInternalShowFunction::RunWithWindow(AppWindow* window) {
scoped_ptr<Show::Params> params(Show::Params::Create(*args_));
CHECK(params.get());
if (params->focused && !*params->focused)
- window->Show(ShellWindow::SHOW_INACTIVE);
+ window->Show(AppWindow::SHOW_INACTIVE);
else
- window->Show(ShellWindow::SHOW_ACTIVE);
+ window->Show(AppWindow::SHOW_ACTIVE);
return true;
}
-bool AppCurrentWindowInternalHideFunction::RunWithWindow(
- ShellWindow* window) {
+bool AppCurrentWindowInternalHideFunction::RunWithWindow(AppWindow* window) {
window->Hide();
return true;
}
bool AppCurrentWindowInternalSetBoundsFunction::RunWithWindow(
- ShellWindow* window) {
+ AppWindow* window) {
// Start with the current bounds, and change any values that are specified in
// the incoming parameters.
gfx::Rect bounds = window->GetClientBounds();
@@ -153,7 +150,7 @@ bool AppCurrentWindowInternalSetBoundsFunction::RunWithWindow(
}
bool AppCurrentWindowInternalSetMinWidthFunction::RunWithWindow(
- ShellWindow* window) {
+ AppWindow* window) {
if (GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV) {
error_ = kDevChannelOnly;
return false;
@@ -169,7 +166,7 @@ bool AppCurrentWindowInternalSetMinWidthFunction::RunWithWindow(
}
bool AppCurrentWindowInternalSetMinHeightFunction::RunWithWindow(
- ShellWindow* window) {
+ AppWindow* window) {
if (GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV) {
error_ = kDevChannelOnly;
return false;
@@ -185,7 +182,7 @@ bool AppCurrentWindowInternalSetMinHeightFunction::RunWithWindow(
}
bool AppCurrentWindowInternalSetMaxWidthFunction::RunWithWindow(
- ShellWindow* window) {
+ AppWindow* window) {
if (GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV) {
error_ = kDevChannelOnly;
return false;
@@ -201,7 +198,7 @@ bool AppCurrentWindowInternalSetMaxWidthFunction::RunWithWindow(
}
bool AppCurrentWindowInternalSetMaxHeightFunction::RunWithWindow(
- ShellWindow* window) {
+ AppWindow* window) {
if (GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV) {
error_ = kDevChannelOnly;
return false;
@@ -216,8 +213,7 @@ bool AppCurrentWindowInternalSetMaxHeightFunction::RunWithWindow(
return true;
}
-bool AppCurrentWindowInternalSetIconFunction::RunWithWindow(
- ShellWindow* window) {
+bool AppCurrentWindowInternalSetIconFunction::RunWithWindow(AppWindow* window) {
if (GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV &&
GetExtension()->location() != extensions::Manifest::COMPONENT) {
error_ = kDevChannelOnly;
@@ -237,7 +233,7 @@ bool AppCurrentWindowInternalSetIconFunction::RunWithWindow(
}
bool AppCurrentWindowInternalSetBadgeIconFunction::RunWithWindow(
- ShellWindow* window) {
+ AppWindow* window) {
if (GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV) {
error_ = kDevChannelOnly;
return false;
@@ -256,7 +252,7 @@ bool AppCurrentWindowInternalSetBadgeIconFunction::RunWithWindow(
}
bool AppCurrentWindowInternalClearBadgeFunction::RunWithWindow(
- ShellWindow* window) {
+ AppWindow* window) {
if (GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV) {
error_ = kDevChannelOnly;
return false;
@@ -267,7 +263,7 @@ bool AppCurrentWindowInternalClearBadgeFunction::RunWithWindow(
}
bool AppCurrentWindowInternalSetShapeFunction::RunWithWindow(
- ShellWindow* window) {
+ AppWindow* window) {
if (!window->GetBaseWindow()->IsFrameless()) {
error_ = kRequiresFramelessWindow;
@@ -334,7 +330,7 @@ bool AppCurrentWindowInternalSetShapeFunction::RunWithWindow(
}
bool AppCurrentWindowInternalSetAlwaysOnTopFunction::RunWithWindow(
- ShellWindow* window) {
+ AppWindow* window) {
if (!GetExtension()->HasAPIPermission(
extensions::APIPermission::kAlwaysOnTopWindows)) {
error_ = kAlwaysOnTopPermission;
diff --git a/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.h b/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.h
index d8335ec..dc08502 100644
--- a/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.h
+++ b/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.h
@@ -8,7 +8,7 @@
#include "chrome/browser/extensions/chrome_extension_function.h"
namespace apps {
-class ShellWindow;
+class AppWindow;
}
namespace extensions {
@@ -18,8 +18,8 @@ class AppCurrentWindowInternalExtensionFunction
protected:
virtual ~AppCurrentWindowInternalExtensionFunction() {}
- // Invoked with the current shell window.
- virtual bool RunWithWindow(apps::ShellWindow* window) = 0;
+ // Invoked with the current app window.
+ virtual bool RunWithWindow(apps::AppWindow* window) = 0;
private:
virtual bool RunImpl() OVERRIDE;
@@ -33,7 +33,7 @@ class AppCurrentWindowInternalFocusFunction
protected:
virtual ~AppCurrentWindowInternalFocusFunction() {}
- virtual bool RunWithWindow(apps::ShellWindow* window) OVERRIDE;
+ virtual bool RunWithWindow(apps::AppWindow* window) OVERRIDE;
};
class AppCurrentWindowInternalFullscreenFunction
@@ -44,7 +44,7 @@ class AppCurrentWindowInternalFullscreenFunction
protected:
virtual ~AppCurrentWindowInternalFullscreenFunction() {}
- virtual bool RunWithWindow(apps::ShellWindow* window) OVERRIDE;
+ virtual bool RunWithWindow(apps::AppWindow* window) OVERRIDE;
};
class AppCurrentWindowInternalMaximizeFunction
@@ -55,7 +55,7 @@ class AppCurrentWindowInternalMaximizeFunction
protected:
virtual ~AppCurrentWindowInternalMaximizeFunction() {}
- virtual bool RunWithWindow(apps::ShellWindow* window) OVERRIDE;
+ virtual bool RunWithWindow(apps::AppWindow* window) OVERRIDE;
};
class AppCurrentWindowInternalMinimizeFunction
@@ -66,7 +66,7 @@ class AppCurrentWindowInternalMinimizeFunction
protected:
virtual ~AppCurrentWindowInternalMinimizeFunction() {}
- virtual bool RunWithWindow(apps::ShellWindow* window) OVERRIDE;
+ virtual bool RunWithWindow(apps::AppWindow* window) OVERRIDE;
};
class AppCurrentWindowInternalRestoreFunction
@@ -77,7 +77,7 @@ class AppCurrentWindowInternalRestoreFunction
protected:
virtual ~AppCurrentWindowInternalRestoreFunction() {}
- virtual bool RunWithWindow(apps::ShellWindow* window) OVERRIDE;
+ virtual bool RunWithWindow(apps::AppWindow* window) OVERRIDE;
};
class AppCurrentWindowInternalDrawAttentionFunction
@@ -88,7 +88,7 @@ class AppCurrentWindowInternalDrawAttentionFunction
protected:
virtual ~AppCurrentWindowInternalDrawAttentionFunction() {}
- virtual bool RunWithWindow(apps::ShellWindow* window) OVERRIDE;
+ virtual bool RunWithWindow(apps::AppWindow* window) OVERRIDE;
};
class AppCurrentWindowInternalClearAttentionFunction
@@ -99,7 +99,7 @@ class AppCurrentWindowInternalClearAttentionFunction
protected:
virtual ~AppCurrentWindowInternalClearAttentionFunction() {}
- virtual bool RunWithWindow(apps::ShellWindow* window) OVERRIDE;
+ virtual bool RunWithWindow(apps::AppWindow* window) OVERRIDE;
};
class AppCurrentWindowInternalShowFunction
@@ -110,7 +110,7 @@ class AppCurrentWindowInternalShowFunction
protected:
virtual ~AppCurrentWindowInternalShowFunction() {}
- virtual bool RunWithWindow(apps::ShellWindow* window) OVERRIDE;
+ virtual bool RunWithWindow(apps::AppWindow* window) OVERRIDE;
};
class AppCurrentWindowInternalHideFunction
@@ -121,7 +121,7 @@ class AppCurrentWindowInternalHideFunction
protected:
virtual ~AppCurrentWindowInternalHideFunction() {}
- virtual bool RunWithWindow(apps::ShellWindow* window) OVERRIDE;
+ virtual bool RunWithWindow(apps::AppWindow* window) OVERRIDE;
};
class AppCurrentWindowInternalSetBoundsFunction
@@ -131,7 +131,7 @@ class AppCurrentWindowInternalSetBoundsFunction
APP_CURRENTWINDOWINTERNAL_SETBOUNDS)
protected:
virtual ~AppCurrentWindowInternalSetBoundsFunction() {}
- virtual bool RunWithWindow(apps::ShellWindow* window) OVERRIDE;
+ virtual bool RunWithWindow(apps::AppWindow* window) OVERRIDE;
};
class AppCurrentWindowInternalSetMinWidthFunction
@@ -141,7 +141,7 @@ class AppCurrentWindowInternalSetMinWidthFunction
APP_CURRENTWINDOWINTERNAL_SETMINWIDTH)
protected:
virtual ~AppCurrentWindowInternalSetMinWidthFunction() {}
- virtual bool RunWithWindow(apps::ShellWindow* window) OVERRIDE;
+ virtual bool RunWithWindow(apps::AppWindow* window) OVERRIDE;
};
class AppCurrentWindowInternalSetMinHeightFunction
@@ -151,7 +151,7 @@ class AppCurrentWindowInternalSetMinHeightFunction
APP_CURRENTWINDOWINTERNAL_SETMINHEIGHT)
protected:
virtual ~AppCurrentWindowInternalSetMinHeightFunction() {}
- virtual bool RunWithWindow(apps::ShellWindow* window) OVERRIDE;
+ virtual bool RunWithWindow(apps::AppWindow* window) OVERRIDE;
};
class AppCurrentWindowInternalSetMaxWidthFunction
@@ -161,7 +161,7 @@ class AppCurrentWindowInternalSetMaxWidthFunction
APP_CURRENTWINDOWINTERNAL_SETMAXWIDTH)
protected:
virtual ~AppCurrentWindowInternalSetMaxWidthFunction() {}
- virtual bool RunWithWindow(apps::ShellWindow* window) OVERRIDE;
+ virtual bool RunWithWindow(apps::AppWindow* window) OVERRIDE;
};
class AppCurrentWindowInternalSetMaxHeightFunction
@@ -171,7 +171,7 @@ class AppCurrentWindowInternalSetMaxHeightFunction
APP_CURRENTWINDOWINTERNAL_SETMAXHEIGHT)
protected:
virtual ~AppCurrentWindowInternalSetMaxHeightFunction() {}
- virtual bool RunWithWindow(apps::ShellWindow* window) OVERRIDE;
+ virtual bool RunWithWindow(apps::AppWindow* window) OVERRIDE;
};
class AppCurrentWindowInternalSetIconFunction
@@ -182,7 +182,7 @@ class AppCurrentWindowInternalSetIconFunction
protected:
virtual ~AppCurrentWindowInternalSetIconFunction() {}
- virtual bool RunWithWindow(apps::ShellWindow* window) OVERRIDE;
+ virtual bool RunWithWindow(apps::AppWindow* window) OVERRIDE;
};
class AppCurrentWindowInternalSetBadgeIconFunction
@@ -193,7 +193,7 @@ class AppCurrentWindowInternalSetBadgeIconFunction
protected:
virtual ~AppCurrentWindowInternalSetBadgeIconFunction() {}
- virtual bool RunWithWindow(apps::ShellWindow* window) OVERRIDE;
+ virtual bool RunWithWindow(apps::AppWindow* window) OVERRIDE;
};
class AppCurrentWindowInternalClearBadgeFunction
@@ -204,7 +204,7 @@ class AppCurrentWindowInternalClearBadgeFunction
protected:
virtual ~AppCurrentWindowInternalClearBadgeFunction() {}
- virtual bool RunWithWindow(apps::ShellWindow* window) OVERRIDE;
+ virtual bool RunWithWindow(apps::AppWindow* window) OVERRIDE;
};
class AppCurrentWindowInternalSetShapeFunction
@@ -215,7 +215,7 @@ class AppCurrentWindowInternalSetShapeFunction
protected:
virtual ~AppCurrentWindowInternalSetShapeFunction() {}
- virtual bool RunWithWindow(apps::ShellWindow* window) OVERRIDE;
+ virtual bool RunWithWindow(apps::AppWindow* window) OVERRIDE;
};
class AppCurrentWindowInternalSetAlwaysOnTopFunction
@@ -226,7 +226,7 @@ class AppCurrentWindowInternalSetAlwaysOnTopFunction
protected:
virtual ~AppCurrentWindowInternalSetAlwaysOnTopFunction() {}
- virtual bool RunWithWindow(apps::ShellWindow* window) OVERRIDE;
+ virtual bool RunWithWindow(apps::AppWindow* window) OVERRIDE;
};
} // namespace extensions
diff --git a/chrome/browser/extensions/api/app_window/app_window_api.cc b/chrome/browser/extensions/api/app_window/app_window_api.cc
index b709e6b..7f0006d 100644
--- a/chrome/browser/extensions/api/app_window/app_window_api.cc
+++ b/chrome/browser/extensions/api/app_window/app_window_api.cc
@@ -4,9 +4,9 @@
#include "chrome/browser/extensions/api/app_window/app_window_api.h"
+#include "apps/app_window.h"
#include "apps/app_window_contents.h"
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window_registry.h"
#include "apps/ui/native_app_window.h"
#include "base/command_line.h"
#include "base/time/time.h"
@@ -36,7 +36,7 @@
#include "ui/aura/window.h"
#endif
-using apps::ShellWindow;
+using apps::AppWindow;
namespace app_window = extensions::api::app_window;
namespace Create = app_window::Create;
@@ -108,9 +108,9 @@ bool AppWindowCreateFunction::RunImpl() {
bool inject_html_titlebar = false;
// TODO(jeremya): figure out a way to pass the opening WebContents through to
- // ShellWindow::Create so we can set the opener at create time rather than
+ // AppWindow::Create so we can set the opener at create time rather than
// with a hack in AppWindowCustomBindings::GetView().
- ShellWindow::CreateParams create_params;
+ AppWindow::CreateParams create_params;
app_window::CreateWindowOptions* options = params->options.get();
if (options) {
if (options->id.get()) {
@@ -131,9 +131,9 @@ bool AppWindowCreateFunction::RunImpl() {
}
if (!options->singleton || *options->singleton) {
- ShellWindow* window = apps::ShellWindowRegistry::Get(
- GetProfile())->GetShellWindowForAppAndKey(extension_id(),
- create_params.window_key);
+ AppWindow* window = apps::AppWindowRegistry::Get(GetProfile())
+ ->GetAppWindowForAppAndKey(
+ extension_id(), create_params.window_key);
if (window) {
content::RenderViewHost* created_view =
window->web_contents()->GetRenderViewHost();
@@ -144,9 +144,9 @@ bool AppWindowCreateFunction::RunImpl() {
}
if (options->focused.get() && !*options->focused.get())
- window->Show(ShellWindow::SHOW_INACTIVE);
+ window->Show(AppWindow::SHOW_INACTIVE);
else
- window->Show(ShellWindow::SHOW_ACTIVE);
+ window->Show(AppWindow::SHOW_ACTIVE);
base::DictionaryValue* result = new base::DictionaryValue;
result->Set("viewId", new base::FundamentalValue(view_id));
@@ -195,7 +195,7 @@ bool AppWindowCreateFunction::RunImpl() {
if (GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV ||
GetExtension()->location() == extensions::Manifest::COMPONENT) {
if (options->type == extensions::api::app_window::WINDOW_TYPE_PANEL) {
- create_params.window_type = ShellWindow::WINDOW_TYPE_PANEL;
+ create_params.window_type = AppWindow::WINDOW_TYPE_PANEL;
}
}
@@ -204,12 +204,12 @@ bool AppWindowCreateFunction::RunImpl() {
(GetExtension()->HasAPIPermission(APIPermission::kExperimental) ||
CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableExperimentalExtensionApis))) {
- create_params.frame = ShellWindow::FRAME_NONE;
+ create_params.frame = AppWindow::FRAME_NONE;
inject_html_titlebar = true;
} else if (*options->frame == kNoneFrameOption) {
- create_params.frame = ShellWindow::FRAME_NONE;
+ create_params.frame = AppWindow::FRAME_NONE;
} else {
- create_params.frame = ShellWindow::FRAME_CHROME;
+ create_params.frame = AppWindow::FRAME_CHROME;
}
}
@@ -265,17 +265,16 @@ bool AppWindowCreateFunction::RunImpl() {
create_params.creator_process_id =
render_view_host_->GetProcess()->GetID();
- ShellWindow* shell_window = new ShellWindow(
+ AppWindow* app_window = new AppWindow(
GetProfile(), new ChromeShellWindowDelegate(), GetExtension());
- shell_window->Init(url,
- new apps::AppWindowContents(shell_window),
- create_params);
+ app_window->Init(
+ url, new apps::AppWindowContentsImpl(app_window), create_params);
if (chrome::IsRunningInForcedAppMode())
- shell_window->ForcedFullscreen();
+ app_window->ForcedFullscreen();
content::RenderViewHost* created_view =
- shell_window->web_contents()->GetRenderViewHost();
+ app_window->web_contents()->GetRenderViewHost();
int view_id = MSG_ROUTING_NONE;
if (create_params.creator_process_id == created_view->GetProcess()->GetID())
view_id = created_view->GetRoutingID();
@@ -284,11 +283,11 @@ bool AppWindowCreateFunction::RunImpl() {
result->Set("viewId", new base::FundamentalValue(view_id));
result->Set("injectTitlebar",
new base::FundamentalValue(inject_html_titlebar));
- result->Set("id", new base::StringValue(shell_window->window_key()));
- shell_window->GetSerializedState(result);
+ result->Set("id", new base::StringValue(app_window->window_key()));
+ app_window->GetSerializedState(result);
SetResult(result);
- if (apps::ShellWindowRegistry::Get(GetProfile())
+ if (apps::AppWindowRegistry::Get(GetProfile())
->HadDevToolsAttached(created_view)) {
new DevToolsRestorer(this, created_view);
return true;
diff --git a/chrome/browser/extensions/api/app_window/app_window_apitest.cc b/chrome/browser/extensions/api/app_window/app_window_apitest.cc
index f9246fd..99a5c02 100644
--- a/chrome/browser/extensions/api/app_window/app_window_apitest.cc
+++ b/chrome/browser/extensions/api/app_window/app_window_apitest.cc
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "apps/ui/native_app_window.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
@@ -19,29 +19,26 @@
#include "content/public/test/test_utils.h"
#endif
-using apps::ShellWindow;
+using apps::AppWindow;
namespace {
-class TestShellWindowRegistryObserver
- : public apps::ShellWindowRegistry::Observer {
+class TestAppWindowRegistryObserver : public apps::AppWindowRegistry::Observer {
public:
- explicit TestShellWindowRegistryObserver(Profile* profile)
- : profile_(profile),
- icon_updates_(0) {
- apps::ShellWindowRegistry::Get(profile_)->AddObserver(this);
+ explicit TestAppWindowRegistryObserver(Profile* profile)
+ : profile_(profile), icon_updates_(0) {
+ apps::AppWindowRegistry::Get(profile_)->AddObserver(this);
}
- virtual ~TestShellWindowRegistryObserver() {
- apps::ShellWindowRegistry::Get(profile_)->RemoveObserver(this);
+ virtual ~TestAppWindowRegistryObserver() {
+ apps::AppWindowRegistry::Get(profile_)->RemoveObserver(this);
}
- // Overridden from ShellWindowRegistry::Observer:
- virtual void OnShellWindowAdded(ShellWindow* shell_window) OVERRIDE {}
- virtual void OnShellWindowIconChanged(ShellWindow* shell_window) OVERRIDE {
+ // Overridden from AppWindowRegistry::Observer:
+ virtual void OnAppWindowAdded(AppWindow* app_window) OVERRIDE {}
+ virtual void OnAppWindowIconChanged(AppWindow* app_window) OVERRIDE {
++icon_updates_;
}
- virtual void OnShellWindowRemoved(ShellWindow* shell_window) OVERRIDE {
- }
+ virtual void OnAppWindowRemoved(AppWindow* app_window) OVERRIDE {}
int icon_updates() { return icon_updates_; }
@@ -49,7 +46,7 @@ class TestShellWindowRegistryObserver
Profile* profile_;
int icon_updates_;
- DISALLOW_COPY_AND_ASSIGN(TestShellWindowRegistryObserver);
+ DISALLOW_COPY_AND_ASSIGN(TestAppWindowRegistryObserver);
};
} // namespace
@@ -65,15 +62,15 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, DISABLED_WindowsApiBounds) {
LoadAndLaunchPlatformApp("windows_api_bounds");
ASSERT_TRUE(background_listener.WaitUntilSatisfied());
ASSERT_TRUE(ready_listener.WaitUntilSatisfied());
- ShellWindow* window = GetFirstShellWindow();
+ AppWindow* window = GetFirstAppWindow();
gfx::Rect new_bounds(100, 200, 300, 400);
new_bounds.Inset(-window->GetBaseWindow()->GetFrameInsets());
window->GetBaseWindow()->SetBounds(new_bounds);
// TODO(jeremya/asargent) figure out why in GTK the window doesn't end up
- // with exactly the bounds we set. Is it a bug in our shell window
- // implementation? crbug.com/160252
+// with exactly the bounds we set. Is it a bug in our app window
+// implementation? crbug.com/160252
#ifdef TOOLKIT_GTK
int slop = 50;
#else
@@ -103,8 +100,8 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, DISABLED_WindowsApiBounds) {
// Tests chrome.app.window.setIcon.
IN_PROC_BROWSER_TEST_F(ExperimentalPlatformAppBrowserTest, WindowsApiSetIcon) {
- scoped_ptr<TestShellWindowRegistryObserver> test_observer(
- new TestShellWindowRegistryObserver(browser()->profile()));
+ scoped_ptr<TestAppWindowRegistryObserver> test_observer(
+ new TestAppWindowRegistryObserver(browser()->profile()));
ExtensionTestMessageListener listener("IconSet", false);
LoadAndLaunchPlatformApp("windows_api_set_icon");
EXPECT_EQ(0, test_observer->icon_updates());
@@ -117,10 +114,10 @@ IN_PROC_BROWSER_TEST_F(ExperimentalPlatformAppBrowserTest, WindowsApiSetIcon) {
base::RunLoop run_loop;
run_loop.RunUntilIdle();
}
- ShellWindow* shell_window = GetFirstShellWindow();
- ASSERT_TRUE(shell_window);
+ AppWindow* app_window = GetFirstAppWindow();
+ ASSERT_TRUE(app_window);
EXPECT_NE(std::string::npos,
- shell_window->app_icon_url().spec().find("icon.png"));
+ app_window->app_icon_url().spec().find("icon.png"));
EXPECT_EQ(1, test_observer->icon_updates());
}
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.cc b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
index 3df814c..aff6ec18 100644
--- a/chrome/browser/extensions/api/developer_private/developer_private_api.cc
+++ b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
@@ -6,9 +6,9 @@
#include "apps/app_load_service.h"
#include "apps/app_restore_service.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "apps/saved_files_service.h"
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
#include "base/base64.h"
#include "base/bind.h"
#include "base/command_line.h"
@@ -76,8 +76,8 @@
#include "webkit/browser/fileapi/file_system_operation_runner.h"
#include "webkit/common/blob/shareable_file_reference.h"
-using apps::ShellWindow;
-using apps::ShellWindowRegistry;
+using apps::AppWindow;
+using apps::AppWindowRegistry;
using content::RenderViewHost;
namespace extensions {
@@ -473,20 +473,20 @@ void DeveloperPrivateGetItemsInfoFunction::
}
}
-void DeveloperPrivateGetItemsInfoFunction::
- GetShellWindowPagesForExtensionProfile(
- const Extension* extension,
- ItemInspectViewList* result) {
- ShellWindowRegistry* registry = ShellWindowRegistry::Get(GetProfile());
+void DeveloperPrivateGetItemsInfoFunction::GetAppWindowPagesForExtensionProfile(
+ const Extension* extension,
+ ItemInspectViewList* result) {
+ AppWindowRegistry* registry = AppWindowRegistry::Get(GetProfile());
if (!registry) return;
- const ShellWindowRegistry::ShellWindowList windows =
- registry->GetShellWindowsForApp(extension->id());
+ const AppWindowRegistry::AppWindowList windows =
+ registry->GetAppWindowsForApp(extension->id());
bool has_generated_background_page =
BackgroundInfo::HasGeneratedBackgroundPage(extension);
- for (ShellWindowRegistry::const_iterator it = windows.begin();
- it != windows.end(); ++it) {
+ for (AppWindowRegistry::const_iterator it = windows.begin();
+ it != windows.end();
+ ++it) {
content::WebContents* web_contents = (*it)->web_contents();
RenderViewHost* host = web_contents->GetRenderViewHost();
content::RenderProcessHost* process = host->GetProcess();
@@ -539,8 +539,8 @@ ItemInspectViewList DeveloperPrivateGetItemsInfoFunction::
process_manager->GetRenderViewHostsForExtension(extension->id()),
&result);
- // Get shell window views
- GetShellWindowPagesForExtensionProfile(extension, &result);
+ // Get app window views
+ GetAppWindowPagesForExtensionProfile(extension, &result);
// Include a link to start the lazy background page, if applicable.
if (BackgroundInfo::HasLazyBackgroundPage(extension) &&
@@ -556,7 +556,7 @@ ItemInspectViewList DeveloperPrivateGetItemsInfoFunction::
ExtensionService* service = GetProfile()->GetExtensionService();
// Repeat for the incognito process, if applicable. Don't try to get
- // shell windows for incognito process.
+ // app windows for incognito process.
if (service->profile()->HasOffTheRecordProfile() &&
IncognitoInfo::IsSplitMode(extension)) {
process_manager = ExtensionSystem::Get(
@@ -704,11 +704,11 @@ bool DeveloperPrivateShowPermissionsDialogFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &extension_id_));
ExtensionService* service = GetProfile()->GetExtensionService();
CHECK(!extension_id_.empty());
- ShellWindowRegistry* registry = ShellWindowRegistry::Get(GetProfile());
+ AppWindowRegistry* registry = AppWindowRegistry::Get(GetProfile());
DCHECK(registry);
- ShellWindow* shell_window = registry->GetShellWindowForRenderViewHost(
- render_view_host());
- prompt_.reset(new ExtensionInstallPrompt(shell_window->web_contents()));
+ AppWindow* app_window =
+ registry->GetAppWindowForRenderViewHost(render_view_host());
+ prompt_.reset(new ExtensionInstallPrompt(app_window->web_contents()));
const Extension* extension = service->GetInstalledExtension(extension_id_);
if (!extension)
@@ -784,16 +784,16 @@ bool DeveloperPrivateEnableFunction::RunImpl() {
if (enable) {
ExtensionPrefs* prefs = service->extension_prefs();
if (prefs->DidExtensionEscalatePermissions(extension_id)) {
- ShellWindowRegistry* registry = ShellWindowRegistry::Get(GetProfile());
+ AppWindowRegistry* registry = AppWindowRegistry::Get(GetProfile());
CHECK(registry);
- ShellWindow* shell_window = registry->GetShellWindowForRenderViewHost(
- render_view_host());
- if (!shell_window) {
+ AppWindow* app_window =
+ registry->GetAppWindowForRenderViewHost(render_view_host());
+ if (!app_window) {
return false;
}
ShowExtensionDisabledDialog(
- service, shell_window->web_contents(), extension);
+ service, app_window->web_contents(), extension);
} else if ((prefs->GetDisableReasons(extension_id) &
Extension::DISABLE_UNSUPPORTED_REQUIREMENT) &&
!requirements_checker_.get()) {
@@ -912,11 +912,11 @@ bool DeveloperPrivateChooseEntryFunction::ShowPicker(
const base::string16& select_title,
const ui::SelectFileDialog::FileTypeInfo& info,
int file_type_index) {
- ShellWindowRegistry* registry = ShellWindowRegistry::Get(GetProfile());
+ AppWindowRegistry* registry = AppWindowRegistry::Get(GetProfile());
DCHECK(registry);
- ShellWindow* shell_window = registry->GetShellWindowForRenderViewHost(
- render_view_host());
- if (!shell_window) {
+ AppWindow* app_window =
+ registry->GetAppWindowForRenderViewHost(render_view_host());
+ if (!app_window) {
return false;
}
@@ -924,8 +924,13 @@ bool DeveloperPrivateChooseEntryFunction::ShowPicker(
// and subsequent sending of the function response) until the user has
// selected a file or cancelled the picker. At that point, the picker will
// delete itself.
- new EntryPicker(this, shell_window->web_contents(), picker_type,
- last_directory, select_title, info, file_type_index);
+ new EntryPicker(this,
+ app_window->web_contents(),
+ picker_type,
+ last_directory,
+ select_title,
+ info,
+ file_type_index);
return true;
}
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.h b/chrome/browser/extensions/api/developer_private/developer_private_api.h
index 89036ab..a29f33a 100644
--- a/chrome/browser/extensions/api/developer_private/developer_private_api.h
+++ b/chrome/browser/extensions/api/developer_private/developer_private_api.h
@@ -172,8 +172,8 @@ class DeveloperPrivateGetItemsInfoFunction
const Extension* extension,
bool extension_is_enabled);
- void GetShellWindowPagesForExtensionProfile(const Extension* extension,
- ItemInspectViewList* result);
+ void GetAppWindowPagesForExtensionProfile(const Extension* extension,
+ ItemInspectViewList* result);
linked_ptr<developer::ItemInspectView> constructInspectView(
const GURL& url,
diff --git a/chrome/browser/extensions/api/feedback_private/feedback_browsertest.cc b/chrome/browser/extensions/api/feedback_private/feedback_browsertest.cc
index 5a89193..1c3fb0c8 100644
--- a/chrome/browser/extensions/api/feedback_private/feedback_browsertest.cc
+++ b/chrome/browser/extensions/api/feedback_private/feedback_browsertest.cc
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "base/bind.h"
#include "chrome/browser/apps/app_browsertest_util.h"
#include "chrome/browser/browser_process.h"
@@ -19,8 +19,8 @@
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_system.h"
-using apps::ShellWindow;
-using apps::ShellWindowRegistry;
+using apps::AppWindow;
+using apps::AppWindowRegistry;
using extensions::Extension;
namespace {
@@ -62,8 +62,8 @@ class FeedbackTest : public ExtensionBrowserTest {
}
void VerifyFeedbackAppLaunch() {
- ShellWindow* window =
- PlatformAppBrowserTest::GetFirstShellWindowForBrowser(browser());
+ AppWindow* window =
+ PlatformAppBrowserTest::GetFirstAppWindowForBrowser(browser());
ASSERT_TRUE(window);
const Extension* feedback_app = window->extension();
ASSERT_TRUE(feedback_app);
diff --git a/chrome/browser/extensions/api/file_system/file_system_api.cc b/chrome/browser/extensions/api/file_system/file_system_api.cc
index 81db020..291cb09 100644
--- a/chrome/browser/extensions/api/file_system/file_system_api.cc
+++ b/chrome/browser/extensions/api/file_system/file_system_api.cc
@@ -4,9 +4,9 @@
#include "chrome/browser/extensions/api/file_system/file_system_api.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "apps/saved_files_service.h"
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
#include "base/bind.h"
#include "base/file_util.h"
#include "base/files/file_path.h"
@@ -55,7 +55,7 @@
using apps::SavedFileEntry;
using apps::SavedFilesService;
-using apps::ShellWindow;
+using apps::AppWindow;
using fileapi::IsolatedContext;
const char kInvalidCallingPage[] = "Invalid calling page. This function can't "
@@ -546,17 +546,17 @@ void FileSystemChooseEntryFunction::ShowPicker(
// platform-app only.
content::WebContents* web_contents = NULL;
if (extension_->is_platform_app()) {
- apps::ShellWindowRegistry* registry =
- apps::ShellWindowRegistry::Get(GetProfile());
+ apps::AppWindowRegistry* registry =
+ apps::AppWindowRegistry::Get(GetProfile());
DCHECK(registry);
- ShellWindow* shell_window = registry->GetShellWindowForRenderViewHost(
- render_view_host());
- if (!shell_window) {
+ AppWindow* app_window =
+ registry->GetAppWindowForRenderViewHost(render_view_host());
+ if (!app_window) {
error_ = kInvalidCallingPage;
SendResponse(false);
return;
}
- web_contents = shell_window->web_contents();
+ web_contents = app_window->web_contents();
} else {
web_contents = GetAssociatedWebContents();
}
@@ -667,17 +667,17 @@ void FileSystemChooseEntryFunction::FilesSelected(
if (is_directory_) {
// Get the WebContents for the app window to be the parent window of the
// confirmation dialog if necessary.
- apps::ShellWindowRegistry* registry =
- apps::ShellWindowRegistry::Get(GetProfile());
+ apps::AppWindowRegistry* registry =
+ apps::AppWindowRegistry::Get(GetProfile());
DCHECK(registry);
- ShellWindow* shell_window = registry->GetShellWindowForRenderViewHost(
- render_view_host());
- if (!shell_window) {
+ AppWindow* app_window =
+ registry->GetAppWindowForRenderViewHost(render_view_host());
+ if (!app_window) {
error_ = kInvalidCallingPage;
SendResponse(false);
return;
}
- content::WebContents* web_contents = shell_window->web_contents();
+ content::WebContents* web_contents = app_window->web_contents();
content::BrowserThread::PostTask(
content::BrowserThread::FILE,
diff --git a/chrome/browser/extensions/api/identity/web_auth_flow.cc b/chrome/browser/extensions/api/identity/web_auth_flow.cc
index 5f51614..725e913 100644
--- a/chrome/browser/extensions/api/identity/web_auth_flow.cc
+++ b/chrome/browser/extensions/api/identity/web_auth_flow.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/extensions/api/identity/web_auth_flow.h"
-#include "apps/shell_window.h"
+#include "apps/app_window.h"
#include "base/base64.h"
#include "base/location.h"
#include "base/message_loop/message_loop.h"
@@ -30,7 +30,7 @@
#include "grit/browser_resources.h"
#include "url/gurl.h"
-using apps::ShellWindow;
+using apps::AppWindow;
using content::RenderViewHost;
using content::ResourceRedirectDetails;
using content::WebContents;
@@ -60,26 +60,26 @@ WebAuthFlow::~WebAuthFlow() {
registrar_.RemoveAll();
WebContentsObserver::Observe(NULL);
- if (!shell_window_key_.empty()) {
- apps::ShellWindowRegistry::Get(profile_)->RemoveObserver(this);
+ if (!app_window_key_.empty()) {
+ apps::AppWindowRegistry::Get(profile_)->RemoveObserver(this);
- if (shell_window_ && shell_window_->web_contents())
- shell_window_->web_contents()->Close();
+ if (app_window_ && app_window_->web_contents())
+ app_window_->web_contents()->Close();
}
}
void WebAuthFlow::Start() {
- apps::ShellWindowRegistry::Get(profile_)->AddObserver(this);
+ apps::AppWindowRegistry::Get(profile_)->AddObserver(this);
// Attach a random ID string to the window so we can recoginize it
- // in OnShellWindowAdded.
+ // in OnAppWindowAdded.
std::string random_bytes;
crypto::RandBytes(WriteInto(&random_bytes, 33), 32);
- base::Base64Encode(random_bytes, &shell_window_key_);
+ base::Base64Encode(random_bytes, &app_window_key_);
// identityPrivate.onWebFlowRequest(shell_window_key, provider_url_, mode_)
scoped_ptr<base::ListValue> args(new base::ListValue());
- args->AppendString(shell_window_key_);
+ args->AppendString(app_window_key_);
args->AppendString(provider_url_.spec());
if (mode_ == WebAuthFlow::INTERACTIVE)
args->AppendString("interactive");
@@ -108,11 +108,11 @@ void WebAuthFlow::DetachDelegateAndDelete() {
base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
}
-void WebAuthFlow::OnShellWindowAdded(ShellWindow* shell_window) {
- if (shell_window->window_key() == shell_window_key_ &&
- shell_window->extension()->id() == extension_misc::kIdentityApiUiAppId) {
- shell_window_ = shell_window;
- WebContentsObserver::Observe(shell_window->web_contents());
+void WebAuthFlow::OnAppWindowAdded(AppWindow* app_window) {
+ if (app_window->window_key() == app_window_key_ &&
+ app_window->extension()->id() == extension_misc::kIdentityApiUiAppId) {
+ app_window_ = app_window;
+ WebContentsObserver::Observe(app_window->web_contents());
registrar_.Add(
this,
@@ -121,12 +121,12 @@ void WebAuthFlow::OnShellWindowAdded(ShellWindow* shell_window) {
}
}
-void WebAuthFlow::OnShellWindowIconChanged(ShellWindow* shell_window) {}
+void WebAuthFlow::OnAppWindowIconChanged(AppWindow* app_window) {}
-void WebAuthFlow::OnShellWindowRemoved(ShellWindow* shell_window) {
- if (shell_window->window_key() == shell_window_key_ &&
- shell_window->extension()->id() == extension_misc::kIdentityApiUiAppId) {
- shell_window_ = NULL;
+void WebAuthFlow::OnAppWindowRemoved(AppWindow* app_window) {
+ if (app_window->window_key() == app_window_key_ &&
+ app_window->extension()->id() == extension_misc::kIdentityApiUiAppId) {
+ app_window_ = NULL;
registrar_.RemoveAll();
if (delegate_)
@@ -147,7 +147,7 @@ void WebAuthFlow::AfterUrlLoaded() {
void WebAuthFlow::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
- DCHECK(shell_window_);
+ DCHECK(app_window_);
if (!delegate_)
return;
@@ -162,7 +162,7 @@ void WebAuthFlow::Observe(int type,
if (web_contents &&
(web_contents->GetEmbedderWebContents() ==
WebContentsObserver::web_contents())) {
- // Switch from watching the shell window to the guest inside it.
+ // Switch from watching the app window to the guest inside it.
embedded_window_created_ = true;
WebContentsObserver::Observe(web_contents);
diff --git a/chrome/browser/extensions/api/identity/web_auth_flow.h b/chrome/browser/extensions/api/identity/web_auth_flow.h
index ed96cfa..169cc32 100644
--- a/chrome/browser/extensions/api/identity/web_auth_flow.h
+++ b/chrome/browser/extensions/api/identity/web_auth_flow.h
@@ -7,7 +7,7 @@
#include <string>
-#include "apps/shell_window_registry.h"
+#include "apps/app_window_registry.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/web_contents_observer.h"
@@ -45,7 +45,7 @@ namespace extensions {
// a window. If a window would be required, the flow fails.
class WebAuthFlow : public content::NotificationObserver,
public content::WebContentsObserver,
- public apps::ShellWindowRegistry::Observer {
+ public apps::AppWindowRegistry::Observer {
public:
enum Mode {
INTERACTIVE, // Show UI to the user if necessary.
@@ -91,11 +91,10 @@ class WebAuthFlow : public content::NotificationObserver,
private:
friend class ::WebAuthFlowTest;
- // ::ShellWindowRegistry::Observer implementation.
- virtual void OnShellWindowAdded(apps::ShellWindow* shell_window) OVERRIDE;
- virtual void OnShellWindowIconChanged(apps::ShellWindow* shell_window)
- OVERRIDE;
- virtual void OnShellWindowRemoved(apps::ShellWindow* shell_window) OVERRIDE;
+ // ::AppWindowRegistry::Observer implementation.
+ virtual void OnAppWindowAdded(apps::AppWindow* app_window) OVERRIDE;
+ virtual void OnAppWindowIconChanged(apps::AppWindow* app_window) OVERRIDE;
+ virtual void OnAppWindowRemoved(apps::AppWindow* app_window) OVERRIDE;
// NotificationObserver implementation.
virtual void Observe(int type,
@@ -134,8 +133,8 @@ class WebAuthFlow : public content::NotificationObserver,
GURL provider_url_;
Mode mode_;
- apps::ShellWindow* shell_window_;
- std::string shell_window_key_;
+ apps::AppWindow* app_window_;
+ std::string app_window_key_;
bool embedded_window_created_;
content::NotificationRegistrar registrar_;
diff --git a/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc b/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
index 3977524..ac92b99 100644
--- a/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
+++ b/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
@@ -10,8 +10,8 @@
#include <string>
#include <vector>
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "base/lazy_instance.h"
#include "base/platform_file.h"
#include "base/stl_util.h"
@@ -108,10 +108,10 @@ WebContents* GetWebContents(content::RenderViewHost* rvh,
WebContentsModalDialogManager::FromWebContents(contents);
if (!web_contents_modal_dialog_manager) {
// If there is no WebContentsModalDialogManager, then this contents is
- // probably the background page for an app. Try to find a shell window to
+ // probably the background page for an app. Try to find a app window to
// host the dialog.
- apps::ShellWindow* window = apps::ShellWindowRegistry::Get(
- profile)->GetCurrentShellWindowForApp(app_id);
+ apps::AppWindow* window = apps::AppWindowRegistry::Get(profile)
+ ->GetCurrentAppWindowForApp(app_id);
contents = window ? window->web_contents() : NULL;
}
return contents;
diff --git a/chrome/browser/extensions/api/tabs/ash_panel_contents.cc b/chrome/browser/extensions/api/tabs/ash_panel_contents.cc
index b3f2891..5173171 100644
--- a/chrome/browser/extensions/api/tabs/ash_panel_contents.cc
+++ b/chrome/browser/extensions/api/tabs/ash_panel_contents.cc
@@ -21,18 +21,18 @@
#include "extensions/common/extension.h"
#include "ui/gfx/image/image.h"
-using apps::ShellWindow;
+using apps::AppWindow;
using apps::NativeAppWindow;
// AshPanelWindowController ----------------------------------------------------
-// This class enables a ShellWindow instance to be accessed (to a limited
+// This class enables an AppWindow instance to be accessed (to a limited
// extent) via the chrome.windows and chrome.tabs API. This is a temporary
-// bridge to support instantiating ShellWindows from v1 apps, specifically
+// bridge to support instantiating AppWindows from v1 apps, specifically
// for creating Panels in Ash. See crbug.com/160645.
class AshPanelWindowController : public extensions::WindowController {
public:
- AshPanelWindowController(ShellWindow* window, Profile* profile);
+ AshPanelWindowController(AppWindow* window, Profile* profile);
virtual ~AshPanelWindowController();
void NativeWindowChanged();
@@ -51,17 +51,17 @@ class AshPanelWindowController : public extensions::WindowController {
const extensions::Extension* extension) const OVERRIDE;
private:
- ShellWindow* shell_window_; // Weak pointer; this is owned by shell_window_
+ AppWindow* app_window_; // Weak pointer; this is owned by app_window_
bool is_active_;
DISALLOW_COPY_AND_ASSIGN(AshPanelWindowController);
};
-AshPanelWindowController::AshPanelWindowController(
- ShellWindow* shell_window, Profile* profile)
- : extensions::WindowController(shell_window->GetBaseWindow(), profile),
- shell_window_(shell_window),
- is_active_(shell_window->GetBaseWindow()->IsActive()) {
+AshPanelWindowController::AshPanelWindowController(AppWindow* app_window,
+ Profile* profile)
+ : extensions::WindowController(app_window->GetBaseWindow(), profile),
+ app_window_(app_window),
+ is_active_(app_window->GetBaseWindow()->IsActive()) {
extensions::WindowControllerList::GetInstance()->AddExtensionWindow(this);
}
@@ -70,7 +70,7 @@ AshPanelWindowController::~AshPanelWindowController() {
}
int AshPanelWindowController::GetWindowId() const {
- return static_cast<int>(shell_window_->session_id().id());
+ return static_cast<int>(app_window_->session_id().id());
}
std::string AshPanelWindowController::GetWindowTypeText() const {
@@ -96,7 +96,7 @@ base::DictionaryValue* AshPanelWindowController::CreateTabValue(
(tab_index > 0)) {
return NULL;
}
- content::WebContents* web_contents = shell_window_->web_contents();
+ content::WebContents* web_contents = app_window_->web_contents();
if (!web_contents)
return NULL;
@@ -112,10 +112,9 @@ base::DictionaryValue* AshPanelWindowController::CreateTabValue(
extensions::tabs_constants::kStatusKey,
extensions::ExtensionTabUtil::GetTabStatusText(
web_contents->IsLoading()));
- tab_value->SetBoolean(
- extensions::tabs_constants::kActiveKey,
- shell_window_->GetBaseWindow()->IsActive());
- // ShellWindow only ever contains one tab, so that tab is always effectively
+ tab_value->SetBoolean(extensions::tabs_constants::kActiveKey,
+ app_window_->GetBaseWindow()->IsActive());
+ // AppWindow only ever contains one tab, so that tab is always effectively
// selcted and highlighted (for purposes of the chrome.tabs API).
tab_value->SetInteger(extensions::tabs_constants::kWindowIdKey, window_id);
tab_value->SetInteger(extensions::tabs_constants::kIdKey, window_id);
@@ -141,12 +140,12 @@ void AshPanelWindowController::SetFullscreenMode(
bool AshPanelWindowController::IsVisibleToExtension(
const extensions::Extension* extension) const {
- return shell_window_->extension() &&
- extension->id() == shell_window_->extension()->id();
+ return app_window_->extension() &&
+ extension->id() == app_window_->extension()->id();
}
void AshPanelWindowController::NativeWindowChanged() {
- bool active = shell_window_->GetBaseWindow()->IsActive();
+ bool active = app_window_->GetBaseWindow()->IsActive();
if (active == is_active_)
return;
is_active_ = active;
@@ -161,9 +160,7 @@ void AshPanelWindowController::NativeWindowChanged() {
// AshPanelContents -----------------------------------------------------
-AshPanelContents::AshPanelContents(ShellWindow* host)
- : host_(host) {
-}
+AshPanelContents::AshPanelContents(AppWindow* host) : host_(host) {}
AshPanelContents::~AshPanelContents() {
}
@@ -188,7 +185,7 @@ void AshPanelContents::Initialize(content::BrowserContext* context,
// Responsible for loading favicons for the Launcher, which uses different
// logic than the FaviconTabHelper associated with web_contents_
- // (instantiated in ShellWindow::Init())
+ // (instantiated in AppWindow::Init())
launcher_favicon_loader_.reset(
new LauncherFaviconLoader(this, web_contents_.get()));
diff --git a/chrome/browser/extensions/api/tabs/ash_panel_contents.h b/chrome/browser/extensions/api/tabs/ash_panel_contents.h
index 021e6a6..2d0e9f7 100644
--- a/chrome/browser/extensions/api/tabs/ash_panel_contents.h
+++ b/chrome/browser/extensions/api/tabs/ash_panel_contents.h
@@ -7,7 +7,7 @@
#include <vector>
-#include "apps/shell_window.h"
+#include "apps/app_window.h"
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/extension_function_dispatcher.h"
@@ -25,20 +25,20 @@ namespace extensions {
struct DraggableRegion;
}
-// apps::ShellWindowContents class specific to panel windows created by v1
+// apps::AppWindowContents class specific to panel windows created by v1
// extenstions. This class maintains a WebContents instance and observes it for
// the purpose of passing messages to the extensions system. It also creates
// an extensions::WindowController instance for interfacing with the v1
// extensions API.
-class AshPanelContents : public apps::ShellWindowContents,
+class AshPanelContents : public apps::AppWindowContents,
public content::WebContentsObserver,
public LauncherFaviconLoader::Delegate,
public ExtensionFunctionDispatcher::Delegate {
public:
- explicit AshPanelContents(apps::ShellWindow* host);
+ explicit AshPanelContents(apps::AppWindow* host);
virtual ~AshPanelContents();
- // apps::ShellWindowContents
+ // apps::AppWindowContents
virtual void Initialize(content::BrowserContext* context,
const GURL& url) OVERRIDE;
virtual void LoadContents(int32 creator_process_id) OVERRIDE;
@@ -65,7 +65,7 @@ class AshPanelContents : public apps::ShellWindowContents,
void OnRequest(const ExtensionHostMsg_Request_Params& params);
- apps::ShellWindow* host_;
+ apps::AppWindow* host_;
GURL url_;
scoped_ptr<content::WebContents> web_contents_;
scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_;
diff --git a/chrome/browser/extensions/api/tabs/tabs_api.cc b/chrome/browser/extensions/api/tabs/tabs_api.cc
index fded9c9..116202b 100644
--- a/chrome/browser/extensions/api/tabs/tabs_api.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_api.cc
@@ -8,7 +8,7 @@
#include <limits>
#include <vector>
-#include "apps/shell_window.h"
+#include "apps/app_window.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/logging.h"
@@ -90,12 +90,12 @@
#endif // OS_WIN
#if defined(USE_ASH)
-#include "apps/shell_window_registry.h"
+#include "apps/app_window_registry.h"
#include "ash/ash_switches.h"
#include "chrome/browser/extensions/api/tabs/ash_panel_contents.h"
#endif
-using apps::ShellWindow;
+using apps::AppWindow;
using content::BrowserThread;
using content::NavigationController;
using content::NavigationEntry;
@@ -523,15 +523,14 @@ bool WindowsCreateFunction::RunImpl() {
#if defined(USE_ASH)
if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) {
- ShellWindow::CreateParams create_params;
- create_params.window_type = ShellWindow::WINDOW_TYPE_V1_PANEL;
+ AppWindow::CreateParams create_params;
+ create_params.window_type = AppWindow::WINDOW_TYPE_V1_PANEL;
create_params.bounds = window_bounds;
create_params.focused = saw_focus_key && focused;
- ShellWindow* shell_window = new ShellWindow(
- window_profile, new ChromeShellWindowDelegate(),
- GetExtension());
- AshPanelContents* ash_panel_contents = new AshPanelContents(shell_window);
- shell_window->Init(urls[0], ash_panel_contents, create_params);
+ AppWindow* app_window = new AppWindow(
+ window_profile, new ChromeShellWindowDelegate(), GetExtension());
+ AshPanelContents* ash_panel_contents = new AshPanelContents(app_window);
+ app_window->Init(urls[0], ash_panel_contents, create_params);
SetResult(ash_panel_contents->GetExtensionWindowController()->
CreateWindowValueWithTabs(GetExtension()));
return true;
diff --git a/chrome/browser/extensions/extension_tab_util.cc b/chrome/browser/extensions/extension_tab_util.cc
index 15fbeb5..be7f4c9 100644
--- a/chrome/browser/extensions/extension_tab_util.cc
+++ b/chrome/browser/extensions/extension_tab_util.cc
@@ -4,8 +4,8 @@
#include "chrome/browser/extensions/extension_tab_util.h"
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "chrome/browser/extensions/api/tabs/tabs_constants.h"
#include "chrome/browser/extensions/tab_helper.h"
#include "chrome/browser/extensions/window_controller.h"
@@ -32,7 +32,7 @@
#include "extensions/common/permissions/permissions_data.h"
#include "url/gurl.h"
-using apps::ShellWindow;
+using apps::AppWindow;
using content::NavigationEntry;
using content::WebContents;
@@ -42,18 +42,17 @@ namespace {
namespace keys = tabs_constants;
-WindowController* GetShellWindowController(const WebContents* contents) {
+WindowController* GetAppWindowController(const WebContents* contents) {
Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
- apps::ShellWindowRegistry* registry =
- apps::ShellWindowRegistry::Get(profile);
+ apps::AppWindowRegistry* registry = apps::AppWindowRegistry::Get(profile);
if (!registry)
return NULL;
- ShellWindow* shell_window =
- registry->GetShellWindowForRenderViewHost(contents->GetRenderViewHost());
- if (!shell_window)
+ AppWindow* app_window =
+ registry->GetAppWindowForRenderViewHost(contents->GetRenderViewHost());
+ if (!app_window)
return NULL;
return WindowControllerList::GetInstance()->FindWindowById(
- shell_window->session_id().id());
+ app_window->session_id().id());
}
} // namespace
@@ -88,9 +87,9 @@ base::DictionaryValue* ExtensionTabUtil::CreateTabValue(
TabStripModel* tab_strip,
int tab_index,
const Extension* extension) {
- // If we have a matching ShellWindow with a controller, get the tab value
+ // If we have a matching AppWindow with a controller, get the tab value
// from its controller instead.
- WindowController* controller = GetShellWindowController(contents);
+ WindowController* controller = GetAppWindowController(contents);
if (controller &&
(!extension || controller->IsVisibleToExtension(extension))) {
return controller->CreateTabValue(extension, tab_index);
@@ -120,9 +119,9 @@ base::DictionaryValue* ExtensionTabUtil::CreateTabValue(
const WebContents* contents,
TabStripModel* tab_strip,
int tab_index) {
- // If we have a matching ShellWindow with a controller, get the tab value
+ // If we have a matching AppWindow with a controller, get the tab value
// from its controller instead.
- WindowController* controller = GetShellWindowController(contents);
+ WindowController* controller = GetAppWindowController(contents);
if (controller)
return controller->CreateTabValue(NULL, tab_index);
diff --git a/chrome/browser/extensions/window_open_apitest.cc b/chrome/browser/extensions/window_open_apitest.cc
index 39bd653..957103d 100644
--- a/chrome/browser/extensions/window_open_apitest.cc
+++ b/chrome/browser/extensions/window_open_apitest.cc
@@ -32,7 +32,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#if defined(USE_ASH)
-#include "apps/shell_window_registry.h"
+#include "apps/app_window_registry.h"
#endif
#if defined(USE_ASH) && !defined(OS_WIN)
@@ -57,8 +57,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_WindowOpen) {
int GetPanelCount(Browser* browser) {
#if defined(USE_ASH_PANELS)
- return static_cast<int>(apps::ShellWindowRegistry::Get(
- browser->profile())->shell_windows().size());
+ return static_cast<int>(
+ apps::AppWindowRegistry::Get(browser->profile())->app_windows().size());
#else
return PanelManager::GetInstance()->num_panels();
#endif
diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc
index 5d5c6b7..015b37ff 100644
--- a/chrome/browser/policy/policy_browsertest.cc
+++ b/chrome/browser/policy/policy_browsertest.cc
@@ -153,8 +153,8 @@
#endif
#if !defined(OS_MACOSX)
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "apps/ui/native_app_window.h"
#include "base/basictypes.h"
#include "base/compiler_specific.h"
@@ -534,54 +534,49 @@ void WebContentsLoadedOrDestroyedWatcher::DidStopLoading(
#if !defined(OS_MACOSX)
-// Observer used to wait for the creation of a new shell window.
-class TestAddShellWindowObserver : public apps::ShellWindowRegistry::Observer {
+// Observer used to wait for the creation of a new app window.
+class TestAddAppWindowObserver : public apps::AppWindowRegistry::Observer {
public:
- explicit TestAddShellWindowObserver(apps::ShellWindowRegistry* registry);
- virtual ~TestAddShellWindowObserver();
+ explicit TestAddAppWindowObserver(apps::AppWindowRegistry* registry);
+ virtual ~TestAddAppWindowObserver();
- // apps::ShellWindowRegistry::Observer:
- virtual void OnShellWindowAdded(apps::ShellWindow* shell_window) OVERRIDE;
- virtual void OnShellWindowIconChanged(
- apps::ShellWindow* shell_window) OVERRIDE;
- virtual void OnShellWindowRemoved(apps::ShellWindow* shell_window) OVERRIDE;
+ // apps::AppWindowRegistry::Observer:
+ virtual void OnAppWindowAdded(apps::AppWindow* app_window) OVERRIDE;
+ virtual void OnAppWindowIconChanged(apps::AppWindow* app_window) OVERRIDE;
+ virtual void OnAppWindowRemoved(apps::AppWindow* app_window) OVERRIDE;
- apps::ShellWindow* WaitForShellWindow();
+ apps::AppWindow* WaitForAppWindow();
private:
- apps::ShellWindowRegistry* registry_; // Not owned.
- apps::ShellWindow* window_; // Not owned.
+ apps::AppWindowRegistry* registry_; // Not owned.
+ apps::AppWindow* window_; // Not owned.
base::RunLoop run_loop_;
- DISALLOW_COPY_AND_ASSIGN(TestAddShellWindowObserver);
+ DISALLOW_COPY_AND_ASSIGN(TestAddAppWindowObserver);
};
-TestAddShellWindowObserver::TestAddShellWindowObserver(
- apps::ShellWindowRegistry* registry)
- : registry_(registry),
- window_(NULL) {
+TestAddAppWindowObserver::TestAddAppWindowObserver(
+ apps::AppWindowRegistry* registry)
+ : registry_(registry), window_(NULL) {
registry_->AddObserver(this);
}
-TestAddShellWindowObserver::~TestAddShellWindowObserver() {
+TestAddAppWindowObserver::~TestAddAppWindowObserver() {
registry_->RemoveObserver(this);
}
-void TestAddShellWindowObserver::OnShellWindowAdded(
- apps::ShellWindow* shell_window) {
- window_ = shell_window;
+void TestAddAppWindowObserver::OnAppWindowAdded(apps::AppWindow* app_window) {
+ window_ = app_window;
run_loop_.Quit();
}
-void TestAddShellWindowObserver::OnShellWindowIconChanged(
- apps::ShellWindow* shell_window) {
-}
+void TestAddAppWindowObserver::OnAppWindowIconChanged(
+ apps::AppWindow* app_window) {}
-void TestAddShellWindowObserver::OnShellWindowRemoved(
- apps::ShellWindow* shell_window) {
+void TestAddAppWindowObserver::OnAppWindowRemoved(apps::AppWindow* app_window) {
}
-apps::ShellWindow* TestAddShellWindowObserver::WaitForShellWindow() {
+apps::AppWindow* TestAddAppWindowObserver::WaitForAppWindow() {
run_loop_.Run();
return window_;
}
@@ -2095,13 +2090,13 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, FullscreenAllowedApp) {
ASSERT_TRUE(extension);
// Launch an app that tries to open a fullscreen window.
- TestAddShellWindowObserver add_window_observer(
- apps::ShellWindowRegistry::Get(browser()->profile()));
+ TestAddAppWindowObserver add_window_observer(
+ apps::AppWindowRegistry::Get(browser()->profile()));
OpenApplication(AppLaunchParams(browser()->profile(),
extension,
extensions::LAUNCH_CONTAINER_NONE,
NEW_WINDOW));
- apps::ShellWindow* window = add_window_observer.WaitForShellWindow();
+ apps::AppWindow* window = add_window_observer.WaitForAppWindow();
ASSERT_TRUE(window);
// Verify that the window is not in fullscreen mode.
diff --git a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
index c62bef0..887fae6 100644
--- a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
+++ b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
@@ -7,7 +7,7 @@
#include "apps/app_keep_alive_service_factory.h"
#include "apps/app_load_service_factory.h"
#include "apps/app_restore_service_factory.h"
-#include "apps/shell_window_geometry_cache.h"
+#include "apps/app_window_geometry_cache.h"
#include "chrome/browser/apps/ephemeral_app_service_factory.h"
#include "chrome/browser/apps/shortcut_manager_factory.h"
#include "chrome/browser/autofill/personal_data_manager_factory.h"
@@ -146,10 +146,10 @@
#endif
#if defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/extensions/file_manager/file_browser_private_api_factory.h"
#include "chrome/browser/chromeos/extensions/input_method_api.h"
#include "chrome/browser/chromeos/extensions/media_player_api.h"
#include "chrome/browser/chromeos/extensions/screenlock_private_api.h"
-#include "chrome/browser/chromeos/extensions/file_manager/file_browser_private_api_factory.h"
#include "chrome/browser/extensions/api/input_ime/input_ime_api.h"
#include "chrome/browser/extensions/api/log_private/log_private_api.h"
#endif
@@ -240,7 +240,7 @@ EnsureBrowserContextKeyedServiceFactoriesBuilt() {
AppShortcutManagerFactory::GetInstance();
apps::AppLoadServiceFactory::GetInstance();
apps::AppRestoreServiceFactory::GetInstance();
- apps::ShellWindowGeometryCache::Factory::GetInstance();
+ apps::AppWindowGeometryCache::Factory::GetInstance();
EphemeralAppServiceFactory::GetInstance();
extensions::ActivityLogFactory::GetInstance();
extensions::ActivityLogAPI::GetFactoryInstance();
diff --git a/chrome/browser/ui/apps/apps_metro_handler_win.cc b/chrome/browser/ui/apps/apps_metro_handler_win.cc
index 48b4204..4a50ba29 100644
--- a/chrome/browser/ui/apps/apps_metro_handler_win.cc
+++ b/chrome/browser/ui/apps/apps_metro_handler_win.cc
@@ -4,8 +4,8 @@
#include "chrome/browser/ui/apps/apps_metro_handler_win.h"
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/ui/simple_message_box.h"
#include "grit/chromium_strings.h"
@@ -16,8 +16,8 @@ bool VerifyMetroSwitchForApps(gfx::NativeWindow parent_window,
int win8_restart_command_id) {
DCHECK(win8_restart_command_id == IDC_WIN8_DESKTOP_RESTART ||
win8_restart_command_id == IDC_WIN8_METRO_RESTART);
- if (!apps::ShellWindowRegistry::IsShellWindowRegisteredInAnyProfile(
- apps::ShellWindow::WINDOW_TYPE_DEFAULT)) {
+ if (!apps::AppWindowRegistry::IsAppWindowRegisteredInAnyProfile(
+ apps::AppWindow::WINDOW_TYPE_DEFAULT)) {
return true;
}
diff --git a/chrome/browser/ui/apps/chrome_shell_window_delegate.cc b/chrome/browser/ui/apps/chrome_shell_window_delegate.cc
index 30e83bd..ee201d2 100644
--- a/chrome/browser/ui/apps/chrome_shell_window_delegate.cc
+++ b/chrome/browser/ui/apps/chrome_shell_window_delegate.cc
@@ -144,8 +144,8 @@ void ChromeShellWindowDelegate::InitWebContents(
}
apps::NativeAppWindow* ChromeShellWindowDelegate::CreateNativeAppWindow(
- apps::ShellWindow* window,
- const apps::ShellWindow::CreateParams& params) {
+ apps::AppWindow* window,
+ const apps::AppWindow::CreateParams& params) {
return CreateNativeAppWindowImpl(window, params);
}
diff --git a/chrome/browser/ui/apps/chrome_shell_window_delegate.h b/chrome/browser/ui/apps/chrome_shell_window_delegate.h
index 026e67c..21897d4 100644
--- a/chrome/browser/ui/apps/chrome_shell_window_delegate.h
+++ b/chrome/browser/ui/apps/chrome_shell_window_delegate.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_UI_APPS_CHROME_SHELL_WINDOW_DELEGATE_H_
#define CHROME_BROWSER_UI_APPS_CHROME_SHELL_WINDOW_DELEGATE_H_
-#include "apps/shell_window.h"
+#include "apps/app_window.h"
#include "base/memory/scoped_ptr.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h"
@@ -29,7 +29,8 @@ class ShellWindowLinkDelegate : public content::WebContentsDelegate {
DISALLOW_COPY_AND_ASSIGN(ShellWindowLinkDelegate);
};
-class ChromeShellWindowDelegate : public apps::ShellWindow::Delegate {
+// TODO(jamescook): Rename to ChromeAppWindowDelegate. http://crbug.com/344084
+class ChromeShellWindowDelegate : public apps::AppWindow::Delegate {
public:
ChromeShellWindowDelegate();
virtual ~ChromeShellWindowDelegate();
@@ -37,11 +38,11 @@ class ChromeShellWindowDelegate : public apps::ShellWindow::Delegate {
static void DisableExternalOpenForTesting();
private:
- // apps::ShellWindow::Delegate:
+ // apps::AppWindow::Delegate:
virtual void InitWebContents(content::WebContents* web_contents) OVERRIDE;
virtual apps::NativeAppWindow* CreateNativeAppWindow(
- apps::ShellWindow* window,
- const apps::ShellWindow::CreateParams& params) OVERRIDE;
+ apps::AppWindow* window,
+ const apps::AppWindow::CreateParams& params) OVERRIDE;
virtual content::WebContents* OpenURLFromTab(
content::BrowserContext* context,
content::WebContents* source,
@@ -71,8 +72,8 @@ class ChromeShellWindowDelegate : public apps::ShellWindow::Delegate {
// Implemented in platform specific code.
static apps::NativeAppWindow* CreateNativeAppWindowImpl(
- apps::ShellWindow* window,
- const apps::ShellWindow::CreateParams& params);
+ apps::AppWindow* window,
+ const apps::AppWindow::CreateParams& params);
scoped_ptr<ShellWindowLinkDelegate> shell_window_link_delegate_;
diff --git a/chrome/browser/ui/ash/accelerator_commands_browsertest.cc b/chrome/browser/ui/ash/accelerator_commands_browsertest.cc
index a1ae573..2bcff41 100644
--- a/chrome/browser/ui/ash/accelerator_commands_browsertest.cc
+++ b/chrome/browser/ui/ash/accelerator_commands_browsertest.cc
@@ -4,7 +4,7 @@
#include "ash/accelerators/accelerator_commands.h"
-#include "apps/shell_window.h"
+#include "apps/app_window.h"
#include "apps/ui/native_app_window.h"
#include "ash/ash_switches.h"
#include "ash/shell.h"
@@ -288,20 +288,20 @@ class AcceleratorCommandsPlatformAppFullscreenBrowserTest
virtual ~AcceleratorCommandsPlatformAppFullscreenBrowserTest() {
}
- // Sets |shell_window|'s show state to |initial_show_state_|.
- void SetToInitialShowState(apps::ShellWindow* shell_window) {
+ // Sets |app_window|'s show state to |initial_show_state_|.
+ void SetToInitialShowState(apps::AppWindow* app_window) {
if (initial_show_state_ == ui::SHOW_STATE_MAXIMIZED)
- shell_window->Maximize();
+ app_window->Maximize();
else
- shell_window->Restore();
+ app_window->Restore();
}
- // Returns true if |shell_window|'s show state is |initial_show_state_|.
- bool IsInitialShowState(apps::ShellWindow* shell_window) const {
+ // Returns true if |app_window|'s show state is |initial_show_state_|.
+ bool IsInitialShowState(apps::AppWindow* app_window) const {
if (initial_show_state_ == ui::SHOW_STATE_MAXIMIZED)
- return shell_window->GetBaseWindow()->IsMaximized();
+ return app_window->GetBaseWindow()->IsMaximized();
else
- return ui::BaseWindow::IsRestored(*shell_window->GetBaseWindow());
+ return ui::BaseWindow::IsRestored(*app_window->GetBaseWindow());
}
// content::BrowserTestBase override:
@@ -343,50 +343,48 @@ IN_PROC_BROWSER_TEST_P(AcceleratorCommandsPlatformAppFullscreenBrowserTest,
// Test that ToggleFullscreen() toggles a platform's app's fullscreen
// state and that it additionally puts the app into immersive fullscreen
// if put_all_windows_in_immersive() returns true.
- apps::ShellWindow::CreateParams params;
- params.frame = apps::ShellWindow::FRAME_CHROME;
- apps::ShellWindow* shell_window = CreateShellWindowFromParams(
- extension, params);
- apps::NativeAppWindow* app_window = shell_window->GetBaseWindow();
- SetToInitialShowState(shell_window);
- ASSERT_TRUE(shell_window->GetBaseWindow()->IsActive());
- EXPECT_TRUE(IsInitialShowState(shell_window));
+ apps::AppWindow::CreateParams params;
+ params.frame = apps::AppWindow::FRAME_CHROME;
+ apps::AppWindow* app_window = CreateAppWindowFromParams(extension, params);
+ apps::NativeAppWindow* native_app_window = app_window->GetBaseWindow();
+ SetToInitialShowState(app_window);
+ ASSERT_TRUE(app_window->GetBaseWindow()->IsActive());
+ EXPECT_TRUE(IsInitialShowState(app_window));
ash::accelerators::ToggleFullscreen();
- EXPECT_TRUE(app_window->IsFullscreen());
+ EXPECT_TRUE(native_app_window->IsFullscreen());
ash::wm::WindowState* window_state =
- ash::wm::GetWindowState(app_window->GetNativeWindow());
+ ash::wm::GetWindowState(native_app_window->GetNativeWindow());
EXPECT_EQ(put_all_windows_in_immersive(),
IsInImmersiveFullscreen(window_state));
ash::accelerators::ToggleFullscreen();
- EXPECT_TRUE(IsInitialShowState(shell_window));
+ EXPECT_TRUE(IsInitialShowState(app_window));
- CloseShellWindow(shell_window);
+ CloseAppWindow(app_window);
}
{
// Repeat the test, but make sure that frameless platform apps are never put
// into immersive fullscreen.
- apps::ShellWindow::CreateParams params;
- params.frame = apps::ShellWindow::FRAME_NONE;
- apps::ShellWindow* shell_window = CreateShellWindowFromParams(
- extension, params);
- apps::NativeAppWindow* app_window = shell_window->GetBaseWindow();
- ASSERT_TRUE(shell_window->GetBaseWindow()->IsActive());
- SetToInitialShowState(shell_window);
- EXPECT_TRUE(IsInitialShowState(shell_window));
+ apps::AppWindow::CreateParams params;
+ params.frame = apps::AppWindow::FRAME_NONE;
+ apps::AppWindow* app_window = CreateAppWindowFromParams(extension, params);
+ apps::NativeAppWindow* native_app_window = app_window->GetBaseWindow();
+ ASSERT_TRUE(app_window->GetBaseWindow()->IsActive());
+ SetToInitialShowState(app_window);
+ EXPECT_TRUE(IsInitialShowState(app_window));
ash::accelerators::ToggleFullscreen();
- EXPECT_TRUE(app_window->IsFullscreen());
+ EXPECT_TRUE(native_app_window->IsFullscreen());
ash::wm::WindowState* window_state =
- ash::wm::GetWindowState(app_window->GetNativeWindow());
+ ash::wm::GetWindowState(native_app_window->GetNativeWindow());
EXPECT_FALSE(IsInImmersiveFullscreen(window_state));
ash::accelerators::ToggleFullscreen();
- EXPECT_TRUE(IsInitialShowState(shell_window));
+ EXPECT_TRUE(IsInitialShowState(app_window));
- CloseShellWindow(shell_window);
+ CloseAppWindow(app_window);
}
}
diff --git a/chrome/browser/ui/ash/chrome_new_window_delegate_chromeos.cc b/chrome/browser/ui/ash/chrome_new_window_delegate_chromeos.cc
index acc39ab..acf1be1 100644
--- a/chrome/browser/ui/ash/chrome_new_window_delegate_chromeos.cc
+++ b/chrome/browser/ui/ash/chrome_new_window_delegate_chromeos.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/ui/ash/chrome_new_window_delegate_chromeos.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window_registry.h"
#include "apps/ui/native_app_window.h"
#include "ash/keyboard_overlay/keyboard_overlay_view.h"
#include "chrome/browser/chromeos/file_manager/app_id.h"
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.cc b/chrome/browser/ui/ash/chrome_shell_delegate.cc
index 607ea22..5fe0574 100644
--- a/chrome/browser/ui/ash/chrome_shell_delegate.cc
+++ b/chrome/browser/ui/ash/chrome_shell_delegate.cc
@@ -4,8 +4,8 @@
#include "chrome/browser/ui/ash/chrome_shell_delegate.h"
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "ash/content_support/gpu_support_impl.h"
#include "ash/host/window_tree_host_factory.h"
#include "ash/magnifier/magnifier_constants.h"
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
index e9d3b76..a9b551eb 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
@@ -4,8 +4,8 @@
#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "apps/ui/native_app_window.h"
#include "ash/ash_switches.h"
#include "ash/display/display_controller.h"
@@ -60,7 +60,7 @@
#include "ui/aura/window.h"
#include "ui/events/event.h"
-using apps::ShellWindow;
+using apps::AppWindow;
using extensions::Extension;
using content::WebContents;
@@ -78,27 +78,25 @@ class TestEvent : public ui::Event {
DISALLOW_COPY_AND_ASSIGN(TestEvent);
};
-class TestShellWindowRegistryObserver
- : public apps::ShellWindowRegistry::Observer {
+class TestAppWindowRegistryObserver : public apps::AppWindowRegistry::Observer {
public:
- explicit TestShellWindowRegistryObserver(Profile* profile)
- : profile_(profile),
- icon_updates_(0) {
- apps::ShellWindowRegistry::Get(profile_)->AddObserver(this);
+ explicit TestAppWindowRegistryObserver(Profile* profile)
+ : profile_(profile), icon_updates_(0) {
+ apps::AppWindowRegistry::Get(profile_)->AddObserver(this);
}
- virtual ~TestShellWindowRegistryObserver() {
- apps::ShellWindowRegistry::Get(profile_)->RemoveObserver(this);
+ virtual ~TestAppWindowRegistryObserver() {
+ apps::AppWindowRegistry::Get(profile_)->RemoveObserver(this);
}
- // Overridden from ShellWindowRegistry::Observer:
- virtual void OnShellWindowAdded(ShellWindow* shell_window) OVERRIDE {}
+ // Overridden from AppWindowRegistry::Observer:
+ virtual void OnAppWindowAdded(AppWindow* app_window) OVERRIDE {}
- virtual void OnShellWindowIconChanged(ShellWindow* shell_window) OVERRIDE {
+ virtual void OnAppWindowIconChanged(AppWindow* app_window) OVERRIDE {
++icon_updates_;
}
- virtual void OnShellWindowRemoved(ShellWindow* shell_window) OVERRIDE {}
+ virtual void OnAppWindowRemoved(AppWindow* app_window) OVERRIDE {}
int icon_updates() { return icon_updates_; }
@@ -106,7 +104,7 @@ class TestShellWindowRegistryObserver
Profile* profile_;
int icon_updates_;
- DISALLOW_COPY_AND_ASSIGN(TestShellWindowRegistryObserver);
+ DISALLOW_COPY_AND_ASSIGN(TestAppWindowRegistryObserver);
};
} // namespace
@@ -348,13 +346,13 @@ typedef LauncherPlatformAppBrowserTest ShelfAppBrowserMinimizeOnClick;
IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchUnpinned) {
int item_count = shelf_model()->item_count();
const Extension* extension = LoadAndLaunchPlatformApp("launch");
- ShellWindow* window = CreateShellWindow(extension);
+ AppWindow* window = CreateAppWindow(extension);
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
const ash::ShelfItem& item = GetLastLauncherItem();
EXPECT_EQ(ash::TYPE_PLATFORM_APP, item.type);
EXPECT_EQ(ash::STATUS_ACTIVE, item.status);
- CloseShellWindow(window);
+ CloseAppWindow(window);
--item_count;
EXPECT_EQ(item_count, shelf_model()->item_count());
}
@@ -376,7 +374,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchPinned) {
EXPECT_EQ(ash::STATUS_CLOSED, item.status);
// Open a window. Confirm the item is now running.
- ShellWindow* window = CreateShellWindow(extension);
+ AppWindow* window = CreateAppWindow(extension);
ash::wm::ActivateWindow(window->GetNativeWindow());
ASSERT_EQ(item_count, shelf_model()->item_count());
item = *shelf_model()->ItemByID(shortcut_id);
@@ -384,7 +382,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchPinned) {
EXPECT_EQ(ash::STATUS_ACTIVE, item.status);
// Then close it, make sure there's still an item.
- CloseShellWindow(window);
+ CloseAppWindow(window);
ASSERT_EQ(item_count, shelf_model()->item_count());
item = *shelf_model()->ItemByID(shortcut_id);
EXPECT_EQ(ash::TYPE_APP_SHORTCUT, item.type);
@@ -395,7 +393,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, PinRunning) {
// Run.
int item_count = shelf_model()->item_count();
const Extension* extension = LoadAndLaunchPlatformApp("launch");
- ShellWindow* window = CreateShellWindow(extension);
+ AppWindow* window = CreateAppWindow(extension);
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
const ash::ShelfItem& item1 = GetLastLauncherItem();
@@ -425,7 +423,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, PinRunning) {
shelf_model()->ItemIndexByID(bar_id));
// Then close it, make sure the item remains.
- CloseShellWindow(window);
+ CloseAppWindow(window);
ASSERT_EQ(item_count, shelf_model()->item_count());
}
@@ -453,7 +451,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, UnpinRunning) {
shelf_model()->ItemIndexByID(foo_id));
// Open a window. Confirm the item is now running.
- ShellWindow* window = CreateShellWindow(extension);
+ AppWindow* window = CreateAppWindow(extension);
ash::wm::ActivateWindow(window->GetNativeWindow());
ASSERT_EQ(item_count, shelf_model()->item_count());
item = *shelf_model()->ItemByID(shortcut_id);
@@ -471,7 +469,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, UnpinRunning) {
shelf_model()->ItemIndexByID(foo_id));
// Then close it, make sure the item's gone.
- CloseShellWindow(window);
+ CloseAppWindow(window);
--item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
}
@@ -482,7 +480,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, MultipleWindows) {
// First run app.
const Extension* extension = LoadAndLaunchPlatformApp("launch");
- ShellWindow* window1 = CreateShellWindow(extension);
+ AppWindow* window1 = CreateAppWindow(extension);
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
const ash::ShelfItem& item1 = GetLastLauncherItem();
@@ -492,7 +490,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, MultipleWindows) {
EXPECT_EQ(2, GetNumApplicationMenuItems(item1)); // Title + 1 window
// Add second window.
- ShellWindow* window2 = CreateShellWindow(extension);
+ AppWindow* window2 = CreateAppWindow(extension);
// Confirm item stays.
ASSERT_EQ(item_count, shelf_model()->item_count());
const ash::ShelfItem& item2 = *shelf_model()->ItemByID(item_id);
@@ -500,7 +498,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, MultipleWindows) {
EXPECT_EQ(3, GetNumApplicationMenuItems(item2)); // Title + 2 windows
// Close second window.
- CloseShellWindow(window2);
+ CloseAppWindow(window2);
// Confirm item stays.
ASSERT_EQ(item_count, shelf_model()->item_count());
const ash::ShelfItem& item3 = *shelf_model()->ItemByID(item_id);
@@ -508,7 +506,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, MultipleWindows) {
EXPECT_EQ(2, GetNumApplicationMenuItems(item3)); // Title + 1 window
// Close first window.
- CloseShellWindow(window1);
+ CloseAppWindow(window1);
// Confirm item is removed.
--item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
@@ -519,7 +517,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, MultipleApps) {
// First run app.
const Extension* extension1 = LoadAndLaunchPlatformApp("launch");
- ShellWindow* window1 = CreateShellWindow(extension1);
+ AppWindow* window1 = CreateAppWindow(extension1);
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
const ash::ShelfItem& item1 = GetLastLauncherItem();
@@ -529,7 +527,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, MultipleApps) {
// Then run second app.
const Extension* extension2 = LoadAndLaunchPlatformApp("launch_2");
- ShellWindow* window2 = CreateShellWindow(extension2);
+ AppWindow* window2 = CreateAppWindow(extension2);
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
const ash::ShelfItem& item2 = GetLastLauncherItem();
@@ -541,14 +539,14 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, MultipleApps) {
EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id1)->status);
// Close second app.
- CloseShellWindow(window2);
+ CloseAppWindow(window2);
--item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
// First app should be active again.
EXPECT_EQ(ash::STATUS_ACTIVE, shelf_model()->ItemByID(item_id1)->status);
// Close first app.
- CloseShellWindow(window1);
+ CloseAppWindow(window1);
--item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
}
@@ -560,7 +558,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, WindowActivation) {
// First run app.
const Extension* extension1 = LoadAndLaunchPlatformApp("launch");
- ShellWindow* window1 = CreateShellWindow(extension1);
+ AppWindow* window1 = CreateAppWindow(extension1);
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
const ash::ShelfItem& item1 = GetLastLauncherItem();
@@ -570,7 +568,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, WindowActivation) {
// Then run second app.
const Extension* extension2 = LoadAndLaunchPlatformApp("launch_2");
- ShellWindow* window2 = CreateShellWindow(extension2);
+ AppWindow* window2 = CreateAppWindow(extension2);
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
const ash::ShelfItem& item2 = GetLastLauncherItem();
@@ -596,7 +594,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, WindowActivation) {
EXPECT_TRUE(ash::wm::IsActiveWindow(window2->GetNativeWindow()));
// Add window for app1. This will activate it.
- ShellWindow* window1b = CreateShellWindow(extension1);
+ AppWindow* window1b = CreateAppWindow(extension1);
ash::wm::ActivateWindow(window1b->GetNativeWindow());
EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow()));
EXPECT_FALSE(ash::wm::IsActiveWindow(window2->GetNativeWindow()));
@@ -622,15 +620,15 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, WindowActivation) {
EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow()));
// Close second app.
- CloseShellWindow(window2);
+ CloseAppWindow(window2);
--item_count;
EXPECT_EQ(item_count, shelf_model()->item_count());
// First app should be active again.
EXPECT_EQ(ash::STATUS_ACTIVE, shelf_model()->ItemByID(item_id1)->status);
// Close first app.
- CloseShellWindow(window1b);
- CloseShellWindow(window1);
+ CloseAppWindow(window1b);
+ CloseAppWindow(window1);
--item_count;
EXPECT_EQ(item_count, shelf_model()->item_count());
}
@@ -639,7 +637,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, WindowActivation) {
IN_PROC_BROWSER_TEST_F(ShelfAppBrowserNoMinimizeOnClick, AppClickBehavior) {
// Launch a platform app and create a window for it.
const Extension* extension1 = LoadAndLaunchPlatformApp("launch");
- ShellWindow* window1 = CreateShellWindow(extension1);
+ AppWindow* window1 = CreateAppWindow(extension1);
EXPECT_TRUE(window1->GetNativeWindow()->IsVisible());
EXPECT_TRUE(window1->GetBaseWindow()->IsActive());
// Confirm that a controller item was created and is the correct state.
@@ -677,7 +675,7 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserMinimizeOnClick,
PackagedAppClickBehaviorInMinimizeMode) {
// Launch one platform app and create a window for it.
const Extension* extension1 = LoadAndLaunchPlatformApp("launch");
- ShellWindow* window1 = CreateShellWindow(extension1);
+ AppWindow* window1 = CreateAppWindow(extension1);
EXPECT_TRUE(window1->GetNativeWindow()->IsVisible());
EXPECT_TRUE(window1->GetBaseWindow()->IsActive());
@@ -713,7 +711,7 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserMinimizeOnClick,
// Creating a second window of the same type should change the behavior so
// that a click does not change the activation state.
- ShellWindow* window1a = CreateShellWindow(extension1);
+ AppWindow* window1a = CreateAppWindow(extension1);
EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible());
EXPECT_TRUE(window1a->GetBaseWindow()->IsActive());
// The first click does nothing.
@@ -737,10 +735,10 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, AppPanelClickBehavior) {
extensions::switches::kEnableExperimentalExtensionApis);
// Launch a platform app and create a panel window for it.
const Extension* extension1 = LoadAndLaunchPlatformApp("launch");
- ShellWindow::CreateParams params;
- params.window_type = ShellWindow::WINDOW_TYPE_PANEL;
+ AppWindow::CreateParams params;
+ params.window_type = AppWindow::WINDOW_TYPE_PANEL;
params.focused = false;
- ShellWindow* panel = CreateShellWindowFromParams(extension1, params);
+ AppWindow* panel = CreateAppWindowFromParams(extension1, params);
EXPECT_TRUE(panel->GetNativeWindow()->IsVisible());
// Panels should not be active by default.
EXPECT_FALSE(panel->GetBaseWindow()->IsActive());
@@ -771,7 +769,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, BrowserActivation) {
// First run app.
const Extension* extension1 = LoadAndLaunchPlatformApp("launch");
- CreateShellWindow(extension1);
+ CreateAppWindow(extension1);
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
const ash::ShelfItem& item1 = GetLastLauncherItem();
@@ -785,7 +783,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, BrowserActivation) {
// Test that opening an app sets the correct icon
IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, SetIcon) {
- TestShellWindowRegistryObserver test_observer(browser()->profile());
+ TestAppWindowRegistryObserver test_observer(browser()->profile());
// Enable experimental APIs to allow panel creation.
CommandLine::ForCurrentProcess()->AppendSwitch(
@@ -806,7 +804,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, SetIcon) {
run_loop.RunUntilIdle();
}
- // This test creates one shell window and one panel window.
+ // This test creates one app window and one panel window.
int shelf_item_count = shelf_model()->item_count();
ASSERT_EQ(base_shelf_item_count + 2, shelf_item_count);
// The Panel will be the last item, the app second-to-last.
@@ -1334,7 +1332,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest,
AltNumberAppsTabbing) {
// First run app.
const Extension* extension1 = LoadAndLaunchPlatformApp("launch");
- ui::BaseWindow* window1 = CreateShellWindow(extension1)->GetBaseWindow();
+ ui::BaseWindow* window1 = CreateAppWindow(extension1)->GetBaseWindow();
const ash::ShelfItem& item1 = GetLastLauncherItem();
ash::ShelfID app_id = item1.id;
int app_index = shelf_model()->ItemIndexByID(app_id);
@@ -1343,7 +1341,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest,
EXPECT_EQ(ash::STATUS_ACTIVE, item1.status);
const Extension* extension2 = LoadAndLaunchPlatformApp("launch_2");
- ui::BaseWindow* window2 = CreateShellWindow(extension2)->GetBaseWindow();
+ ui::BaseWindow* window2 = CreateAppWindow(extension2)->GetBaseWindow();
// By now the browser should be active. Issue Alt keystrokes several times to
// see that we stay on that application.
@@ -1353,7 +1351,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest,
ActivateShelfItem(app_index);
EXPECT_TRUE(window1->IsActive());
- ui::BaseWindow* window1a = CreateShellWindow(extension1)->GetBaseWindow();
+ ui::BaseWindow* window1a = CreateAppWindow(extension1)->GetBaseWindow();
EXPECT_TRUE(window1a->IsActive());
EXPECT_FALSE(window1->IsActive());
@@ -1367,17 +1365,17 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest,
IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchPanelWindow) {
int item_count = shelf_model()->item_count();
const Extension* extension = LoadAndLaunchPlatformApp("launch");
- ShellWindow::CreateParams params;
- params.window_type = ShellWindow::WINDOW_TYPE_PANEL;
+ AppWindow::CreateParams params;
+ params.window_type = AppWindow::WINDOW_TYPE_PANEL;
params.focused = false;
- ShellWindow* window = CreateShellWindowFromParams(extension, params);
+ AppWindow* window = CreateAppWindowFromParams(extension, params);
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
const ash::ShelfItem& item = GetLastLauncherPanelItem();
EXPECT_EQ(ash::TYPE_APP_PANEL, item.type);
// Opening a panel does not activate it.
EXPECT_EQ(ash::STATUS_RUNNING, item.status);
- CloseShellWindow(window);
+ CloseAppWindow(window);
--item_count;
EXPECT_EQ(item_count, shelf_model()->item_count());
}
@@ -1385,10 +1383,10 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchPanelWindow) {
// Test attention states of windows.
IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, WindowAttentionStatus) {
const Extension* extension = LoadAndLaunchPlatformApp("launch");
- ShellWindow::CreateParams params;
- params.window_type = ShellWindow::WINDOW_TYPE_PANEL;
+ AppWindow::CreateParams params;
+ params.window_type = AppWindow::WINDOW_TYPE_PANEL;
params.focused = false;
- ShellWindow* panel = CreateShellWindowFromParams(extension, params);
+ AppWindow* panel = CreateAppWindowFromParams(extension, params);
EXPECT_TRUE(panel->GetNativeWindow()->IsVisible());
// Panels should not be active by default.
EXPECT_FALSE(panel->GetBaseWindow()->IsActive());
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc
index 45413fe..760ec2c 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc
@@ -47,7 +47,7 @@
#if defined(OS_CHROMEOS)
#include "apps/app_window_contents.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window_registry.h"
#include "apps/ui/native_app_window.h"
#include "ash/test/test_session_state_delegate.h"
#include "ash/test/test_shell_delegate.h"
@@ -684,7 +684,7 @@ scoped_ptr<TestBrowserWindowAura> CreateTestBrowserWindow(
return browser_window.Pass();
}
-// A views delegate which allows creating shell windows.
+// A views delegate which allows creating app windows.
class TestViewsDelegateForAppTest : public views::TestViewsDelegate {
public:
TestViewsDelegateForAppTest() {}
@@ -782,13 +782,11 @@ class V1App : public TestBrowserWindow {
class V2App {
public:
V2App(Profile* profile, const extensions::Extension* extension) {
- window_ = new apps::ShellWindow(profile,
- new ChromeShellWindowDelegate(),
- extension);
- apps::ShellWindow::CreateParams params = apps::ShellWindow::CreateParams();
- window_->Init(GURL(std::string()),
- new apps::AppWindowContents(window_),
- params);
+ window_ = new apps::AppWindow(
+ profile, new ChromeShellWindowDelegate(), extension);
+ apps::AppWindow::CreateParams params = apps::AppWindow::CreateParams();
+ window_->Init(
+ GURL(std::string()), new apps::AppWindowContentsImpl(window_), params);
}
virtual ~V2App() {
@@ -798,10 +796,10 @@ class V2App {
}
private:
- // The shell window which represents the application. Note that the window
+ // The app window which represents the application. Note that the window
// deletes itself asynchronously after window_->GetBaseWindow()->Close() gets
// called.
- apps::ShellWindow* window_;
+ apps::AppWindow* window_;
DISALLOW_COPY_AND_ASSIGN(V2App);
};
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_win.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_win.cc
index 1e2267f..3e50a71 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_win.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_win.cc
@@ -4,8 +4,8 @@
#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "base/path_service.h"
#include "base/strings/string16.h"
#include "base/strings/stringprintf.h"
@@ -22,9 +22,9 @@ bool ChromeLauncherController::LaunchedInNativeDesktop(
// launch request through the viewer process to desktop Chrome. This allows
// Ash to relinquish foreground window status and trigger a switch to
// desktop mode.
- apps::ShellWindow* any_existing_window =
- apps::ShellWindowRegistry::Get(profile())->
- GetCurrentShellWindowForApp(app_id);
+ apps::AppWindow* any_existing_window =
+ apps::AppWindowRegistry::Get(profile())
+ ->GetCurrentAppWindowForApp(app_id);
if (!any_existing_window ||
chrome::GetHostDesktopTypeForNativeWindow(
any_existing_window->GetNativeWindow())
diff --git a/chrome/browser/ui/ash/launcher/multi_profile_shell_window_launcher_controller.cc b/chrome/browser/ui/ash/launcher/multi_profile_shell_window_launcher_controller.cc
index dd171f1..7e8d808 100644
--- a/chrome/browser/ui/ash/launcher/multi_profile_shell_window_launcher_controller.cc
+++ b/chrome/browser/ui/ash/launcher/multi_profile_shell_window_launcher_controller.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/ui/ash/launcher/multi_profile_shell_window_launcher_controller.h"
-#include "apps/shell_window.h"
+#include "apps/app_window.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
@@ -29,8 +29,9 @@ MultiProfileShellWindowLauncherController::
MultiProfileShellWindowLauncherController::
~MultiProfileShellWindowLauncherController() {
// We need to remove all Registry observers for added users.
- for (ShellWindowRegistryList::iterator it = multi_user_registry_.begin();
- it != multi_user_registry_.end(); ++it)
+ for (AppWindowRegistryList::iterator it = multi_user_registry_.begin();
+ it != multi_user_registry_.end();
+ ++it)
(*it)->RemoveObserver(this);
}
@@ -40,48 +41,49 @@ void MultiProfileShellWindowLauncherController::ActiveUserChanged(
// show / hide them one by one. To avoid that a user dependent state
// "survives" in a launcher item, we first delete all items making sure that
// nothing remains and then re-create them again.
- for (ShellWindowList::iterator it = shell_window_list_.begin();
- it != shell_window_list_.end(); ++it) {
- apps::ShellWindow* shell_window = *it;
+ for (AppWindowList::iterator it = app_window_list_.begin();
+ it != app_window_list_.end();
+ ++it) {
+ apps::AppWindow* app_window = *it;
Profile* profile =
- Profile::FromBrowserContext(shell_window->browser_context());
+ Profile::FromBrowserContext(app_window->browser_context());
if (!multi_user_util::IsProfileFromActiveUser(profile) &&
- IsRegisteredApp(shell_window->GetNativeWindow()))
- UnregisterApp(shell_window->GetNativeWindow());
+ IsRegisteredApp(app_window->GetNativeWindow()))
+ UnregisterApp(app_window->GetNativeWindow());
}
- for (ShellWindowList::iterator it = shell_window_list_.begin();
- it != shell_window_list_.end(); ++it) {
- apps::ShellWindow* shell_window = *it;
+ for (AppWindowList::iterator it = app_window_list_.begin();
+ it != app_window_list_.end();
+ ++it) {
+ apps::AppWindow* app_window = *it;
Profile* profile =
- Profile::FromBrowserContext(shell_window->browser_context());
+ Profile::FromBrowserContext(app_window->browser_context());
if (multi_user_util::IsProfileFromActiveUser(profile) &&
- !IsRegisteredApp(shell_window->GetNativeWindow()))
+ !IsRegisteredApp(app_window->GetNativeWindow()))
RegisterApp(*it);
}
}
void MultiProfileShellWindowLauncherController::AdditionalUserAddedToSession(
Profile* profile) {
- // Each users ShellRegistry needs to be observed.
- apps::ShellWindowRegistry* registry = apps::ShellWindowRegistry::Get(profile);
+ // Each users AppWindowRegistry needs to be observed.
+ apps::AppWindowRegistry* registry = apps::AppWindowRegistry::Get(profile);
multi_user_registry_.push_back(registry);
registry->AddObserver(this);
}
-void MultiProfileShellWindowLauncherController::OnShellWindowAdded(
- apps::ShellWindow* shell_window) {
- if (!ControlsWindow(shell_window->GetNativeWindow()))
+void MultiProfileShellWindowLauncherController::OnAppWindowAdded(
+ apps::AppWindow* app_window) {
+ if (!ControlsWindow(app_window->GetNativeWindow()))
return;
- shell_window_list_.push_back(shell_window);
- Profile* profile =
- Profile::FromBrowserContext(shell_window->browser_context());
+ app_window_list_.push_back(app_window);
+ Profile* profile = Profile::FromBrowserContext(app_window->browser_context());
if (multi_user_util::IsProfileFromActiveUser(profile))
- RegisterApp(shell_window);
+ RegisterApp(app_window);
}
-void MultiProfileShellWindowLauncherController::OnShellWindowRemoved(
- apps::ShellWindow* shell_window) {
- if (!ControlsWindow(shell_window->GetNativeWindow()))
+void MultiProfileShellWindowLauncherController::OnAppWindowRemoved(
+ apps::AppWindow* app_window) {
+ if (!ControlsWindow(app_window->GetNativeWindow()))
return;
// If the application is registered with ShellWindowLauncher (because the user
@@ -89,9 +91,8 @@ void MultiProfileShellWindowLauncherController::OnShellWindowRemoved(
// soon) unregister it independently from the shelf. If it was not registered
// we don't need to do anything anyways. As such, all which is left to do here
// is to get rid of our own reference.
- ShellWindowList::iterator it = std::find(shell_window_list_.begin(),
- shell_window_list_.end(),
- shell_window);
- DCHECK(it != shell_window_list_.end());
- shell_window_list_.erase(it);
+ AppWindowList::iterator it =
+ std::find(app_window_list_.begin(), app_window_list_.end(), app_window);
+ DCHECK(it != app_window_list_.end());
+ app_window_list_.erase(it);
}
diff --git a/chrome/browser/ui/ash/launcher/multi_profile_shell_window_launcher_controller.h b/chrome/browser/ui/ash/launcher/multi_profile_shell_window_launcher_controller.h
index 091f18c..dd6bd28 100644
--- a/chrome/browser/ui/ash/launcher/multi_profile_shell_window_launcher_controller.h
+++ b/chrome/browser/ui/ash/launcher/multi_profile_shell_window_launcher_controller.h
@@ -9,6 +9,8 @@
// Inherits from ShellWindowLauncherController and overwrites the ShellWindow
// observing functions to switch between users dynamically.
+// TODO(jamescook): Rename this to MultiProfileAppWindowLauncherController.
+// http://crbug.com/344079
class MultiProfileShellWindowLauncherController
: public ShellWindowLauncherController {
public:
@@ -20,19 +22,19 @@ class MultiProfileShellWindowLauncherController
virtual void ActiveUserChanged(const std::string& user_email) OVERRIDE;
virtual void AdditionalUserAddedToSession(Profile* profile) OVERRIDE;
- // Overridden from ShellWindowRegistry::Observer:
- virtual void OnShellWindowAdded(apps::ShellWindow* shell_window) OVERRIDE;
- virtual void OnShellWindowRemoved(apps::ShellWindow* shell_window) OVERRIDE;
+ // Overridden from AppWindowRegistry::Observer:
+ virtual void OnAppWindowAdded(apps::AppWindow* app_window) OVERRIDE;
+ virtual void OnAppWindowRemoved(apps::AppWindow* app_window) OVERRIDE;
private:
- typedef std::vector<apps::ShellWindow*> ShellWindowList;
- typedef std::vector<apps::ShellWindowRegistry*> ShellWindowRegistryList;
+ typedef std::vector<apps::AppWindow*> AppWindowList;
+ typedef std::vector<apps::AppWindowRegistry*> AppWindowRegistryList;
- // A list of all shell windows for all users.
- ShellWindowList shell_window_list_;
+ // A list of all app windows for all users.
+ AppWindowList app_window_list_;
- // A list of the shell window registries which we additionally observe.
- ShellWindowRegistryList multi_user_registry_;
+ // A list of the app window registries which we additionally observe.
+ AppWindowRegistryList multi_user_registry_;
DISALLOW_COPY_AND_ASSIGN(MultiProfileShellWindowLauncherController);
};
diff --git a/chrome/browser/ui/ash/launcher/shell_window_launcher_controller.cc b/chrome/browser/ui/ash/launcher/shell_window_launcher_controller.cc
index 4198ff7..68b5fbb 100644
--- a/chrome/browser/ui/ash/launcher/shell_window_launcher_controller.cc
+++ b/chrome/browser/ui/ash/launcher/shell_window_launcher_controller.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/ui/ash/launcher/shell_window_launcher_controller.h"
-#include "apps/shell_window.h"
+#include "apps/app_window.h"
#include "ash/shelf/shelf_util.h"
#include "ash/shell.h"
#include "ash/wm/window_util.h"
@@ -18,14 +18,14 @@
#include "ui/aura/client/activation_client.h"
#include "ui/aura/root_window.h"
-using apps::ShellWindow;
+using apps::AppWindow;
namespace {
-std::string GetAppShelfId(ShellWindow* shell_window) {
- if (shell_window->window_type_is_panel())
- return base::StringPrintf("panel:%d", shell_window->session_id().id());
- return shell_window->extension()->id();
+std::string GetAppShelfId(AppWindow* app_window) {
+ if (app_window->window_type_is_panel())
+ return base::StringPrintf("panel:%d", app_window->session_id().id());
+ return app_window->extension()->id();
}
bool ControlsWindow(aura::Window* window) {
@@ -39,8 +39,8 @@ ShellWindowLauncherController::ShellWindowLauncherController(
ChromeLauncherController* owner)
: owner_(owner),
activation_client_(NULL) {
- apps::ShellWindowRegistry* registry =
- apps::ShellWindowRegistry::Get(owner->profile());
+ apps::AppWindowRegistry* registry =
+ apps::AppWindowRegistry::Get(owner->profile());
registry_.insert(registry);
registry->AddObserver(this);
if (ash::Shell::HasInstance()) {
@@ -54,8 +54,9 @@ ShellWindowLauncherController::ShellWindowLauncherController(
}
ShellWindowLauncherController::~ShellWindowLauncherController() {
- for (std::set<apps::ShellWindowRegistry*>::iterator it = registry_.begin();
- it != registry_.end(); ++it)
+ for (std::set<apps::AppWindowRegistry*>::iterator it = registry_.begin();
+ it != registry_.end();
+ ++it)
(*it)->RemoveObserver(this);
if (activation_client_)
@@ -75,7 +76,7 @@ void ShellWindowLauncherController::AdditionalUserAddedToSession(
chrome::MultiUserWindowManager::MULTI_PROFILE_MODE_MIXED)
return;
- apps::ShellWindowRegistry* registry = apps::ShellWindowRegistry::Get(profile);
+ apps::AppWindowRegistry* registry = apps::AppWindowRegistry::Get(profile);
if (registry_.find(registry) != registry_.end())
return;
@@ -83,36 +84,34 @@ void ShellWindowLauncherController::AdditionalUserAddedToSession(
registry_.insert(registry);
}
-void ShellWindowLauncherController::OnShellWindowAdded(
- ShellWindow* shell_window) {
- if (!ControlsWindow(shell_window->GetNativeWindow()))
+void ShellWindowLauncherController::OnAppWindowAdded(AppWindow* app_window) {
+ if (!ControlsWindow(app_window->GetNativeWindow()))
return;
- RegisterApp(shell_window);
+ RegisterApp(app_window);
}
-void ShellWindowLauncherController::OnShellWindowIconChanged(
- ShellWindow* shell_window) {
- if (!ControlsWindow(shell_window->GetNativeWindow()))
+void ShellWindowLauncherController::OnAppWindowIconChanged(
+ AppWindow* app_window) {
+ if (!ControlsWindow(app_window->GetNativeWindow()))
return;
- const std::string app_shelf_id = GetAppShelfId(shell_window);
+ const std::string app_shelf_id = GetAppShelfId(app_window);
AppControllerMap::iterator iter = app_controller_map_.find(app_shelf_id);
if (iter == app_controller_map_.end())
return;
ShellWindowLauncherItemController* controller = iter->second;
controller->set_image_set_by_controller(true);
owner_->SetLauncherItemImage(controller->shelf_id(),
- shell_window->app_icon().AsImageSkia());
+ app_window->app_icon().AsImageSkia());
}
-void ShellWindowLauncherController::OnShellWindowRemoved(
- ShellWindow* shell_window) {
- // Do nothing here; shell_window->window() has already been deleted and
+void ShellWindowLauncherController::OnAppWindowRemoved(AppWindow* app_window) {
+ // Do nothing here; app_window->window() has already been deleted and
// OnWindowDestroying() has been called, doing the removal.
}
// Called from aura::Window::~Window(), before delegate_->OnWindowDestroyed()
-// which destroys ShellWindow, so both |window| and the associated ShellWindow
+// which destroys AppWindow, so both |window| and the associated AppWindow
// are valid here.
void ShellWindowLauncherController::OnWindowDestroying(aura::Window* window) {
if (!ControlsWindow(window))
@@ -138,17 +137,17 @@ void ShellWindowLauncherController::OnWindowActivated(
owner_->SetItemStatus(old_controller->shelf_id(), ash::STATUS_RUNNING);
}
-void ShellWindowLauncherController::RegisterApp(ShellWindow* shell_window) {
- aura::Window* window = shell_window->GetNativeWindow();
+void ShellWindowLauncherController::RegisterApp(AppWindow* app_window) {
+ aura::Window* window = app_window->GetNativeWindow();
// Get the app's shelf identifier and add an entry to the map.
DCHECK(window_to_app_shelf_id_map_.find(window) ==
window_to_app_shelf_id_map_.end());
- const std::string app_shelf_id = GetAppShelfId(shell_window);
+ const std::string app_shelf_id = GetAppShelfId(app_window);
window_to_app_shelf_id_map_[window] = app_shelf_id;
window->AddObserver(this);
// Find or create an item controller and launcher item.
- std::string app_id = shell_window->extension()->id();
+ std::string app_id = app_window->extension()->id();
ash::ShelfItemStatus status = ash::wm::IsActiveWindow(window) ?
ash::STATUS_ACTIVE : ash::STATUS_RUNNING;
AppControllerMap::iterator iter = app_controller_map_.find(app_shelf_id);
@@ -157,15 +156,16 @@ void ShellWindowLauncherController::RegisterApp(ShellWindow* shell_window) {
ShellWindowLauncherItemController* controller = iter->second;
DCHECK(controller->app_id() == app_id);
shelf_id = controller->shelf_id();
- controller->AddShellWindow(shell_window, status);
+ controller->AddAppWindow(app_window, status);
} else {
- LauncherItemController::Type type = shell_window->window_type_is_panel()
- ? LauncherItemController::TYPE_APP_PANEL
- : LauncherItemController::TYPE_APP;
+ LauncherItemController::Type type =
+ app_window->window_type_is_panel()
+ ? LauncherItemController::TYPE_APP_PANEL
+ : LauncherItemController::TYPE_APP;
ShellWindowLauncherItemController* controller =
new ShellWindowLauncherItemController(
type, app_shelf_id, app_id, owner_);
- controller->AddShellWindow(shell_window, status);
+ controller->AddAppWindow(app_window, status);
// If the app shelf id is not unique, and there is already a shelf
// item for this app id (e.g. pinned), use that shelf item.
if (app_shelf_id == app_id)
@@ -173,7 +173,7 @@ void ShellWindowLauncherController::RegisterApp(ShellWindow* shell_window) {
if (shelf_id == 0) {
shelf_id = owner_->CreateAppLauncherItem(controller, app_id, status);
// Restore any existing app icon and flag as set.
- const gfx::Image& app_icon = shell_window->app_icon();
+ const gfx::Image& app_icon = app_window->app_icon();
if (!app_icon.IsEmpty()) {
owner_->SetLauncherItemImage(shelf_id, app_icon.AsImageSkia());
controller->set_image_set_by_controller(true);
@@ -181,7 +181,7 @@ void ShellWindowLauncherController::RegisterApp(ShellWindow* shell_window) {
} else {
owner_->SetItemController(shelf_id, controller);
}
- const std::string app_shelf_id = GetAppShelfId(shell_window);
+ const std::string app_shelf_id = GetAppShelfId(app_window);
app_controller_map_[app_shelf_id] = controller;
}
owner_->SetItemStatus(shelf_id, status);
@@ -200,7 +200,7 @@ void ShellWindowLauncherController::UnregisterApp(aura::Window* window) {
DCHECK(iter2 != app_controller_map_.end());
ShellWindowLauncherItemController* controller = iter2->second;
controller->RemoveShellWindowForWindow(window);
- if (controller->shell_window_count() == 0) {
+ if (controller->app_window_count() == 0) {
// If this is the last window associated with the app shelf id, close the
// shelf item.
ash::ShelfID shelf_id = controller->shelf_id();
diff --git a/chrome/browser/ui/ash/launcher/shell_window_launcher_controller.h b/chrome/browser/ui/ash/launcher/shell_window_launcher_controller.h
index 04501fb..5b9dacab 100644
--- a/chrome/browser/ui/ash/launcher/shell_window_launcher_controller.h
+++ b/chrome/browser/ui/ash/launcher/shell_window_launcher_controller.h
@@ -9,12 +9,12 @@
#include <map>
#include <string>
-#include "apps/shell_window_registry.h"
+#include "apps/app_window_registry.h"
#include "ui/aura/client/activation_change_observer.h"
#include "ui/aura/window_observer.h"
namespace apps {
-class ShellWindow;
+class AppWindow;
}
namespace aura {
@@ -31,11 +31,13 @@ class ChromeLauncherController;
class Profile;
class ShellWindowLauncherItemController;
-// ShellWindowLauncherController observes the Shell Window registry and the
+// ShellWindowLauncherController observes the app window registry and the
// aura window manager. It handles adding and removing launcher items from
// ChromeLauncherController.
+// TODO(jamescook): Rename this to AppWindowLauncherController.
+// http://crbug.com/344079
class ShellWindowLauncherController
- : public apps::ShellWindowRegistry::Observer,
+ : public apps::AppWindowRegistry::Observer,
public aura::WindowObserver,
public aura::client::ActivationChangeObserver {
public:
@@ -50,11 +52,10 @@ class ShellWindowLauncherController
// session.
virtual void AdditionalUserAddedToSession(Profile* profile);
- // Overridden from ShellWindowRegistry::Observer:
- virtual void OnShellWindowAdded(apps::ShellWindow* shell_window) OVERRIDE;
- virtual void OnShellWindowIconChanged(
- apps::ShellWindow* shell_window) OVERRIDE;
- virtual void OnShellWindowRemoved(apps::ShellWindow* shell_window) OVERRIDE;
+ // Overridden from AppWindowRegistry::Observer:
+ virtual void OnAppWindowAdded(apps::AppWindow* app_window) OVERRIDE;
+ virtual void OnAppWindowIconChanged(apps::AppWindow* app_window) OVERRIDE;
+ virtual void OnAppWindowRemoved(apps::AppWindow* app_window) OVERRIDE;
// Overriden from aura::WindowObserver:
virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
@@ -64,10 +65,10 @@ class ShellWindowLauncherController
aura::Window* lost_active) OVERRIDE;
protected:
- // Registers a shell window with the shelf and this object.
- void RegisterApp(apps::ShellWindow* shell_window);
+ // Registers a app window with the shelf and this object.
+ void RegisterApp(apps::AppWindow* app_window);
- // Unregisters a shell window with the shelf and this object.
+ // Unregisters a app window with the shelf and this object.
void UnregisterApp(aura::Window* window);
// Check if a given window is known to the launcher controller.
@@ -81,10 +82,10 @@ class ShellWindowLauncherController
ShellWindowLauncherItemController* ControllerForWindow(aura::Window* window);
ChromeLauncherController* owner_;
- // A set of unowned ShellWindowRegistry pointers for loaded users.
+ // A set of unowned AppWindowRegistry pointers for loaded users.
// Note that this will only be used with multiple users in the side by side
// mode.
- std::set<apps::ShellWindowRegistry*> registry_;
+ std::set<apps::AppWindowRegistry*> registry_;
aura::client::ActivationClient* activation_client_;
// Map of app launcher id to controller.
diff --git a/chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.cc b/chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.cc
index d3613f8..024e7fa 100644
--- a/chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.cc
+++ b/chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.h"
-#include "apps/shell_window.h"
+#include "apps/app_window.h"
#include "apps/ui/native_app_window.h"
#include "ash/shelf/shelf_model.h"
#include "ash/wm/window_state.h"
@@ -23,7 +23,7 @@
#include "ui/gfx/image/image_skia.h"
#include "ui/views/corewm/window_animations.h"
-using apps::ShellWindow;
+using apps::AppWindow;
namespace {
@@ -32,17 +32,17 @@ const int kAppListIconSize = 24;
// This will return a slightly smaller icon than the app icon to be used in
// the application list menu.
-scoped_ptr<gfx::Image> GetAppListIcon(ShellWindow* shell_window) {
+scoped_ptr<gfx::Image> GetAppListIcon(AppWindow* app_window) {
// TODO(skuhne): We instead might want to use LoadImages in
- // ShellWindow::UpdateExtensionAppIcon() to let the extension give us
+ // AppWindow::UpdateExtensionAppIcon() to let the extension give us
// pre-defined icons in the launcher and the launcher list sizes. Since there
// is no mock yet, doing this now seems a bit premature and we scale for the
// time being.
- if (shell_window->app_icon().IsEmpty())
+ if (app_window->app_icon().IsEmpty())
return make_scoped_ptr(new gfx::Image());
SkBitmap bmp =
- skia::ImageOperations::Resize(*shell_window->app_icon().ToSkBitmap(),
+ skia::ImageOperations::Resize(*app_window->app_icon().ToSkBitmap(),
skia::ImageOperations::RESIZE_BEST,
kAppListIconSize,
kAppListIconSize);
@@ -51,12 +51,12 @@ scoped_ptr<gfx::Image> GetAppListIcon(ShellWindow* shell_window) {
}
// Functor for std::find_if used in AppLauncherItemController.
-class ShellWindowHasWindow {
+class AppWindowHasWindow {
public:
- explicit ShellWindowHasWindow(aura::Window* window) : window_(window) { }
+ explicit AppWindowHasWindow(aura::Window* window) : window_(window) {}
- bool operator()(ShellWindow* shell_window) const {
- return shell_window->GetNativeWindow() == window_;
+ bool operator()(AppWindow* app_window) const {
+ return app_window->GetNativeWindow() == window_;
}
private:
@@ -71,52 +71,50 @@ ShellWindowLauncherItemController::ShellWindowLauncherItemController(
const std::string& app_id,
ChromeLauncherController* controller)
: LauncherItemController(type, app_id, controller),
- last_active_shell_window_(NULL),
+ last_active_app_window_(NULL),
app_shelf_id_(app_shelf_id),
- observed_windows_(this) {
-}
+ observed_windows_(this) {}
ShellWindowLauncherItemController::~ShellWindowLauncherItemController() {
}
-void ShellWindowLauncherItemController::AddShellWindow(
- ShellWindow* shell_window,
+void ShellWindowLauncherItemController::AddAppWindow(
+ AppWindow* app_window,
ash::ShelfItemStatus status) {
- if (shell_window->window_type_is_panel() && type() != TYPE_APP_PANEL)
- LOG(ERROR) << "ShellWindow of type Panel added to non-panel launcher item";
- shell_windows_.push_front(shell_window);
- observed_windows_.Add(shell_window->GetNativeWindow());
+ if (app_window->window_type_is_panel() && type() != TYPE_APP_PANEL)
+ LOG(ERROR) << "AppWindow of type Panel added to non-panel launcher item";
+ app_windows_.push_front(app_window);
+ observed_windows_.Add(app_window->GetNativeWindow());
}
void ShellWindowLauncherItemController::RemoveShellWindowForWindow(
aura::Window* window) {
- ShellWindowList::iterator iter =
- std::find_if(shell_windows_.begin(), shell_windows_.end(),
- ShellWindowHasWindow(window));
- if (iter != shell_windows_.end()) {
- if (*iter == last_active_shell_window_)
- last_active_shell_window_ = NULL;
- shell_windows_.erase(iter);
+ AppWindowList::iterator iter = std::find_if(
+ app_windows_.begin(), app_windows_.end(), AppWindowHasWindow(window));
+ if (iter != app_windows_.end()) {
+ if (*iter == last_active_app_window_)
+ last_active_app_window_ = NULL;
+ app_windows_.erase(iter);
}
observed_windows_.Remove(window);
}
void ShellWindowLauncherItemController::SetActiveWindow(aura::Window* window) {
- ShellWindowList::iterator iter =
- std::find_if(shell_windows_.begin(), shell_windows_.end(),
- ShellWindowHasWindow(window));
- if (iter != shell_windows_.end())
- last_active_shell_window_ = *iter;
+ AppWindowList::iterator iter = std::find_if(
+ app_windows_.begin(), app_windows_.end(), AppWindowHasWindow(window));
+ if (iter != app_windows_.end())
+ last_active_app_window_ = *iter;
}
bool ShellWindowLauncherItemController::IsOpen() const {
- return !shell_windows_.empty();
+ return !app_windows_.empty();
}
bool ShellWindowLauncherItemController::IsVisible() const {
// Return true if any windows are visible.
- for (ShellWindowList::const_iterator iter = shell_windows_.begin();
- iter != shell_windows_.end(); ++iter) {
+ for (AppWindowList::const_iterator iter = app_windows_.begin();
+ iter != app_windows_.end();
+ ++iter) {
if ((*iter)->GetNativeWindow()->IsVisible())
return true;
}
@@ -131,26 +129,27 @@ void ShellWindowLauncherItemController::Launch(ash::LaunchSource source,
}
bool ShellWindowLauncherItemController::Activate(ash::LaunchSource source) {
- DCHECK(!shell_windows_.empty());
- ShellWindow* window_to_activate = last_active_shell_window_ ?
- last_active_shell_window_ : shell_windows_.back();
+ DCHECK(!app_windows_.empty());
+ AppWindow* window_to_activate =
+ last_active_app_window_ ? last_active_app_window_ : app_windows_.back();
window_to_activate->GetBaseWindow()->Activate();
return false;
}
void ShellWindowLauncherItemController::Close() {
- // Note: Closing windows may affect the contents of shell_windows_.
- ShellWindowList windows_to_close = shell_windows_;
- for (ShellWindowList::iterator iter = windows_to_close.begin();
- iter != windows_to_close.end(); ++iter) {
+ // Note: Closing windows may affect the contents of app_windows_.
+ AppWindowList windows_to_close = app_windows_;
+ for (AppWindowList::iterator iter = windows_to_close.begin();
+ iter != windows_to_close.end();
+ ++iter) {
(*iter)->GetBaseWindow()->Close();
}
}
void ShellWindowLauncherItemController::ActivateIndexedApp(size_t index) {
- if (index >= shell_windows_.size())
+ if (index >= app_windows_.size())
return;
- ShellWindowList::iterator it = shell_windows_.begin();
+ AppWindowList::iterator it = app_windows_.begin();
std::advance(it, index);
ShowAndActivateOrMinimize(*it);
}
@@ -160,12 +159,13 @@ ShellWindowLauncherItemController::GetApplicationList(int event_flags) {
ChromeLauncherAppMenuItems items;
items.push_back(new ChromeLauncherAppMenuItem(GetTitle(), NULL, false));
int index = 0;
- for (ShellWindowList::iterator iter = shell_windows_.begin();
- iter != shell_windows_.end(); ++iter) {
- ShellWindow* shell_window = *iter;
- scoped_ptr<gfx::Image> image(GetAppListIcon(shell_window));
+ for (AppWindowList::iterator iter = app_windows_.begin();
+ iter != app_windows_.end();
+ ++iter) {
+ AppWindow* app_window = *iter;
+ scoped_ptr<gfx::Image> image(GetAppListIcon(app_window));
items.push_back(new ChromeLauncherAppMenuItemV2App(
- shell_window->GetTitle(),
+ app_window->GetTitle(),
image.get(), // Will be copied
app_id(),
launcher_controller(),
@@ -177,11 +177,11 @@ ShellWindowLauncherItemController::GetApplicationList(int event_flags) {
}
bool ShellWindowLauncherItemController::ItemSelected(const ui::Event& event) {
- if (shell_windows_.empty())
+ if (app_windows_.empty())
return false;
if (type() == TYPE_APP_PANEL) {
- DCHECK(shell_windows_.size() == 1);
- ShellWindow* panel = shell_windows_.front();
+ DCHECK(app_windows_.size() == 1);
+ AppWindow* panel = app_windows_.front();
aura::Window* panel_window = panel->GetNativeWindow();
// If the panel is attached on another display, move it to the current
// display and activate it.
@@ -193,11 +193,12 @@ bool ShellWindowLauncherItemController::ItemSelected(const ui::Event& event) {
ShowAndActivateOrMinimize(panel);
}
} else {
- ShellWindow* window_to_show = last_active_shell_window_ ?
- last_active_shell_window_ : shell_windows_.front();
+ AppWindow* window_to_show = last_active_app_window_
+ ? last_active_app_window_
+ : app_windows_.front();
// If the event was triggered by a keystroke, we try to advance to the next
// item if the window we are trying to activate is already active.
- if (shell_windows_.size() >= 1 &&
+ if (app_windows_.size() >= 1 &&
window_to_show->GetBaseWindow()->IsActive() &&
event.type() == ui::ET_KEY_RELEASED) {
ActivateOrAdvanceToNextShellWindow(window_to_show);
@@ -211,10 +212,10 @@ bool ShellWindowLauncherItemController::ItemSelected(const ui::Event& event) {
base::string16 ShellWindowLauncherItemController::GetTitle() {
// For panels return the title of the contents if set.
// Otherwise return the title of the app.
- if (type() == TYPE_APP_PANEL && !shell_windows_.empty()) {
- ShellWindow* shell_window = shell_windows_.front();
- if (shell_window->web_contents()) {
- base::string16 title = shell_window->web_contents()->GetTitle();
+ if (type() == TYPE_APP_PANEL && !app_windows_.empty()) {
+ AppWindow* app_window = app_windows_.front();
+ if (app_window->web_contents()) {
+ base::string16 title = app_window->web_contents()->GetTitle();
if (!title.empty())
return title;
}
@@ -264,24 +265,21 @@ void ShellWindowLauncherItemController::OnWindowPropertyChanged(
}
void ShellWindowLauncherItemController::ShowAndActivateOrMinimize(
- ShellWindow* shell_window) {
+ AppWindow* app_window) {
// Either show or minimize windows when shown from the launcher.
launcher_controller()->ActivateWindowOrMinimizeIfActive(
- shell_window->GetBaseWindow(),
- GetApplicationList(0).size() == 2);
+ app_window->GetBaseWindow(), GetApplicationList(0).size() == 2);
}
void ShellWindowLauncherItemController::ActivateOrAdvanceToNextShellWindow(
- ShellWindow* window_to_show) {
- ShellWindowList::iterator i(
- std::find(shell_windows_.begin(),
- shell_windows_.end(),
- window_to_show));
- if (i != shell_windows_.end()) {
- if (++i != shell_windows_.end())
+ AppWindow* window_to_show) {
+ AppWindowList::iterator i(
+ std::find(app_windows_.begin(), app_windows_.end(), window_to_show));
+ if (i != app_windows_.end()) {
+ if (++i != app_windows_.end())
window_to_show = *i;
else
- window_to_show = shell_windows_.front();
+ window_to_show = app_windows_.front();
}
if (window_to_show->GetBaseWindow()->IsActive()) {
// Coming here, only a single window is active. For keyboard activations
diff --git a/chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.h b/chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.h
index 893de55..9da1797 100644
--- a/chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.h
+++ b/chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.h
@@ -14,7 +14,7 @@
#include "ui/aura/window_observer.h"
namespace apps {
-class ShellWindow;
+class AppWindow;
}
namespace aura {
@@ -27,14 +27,16 @@ class Image;
class ChromeLauncherController;
-// This is a ShellWindowItemLauncherController for shell windows. There is one
+// This is a ShellWindowItemLauncherController for app windows. There is one
// instance per app, per launcher id.
// For apps with multiple windows, each item controller keeps track of all
// windows associated with the app and their activation order.
// Instances are owned by ash::ShelfItemDelegateManager.
//
// Tests are in chrome_launcher_controller_browsertest.cc
-
+//
+// TODO(jamescook): Rename to AppWindowLauncherItemController.
+// http://crbug.com/344079
class ShellWindowLauncherItemController : public LauncherItemController,
public aura::WindowObserver {
public:
@@ -45,8 +47,7 @@ class ShellWindowLauncherItemController : public LauncherItemController,
virtual ~ShellWindowLauncherItemController();
- void AddShellWindow(apps::ShellWindow* shell_window,
- ash::ShelfItemStatus status);
+ void AddAppWindow(apps::AppWindow* app_window, ash::ShelfItemStatus status);
void RemoveShellWindowForWindow(aura::Window* window);
@@ -75,25 +76,25 @@ class ShellWindowLauncherItemController : public LauncherItemController,
intptr_t old) OVERRIDE;
// Get the number of running applications/incarnations of this.
- size_t shell_window_count() const { return shell_windows_.size(); }
+ size_t app_window_count() const { return app_windows_.size(); }
// Activates the window at position |index|.
void ActivateIndexedApp(size_t index);
private:
- typedef std::list<apps::ShellWindow*> ShellWindowList;
+ typedef std::list<apps::AppWindow*> AppWindowList;
- void ShowAndActivateOrMinimize(apps::ShellWindow* shell_window);
+ void ShowAndActivateOrMinimize(apps::AppWindow* app_window);
// Activate the given |window_to_show|, or - if already selected - advance to
// the next window of similar type.
- void ActivateOrAdvanceToNextShellWindow(apps::ShellWindow* window_to_show);
+ void ActivateOrAdvanceToNextShellWindow(apps::AppWindow* window_to_show);
- // List of associated shell windows
- ShellWindowList shell_windows_;
+ // List of associated app windows
+ AppWindowList app_windows_;
- // Pointer to the most recently active shell window
- apps::ShellWindow* last_active_shell_window_;
+ // Pointer to the most recently active app window
+ apps::AppWindow* last_active_app_window_;
// The launcher id associated with this set of windows. There is one
// AppLauncherItemController for each |app_shelf_id_|.
diff --git a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc
index 5b260f9..80e74bf 100644
--- a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc
+++ b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc
@@ -4,8 +4,8 @@
#include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h"
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "ash/ash_switches.h"
#include "ash/desktop_background/user_wallpaper_delegate.h"
#include "ash/multi_profile_uma.h"
@@ -123,20 +123,19 @@ void RecordUMAForTransferredWindowType(aura::Window* window) {
if (!g_browser_process->profile_manager())
return;
// If it is not a browser, it is probably be a V2 application. In that case
- // one of the ShellWindowRegistries should know about it.
- apps::ShellWindow* shell_window = NULL;
+ // one of the AppWindowRegistry instances should know about it.
+ apps::AppWindow* app_window = NULL;
std::vector<Profile*> profiles =
g_browser_process->profile_manager()->GetLoadedProfiles();
for (std::vector<Profile*>::iterator it = profiles.begin();
- it != profiles.end() && shell_window == NULL; it++) {
- shell_window = apps::ShellWindowRegistry::Get(
- *it)->GetShellWindowForNativeWindow(window);
+ it != profiles.end() && app_window == NULL;
+ it++) {
+ app_window = apps::AppWindowRegistry::Get(*it)
+ ->GetAppWindowForNativeWindow(window);
}
- if (shell_window) {
- if (shell_window->window_type() ==
- apps::ShellWindow::WINDOW_TYPE_PANEL ||
- shell_window->window_type() ==
- apps::ShellWindow::WINDOW_TYPE_V1_PANEL) {
+ if (app_window) {
+ if (app_window->window_type() == apps::AppWindow::WINDOW_TYPE_PANEL ||
+ app_window->window_type() == apps::AppWindow::WINDOW_TYPE_V1_PANEL) {
window_type = ash::MultiProfileUMA::TELEPORT_WINDOW_PANEL;
} else {
window_type = ash::MultiProfileUMA::TELEPORT_WINDOW_V2_APP;
@@ -210,22 +209,20 @@ class UserChangeActionDisabler {
// When an app gets created, the window will be tagged for that user. Note
// that the destruction does not need to be tracked here since the universal
// window observer will take care of that.
-class AppObserver : public apps::ShellWindowRegistry::Observer {
+class AppObserver : public apps::AppWindowRegistry::Observer {
public:
explicit AppObserver(const std::string& user_id) : user_id_(user_id) {}
virtual ~AppObserver() {}
- // ShellWindowRegistry::Observer overrides:
- virtual void OnShellWindowAdded(apps::ShellWindow* shell_window) OVERRIDE {
- aura::Window* window = shell_window->GetNativeWindow();
+ // AppWindowRegistry::Observer overrides:
+ virtual void OnAppWindowAdded(apps::AppWindow* app_window) OVERRIDE {
+ aura::Window* window = app_window->GetNativeWindow();
DCHECK(window);
MultiUserWindowManagerChromeOS::GetInstance()->SetWindowOwner(window,
user_id_);
}
- virtual void OnShellWindowIconChanged(apps::ShellWindow* shell_window)
- OVERRIDE {}
- virtual void OnShellWindowRemoved(apps::ShellWindow* shell_window)
- OVERRIDE {}
+ virtual void OnAppWindowIconChanged(apps::AppWindow* app_window) OVERRIDE {}
+ virtual void OnAppWindowRemoved(apps::AppWindow* app_window) OVERRIDE {}
private:
std::string user_id_;
@@ -265,14 +262,14 @@ MultiUserWindowManagerChromeOS::~MultiUserWindowManagerChromeOS() {
}
// Remove all app observers.
- UserIDToShellWindowObserver::iterator app_observer_iterator =
+ UserIDToAppWindowObserver::iterator app_observer_iterator =
user_id_to_app_observer_.begin();
while (app_observer_iterator != user_id_to_app_observer_.end()) {
Profile* profile = multi_user_util::GetProfileFromUserID(
app_observer_iterator->first);
DCHECK(profile);
- apps::ShellWindowRegistry::Get(profile)->RemoveObserver(
- app_observer_iterator->second);
+ apps::AppWindowRegistry::Get(profile)
+ ->RemoveObserver(app_observer_iterator->second);
delete app_observer_iterator->second;
user_id_to_app_observer_.erase(app_observer_iterator);
app_observer_iterator = user_id_to_app_observer_.begin();
@@ -382,16 +379,16 @@ void MultiUserWindowManagerChromeOS::AddUser(Profile* profile) {
return;
user_id_to_app_observer_[user_id] = new AppObserver(user_id);
- apps::ShellWindowRegistry::Get(profile)->AddObserver(
- user_id_to_app_observer_[user_id]);
+ apps::AppWindowRegistry::Get(profile)
+ ->AddObserver(user_id_to_app_observer_[user_id]);
// Account all existing application windows of this user accordingly.
- const apps::ShellWindowRegistry::ShellWindowList& shell_windows =
- apps::ShellWindowRegistry::Get(profile)->shell_windows();
- apps::ShellWindowRegistry::ShellWindowList::const_iterator it =
- shell_windows.begin();
- for (; it != shell_windows.end(); ++it)
- user_id_to_app_observer_[user_id]->OnShellWindowAdded(*it);
+ const apps::AppWindowRegistry::AppWindowList& app_windows =
+ apps::AppWindowRegistry::Get(profile)->app_windows();
+ apps::AppWindowRegistry::AppWindowList::const_iterator it =
+ app_windows.begin();
+ for (; it != app_windows.end(); ++it)
+ user_id_to_app_observer_[user_id]->OnAppWindowAdded(*it);
// Account all existing browser windows of this user accordingly.
BrowserList* browser_list = BrowserList::GetInstance(HOST_DESKTOP_TYPE_ASH);
diff --git a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h
index 08ce903..3711139 100644
--- a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h
+++ b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h
@@ -153,7 +153,7 @@ class MultiUserWindowManagerChromeOS
};
typedef std::map<aura::Window*, WindowEntry*> WindowToEntryMap;
- typedef std::map<std::string, AppObserver*> UserIDToShellWindowObserver;
+ typedef std::map<std::string, AppObserver*> UserIDToAppWindowObserver;
typedef std::map<aura::Window*, bool> TransientWindowToVisibility;
// The animation step for the user change animation. First the old user gets
@@ -222,8 +222,8 @@ class MultiUserWindowManagerChromeOS
// should get shown.
WindowToEntryMap window_to_entry_;
- // A list of all known users and their shell window observers.
- UserIDToShellWindowObserver user_id_to_app_observer_;
+ // A list of all known users and their app window observers.
+ UserIDToAppWindowObserver user_id_to_app_observer_;
// An observer list to be notified upon window owner changes.
ObserverList<Observer> observers_;
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
index a9793aa..4f19b35 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
@@ -8,8 +8,8 @@
#include <map>
#include <string>
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "apps/ui/native_app_window.h"
#include "base/base64.h"
#include "base/bind.h"
@@ -255,7 +255,7 @@ void GetBillingInfoFromOutputs(const FieldValueMap& output,
}
// Returns the containing window for the given |web_contents|. The containing
-// window might be a browser window for a Chrome tab, or it might be a shell
+// window might be a browser window for a Chrome tab, or it might be an app
// window for a platform app.
ui::BaseWindow* GetBaseWindowForWebContents(
const content::WebContents* web_contents) {
@@ -265,10 +265,10 @@ ui::BaseWindow* GetBaseWindowForWebContents(
gfx::NativeWindow native_window =
web_contents->GetView()->GetTopLevelNativeWindow();
- apps::ShellWindow* shell_window =
- apps::ShellWindowRegistry::
- GetShellWindowForNativeWindowAnyProfile(native_window);
- return shell_window->GetBaseWindow();
+ apps::AppWindow* app_window =
+ apps::AppWindowRegistry::GetAppWindowForNativeWindowAnyProfile(
+ native_window);
+ return app_window->GetBaseWindow();
}
// Returns a string descriptor for a DialogSection, for use with prefs (do not
diff --git a/chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac.mm b/chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac.mm
index b64b87d..a65e792 100644
--- a/chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac.mm
+++ b/chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac.mm
@@ -5,8 +5,8 @@
#import "chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac.h"
#include "apps/app_shim/extension_app_shim_handler_mac.h"
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
@@ -280,11 +280,10 @@ void AddDuplicateItem(NSMenuItem* top_level_item,
id window = [notification object];
NSString* name = [notification name];
if ([name isEqualToString:NSWindowDidBecomeMainNotification]) {
- apps::ShellWindow* shellWindow =
- apps::ShellWindowRegistry::GetShellWindowForNativeWindowAnyProfile(
- window);
- if (shellWindow)
- [self addMenuItems:shellWindow->extension()];
+ apps::AppWindow* appWindow =
+ apps::AppWindowRegistry::GetAppWindowForNativeWindowAnyProfile(window);
+ if (appWindow)
+ [self addMenuItems:appWindow->extension()];
else
[self removeMenuItems];
} else if ([name isEqualToString:NSWindowWillCloseNotification]) {
@@ -356,27 +355,27 @@ void AddDuplicateItem(NSMenuItem* top_level_item,
}
- (void)quitCurrentPlatformApp {
- apps::ShellWindow* shellWindow =
- apps::ShellWindowRegistry::GetShellWindowForNativeWindowAnyProfile(
+ apps::AppWindow* appWindow =
+ apps::AppWindowRegistry::GetAppWindowForNativeWindowAnyProfile(
[NSApp keyWindow]);
- if (shellWindow)
- apps::ExtensionAppShimHandler::QuitAppForWindow(shellWindow);
+ if (appWindow)
+ apps::ExtensionAppShimHandler::QuitAppForWindow(appWindow);
}
- (void)hideCurrentPlatformApp {
- apps::ShellWindow* shellWindow =
- apps::ShellWindowRegistry::GetShellWindowForNativeWindowAnyProfile(
+ apps::AppWindow* appWindow =
+ apps::AppWindowRegistry::GetAppWindowForNativeWindowAnyProfile(
[NSApp keyWindow]);
- if (shellWindow)
- apps::ExtensionAppShimHandler::HideAppForWindow(shellWindow);
+ if (appWindow)
+ apps::ExtensionAppShimHandler::HideAppForWindow(appWindow);
}
- (void)focusCurrentPlatformApp {
- apps::ShellWindow* shellWindow =
- apps::ShellWindowRegistry::GetShellWindowForNativeWindowAnyProfile(
+ apps::AppWindow* appWindow =
+ apps::AppWindowRegistry::GetAppWindowForNativeWindowAnyProfile(
[NSApp keyWindow]);
- if (shellWindow)
- apps::ExtensionAppShimHandler::FocusAppForWindow(shellWindow);
+ if (appWindow)
+ apps::ExtensionAppShimHandler::FocusAppForWindow(appWindow);
}
@end
diff --git a/chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac_browsertest.mm b/chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac_browsertest.mm
index 4042c80..21daa37 100644
--- a/chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac_browsertest.mm
+++ b/chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac_browsertest.mm
@@ -6,7 +6,7 @@
#import <Cocoa/Cocoa.h>
-#include "apps/shell_window_registry.h"
+#include "apps/app_window_registry.h"
#include "apps/ui/native_app_window.h"
#include "base/command_line.h"
#include "base/mac/scoped_nsobject.h"
@@ -89,21 +89,21 @@ IN_PROC_BROWSER_TEST_F(AppShimMenuControllerBrowserTest,
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();
+ apps::AppWindow* app_1_app_window = apps::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();
+ apps::AppWindow* app_2_app_window = apps::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
@@ -116,11 +116,11 @@ IN_PROC_BROWSER_TEST_F(AppShimMenuControllerBrowserTest,
// 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();
}
@@ -132,19 +132,19 @@ IN_PROC_BROWSER_TEST_F(AppShimMenuControllerBrowserTest,
// 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();
+ apps::AppWindow* app_2_app_window = apps::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();
+ apps::AppWindow* app_1_app_window = apps::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());
diff --git a/chrome/browser/ui/cocoa/apps/chrome_shell_window_delegate_cocoa.mm b/chrome/browser/ui/cocoa/apps/chrome_shell_window_delegate_cocoa.mm
index 45da8ef..baeab34 100644
--- a/chrome/browser/ui/cocoa/apps/chrome_shell_window_delegate_cocoa.mm
+++ b/chrome/browser/ui/cocoa/apps/chrome_shell_window_delegate_cocoa.mm
@@ -8,7 +8,7 @@
// static
apps::NativeAppWindow* ChromeShellWindowDelegate::CreateNativeAppWindowImpl(
- apps::ShellWindow* shell_window,
- const apps::ShellWindow::CreateParams& params) {
- return new NativeAppWindowCocoa(shell_window, params);
+ apps::AppWindow* app_window,
+ const apps::AppWindow::CreateParams& params) {
+ return new NativeAppWindowCocoa(app_window, params);
}
diff --git a/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h b/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h
index b0f6775..9f05cc0 100644
--- a/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h
+++ b/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h
@@ -8,7 +8,7 @@
#import <Cocoa/Cocoa.h>
#include <vector>
-#include "apps/shell_window.h"
+#include "apps/app_window.h"
#include "apps/ui/native_app_window.h"
#include "base/mac/scoped_nsobject.h"
#include "base/memory/scoped_ptr.h"
@@ -43,8 +43,8 @@ class SkRegion;
class NativeAppWindowCocoa : public apps::NativeAppWindow,
public content::WebContentsObserver {
public:
- NativeAppWindowCocoa(apps::ShellWindow* shell_window,
- const apps::ShellWindow::CreateParams& params);
+ NativeAppWindowCocoa(apps::AppWindow* app_window,
+ const apps::AppWindow::CreateParams& params);
// ui::BaseWindow implementation.
virtual bool IsActive() const OVERRIDE;
@@ -155,10 +155,10 @@ class NativeAppWindowCocoa : public apps::NativeAppWindow,
ShellNSWindow* window() const;
content::WebContents* web_contents() const {
- return shell_window_->web_contents();
+ return app_window_->web_contents();
}
const extensions::Extension* extension() const {
- return shell_window_->extension();
+ return app_window_->extension();
}
// Returns the WindowStyleMask based on the type of window frame.
@@ -182,7 +182,7 @@ class NativeAppWindowCocoa : public apps::NativeAppWindow,
// Hides the window unconditionally. Used by Hide and HideWithApp.
void HideWithoutMarkingHidden();
- apps::ShellWindow* shell_window_; // weak - ShellWindow owns NativeAppWindow.
+ apps::AppWindow* app_window_; // weak - AppWindow owns NativeAppWindow.
bool has_frame_;
diff --git a/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm b/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm
index 790cb5f..a6a01ad 100644
--- a/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm
+++ b/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm
@@ -38,8 +38,7 @@
// windowWillUseStandardFrame, as the window would not restore back to the
// desired size.
-
-using apps::ShellWindow;
+using apps::AppWindow;
@interface NSWindow (NSPrivateApis)
- (void)setBottomCornerRounded:(BOOL)rounded;
@@ -176,6 +175,8 @@ NSInteger AlwaysOnTopWindowLevel() {
- (CGFloat)roundedCornerRadius;
@end
+// TODO(jamescook): Should these be AppNSWindow to match apps::AppWindow?
+// http://crbug.com/344082
@interface ShellNSWindow : ChromeEventProcessingWindow
@end
@implementation ShellNSWindow
@@ -275,10 +276,10 @@ NSInteger AlwaysOnTopWindowLevel() {
@end
NativeAppWindowCocoa::NativeAppWindowCocoa(
- ShellWindow* shell_window,
- const ShellWindow::CreateParams& params)
- : shell_window_(shell_window),
- has_frame_(params.frame == ShellWindow::FRAME_CHROME),
+ AppWindow* app_window,
+ const AppWindow::CreateParams& params)
+ : app_window_(app_window),
+ has_frame_(params.frame == AppWindow::FRAME_CHROME),
is_hidden_(false),
is_hidden_with_app_(false),
is_maximized_(false),
@@ -318,8 +319,7 @@ NativeAppWindowCocoa::NativeAppWindowCocoa(
window_class = [ShellFramelessNSWindow class];
}
- ShellWindow::SizeConstraints size_constraints =
- shell_window_->size_constraints();
+ AppWindow::SizeConstraints size_constraints = app_window_->size_constraints();
shows_resize_controls_ =
params.resizable && !size_constraints.HasFixedSize();
shows_fullscreen_controls_ =
@@ -365,10 +365,10 @@ NativeAppWindowCocoa::NativeAppWindowCocoa(
UpdateWindowMinMaxSize();
extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryCocoa(
- Profile::FromBrowserContext(shell_window_->browser_context()),
+ Profile::FromBrowserContext(app_window_->browser_context()),
window,
extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY,
- shell_window));
+ app_window));
}
NSUInteger NativeAppWindowCocoa::GetWindowStyleMask() const {
@@ -439,7 +439,7 @@ bool NativeAppWindowCocoa::IsFullscreen() const {
}
void NativeAppWindowCocoa::SetFullscreen(int fullscreen_types) {
- bool fullscreen = (fullscreen_types != ShellWindow::FULLSCREEN_TYPE_NONE);
+ bool fullscreen = (fullscreen_types != AppWindow::FULLSCREEN_TYPE_NONE);
if (fullscreen == is_fullscreen_)
return;
is_fullscreen_ = fullscreen;
@@ -540,7 +540,7 @@ void NativeAppWindowCocoa::Show() {
// If there is a shim to gently request attention, return here. Otherwise
// show the window as usual.
if (apps::ExtensionAppShimHandler::RequestUserAttentionForWindow(
- shell_window_)) {
+ app_window_)) {
return;
}
}
@@ -627,7 +627,7 @@ void NativeAppWindowCocoa::UpdateWindowIcon() {
}
void NativeAppWindowCocoa::UpdateWindowTitle() {
- base::string16 title = shell_window_->GetTitle();
+ base::string16 title = app_window_->GetTitle();
[window() setTitle:base::SysUTF16ToNSString(title)];
}
@@ -766,7 +766,7 @@ void NativeAppWindowCocoa::UpdateDraggableRegionsForCustomDrag(
// Aggregate the draggable areas and non-draggable areas such that hit test
// could be performed easily.
- draggable_region_.reset(ShellWindow::RawDraggableRegionsToSkRegion(regions));
+ draggable_region_.reset(AppWindow::RawDraggableRegionsToSkRegion(regions));
}
void NativeAppWindowCocoa::HandleKeyboardEvent(
@@ -881,8 +881,8 @@ void NativeAppWindowCocoa::RemoveObserver(
void NativeAppWindowCocoa::WindowWillClose() {
[window_controller_ setAppWindow:NULL];
- shell_window_->OnNativeWindowChanged();
- shell_window_->OnNativeClose();
+ app_window_->OnNativeWindowChanged();
+ app_window_->OnNativeClose();
}
void NativeAppWindowCocoa::WindowDidBecomeKey() {
@@ -890,7 +890,7 @@ void NativeAppWindowCocoa::WindowDidBecomeKey() {
web_contents()->GetRenderWidgetHostView();
if (rwhv)
rwhv->SetActive(true);
- shell_window_->OnNativeWindowActivated();
+ app_window_->OnNativeWindowActivated();
web_contents()->GetView()->RestoreFocus();
}
@@ -934,20 +934,20 @@ void NativeAppWindowCocoa::WindowDidFinishResize() {
}
void NativeAppWindowCocoa::WindowDidResize() {
- shell_window_->OnNativeWindowChanged();
+ app_window_->OnNativeWindowChanged();
}
void NativeAppWindowCocoa::WindowDidMove() {
UpdateRestoredBounds();
- shell_window_->OnNativeWindowChanged();
+ app_window_->OnNativeWindowChanged();
}
void NativeAppWindowCocoa::WindowDidMiniaturize() {
- shell_window_->OnNativeWindowChanged();
+ app_window_->OnNativeWindowChanged();
}
void NativeAppWindowCocoa::WindowDidDeminiaturize() {
- shell_window_->OnNativeWindowChanged();
+ app_window_->OnNativeWindowChanged();
}
void NativeAppWindowCocoa::WindowWillZoom() {
@@ -1024,11 +1024,11 @@ void NativeAppWindowCocoa::UpdateRestoredBounds() {
}
void NativeAppWindowCocoa::UpdateWindowMinMaxSize() {
- gfx::Size min_size = shell_window_->size_constraints().GetMinimumSize();
+ gfx::Size min_size = app_window_->size_constraints().GetMinimumSize();
[window() setContentMinSize:NSMakeSize(min_size.width(), min_size.height())];
- gfx::Size max_size = shell_window_->size_constraints().GetMaximumSize();
- const int kUnboundedSize = ShellWindow::SizeConstraints::kUnboundedSize;
+ gfx::Size max_size = app_window_->size_constraints().GetMaximumSize();
+ const int kUnboundedSize = AppWindow::SizeConstraints::kUnboundedSize;
CGFloat max_width = max_size.width() == kUnboundedSize ?
CGFLOAT_MAX : max_size.width();
CGFloat max_height = max_size.height() == kUnboundedSize ?
diff --git a/chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm b/chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm
index 35bbfad..1976806 100644
--- a/chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm
+++ b/chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm
@@ -6,10 +6,10 @@
#import <Cocoa/Cocoa.h>
-#include "apps/shell_window_registry.h"
+#include "apps/app_window_registry.h"
#include "chrome/browser/apps/app_browsertest_util.h"
-#include "chrome/browser/ui/extensions/application_launch.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/extensions/application_launch.h"
#include "content/public/browser/notification_service.h"
#include "content/public/test/test_utils.h"
@@ -50,8 +50,8 @@ class NativeAppWindowCocoaBrowserTest : public PlatformAppBrowserTest {
// Test interaction of Hide/Show() with Hide/ShowWithApp().
IN_PROC_BROWSER_TEST_F(NativeAppWindowCocoaBrowserTest, HideShowWithApp) {
SetUpAppWithWindows(2);
- apps::ShellWindowRegistry::ShellWindowList windows =
- apps::ShellWindowRegistry::Get(profile())->shell_windows();
+ apps::AppWindowRegistry::AppWindowList windows =
+ apps::AppWindowRegistry::Get(profile())->app_windows();
apps::NativeAppWindow* window = windows.front()->GetBaseWindow();
NSWindow* ns_window = window->GetNativeWindow();
apps::NativeAppWindow* other_window = windows.back()->GetBaseWindow();
diff --git a/chrome/browser/ui/gtk/apps/chrome_shell_window_delegate_gtk.cc b/chrome/browser/ui/gtk/apps/chrome_shell_window_delegate_gtk.cc
index 6f18d8c..581450b 100644
--- a/chrome/browser/ui/gtk/apps/chrome_shell_window_delegate_gtk.cc
+++ b/chrome/browser/ui/gtk/apps/chrome_shell_window_delegate_gtk.cc
@@ -8,7 +8,7 @@
// static
apps::NativeAppWindow* ChromeShellWindowDelegate::CreateNativeAppWindowImpl(
- apps::ShellWindow* shell_window,
- const apps::ShellWindow::CreateParams& params) {
- return new NativeAppWindowGtk(shell_window, params);
+ apps::AppWindow* app_window,
+ const apps::AppWindow::CreateParams& params) {
+ return new NativeAppWindowGtk(app_window, params);
}
diff --git a/chrome/browser/ui/gtk/apps/native_app_window_gtk.cc b/chrome/browser/ui/gtk/apps/native_app_window_gtk.cc
index 9242e94..888f106 100644
--- a/chrome/browser/ui/gtk/apps/native_app_window_gtk.cc
+++ b/chrome/browser/ui/gtk/apps/native_app_window_gtk.cc
@@ -24,7 +24,7 @@
#include "ui/gfx/image/image.h"
#include "ui/gfx/rect.h"
-using apps::ShellWindow;
+using apps::AppWindow;
namespace {
@@ -40,15 +40,15 @@ const char* kAtomsToCache[] = {
} // namespace
-NativeAppWindowGtk::NativeAppWindowGtk(ShellWindow* shell_window,
- const ShellWindow::CreateParams& params)
- : shell_window_(shell_window),
+NativeAppWindowGtk::NativeAppWindowGtk(AppWindow* app_window,
+ const AppWindow::CreateParams& params)
+ : app_window_(app_window),
window_(NULL),
state_(GDK_WINDOW_STATE_WITHDRAWN),
is_active_(false),
content_thinks_its_fullscreen_(false),
maximize_pending_(false),
- frameless_(params.frame == ShellWindow::FRAME_NONE),
+ frameless_(params.frame == AppWindow::FRAME_NONE),
always_on_top_(params.always_on_top),
frame_cursor_(NULL),
atom_cache_(base::MessagePumpGtk::GetDefaultXDisplay(), kAtomsToCache),
@@ -89,7 +89,7 @@ NativeAppWindowGtk::NativeAppWindowGtk(ShellWindow* shell_window,
gtk_window_get_position(window_, &x, &y);
bounds_.set_origin(gfx::Point(x, y));
- // Hide titlebar when {frame: 'none'} specified on ShellWindow.
+ // Hide titlebar when {frame: 'none'} specified on AppWindow..
if (frameless_)
gtk_window_set_decorated(window_, false);
@@ -146,10 +146,10 @@ NativeAppWindowGtk::NativeAppWindowGtk(ShellWindow* shell_window,
// Add the keybinding registry.
extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryGtk(
- Profile::FromBrowserContext(shell_window_->browser_context()),
+ Profile::FromBrowserContext(app_window_->browser_context()),
window_,
extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY,
- shell_window_));
+ app_window_));
ui::ActiveWindowWatcherX::AddObserver(this);
}
@@ -231,7 +231,7 @@ void NativeAppWindowGtk::Hide() {
}
void NativeAppWindowGtk::Close() {
- shell_window_->OnNativeWindowChanged();
+ app_window_->OnNativeWindowChanged();
// Cancel any pending callback from the window configure debounce timer.
window_configure_debounce_timer_.Stop();
@@ -244,7 +244,7 @@ void NativeAppWindowGtk::Close() {
// OnNativeClose does a delete this so no other members should
// be accessed after. gtk_widget_destroy is safe (and must
// be last).
- shell_window_->OnNativeClose();
+ app_window_->OnNativeClose();
gtk_widget_destroy(window);
}
@@ -335,7 +335,7 @@ GdkFilterReturn NativeAppWindowGtk::OnXEvent(GdkXEvent* gdk_x_event,
static_cast<GdkWindowState>(state_ & ~GDK_WINDOW_STATE_ICONIFIED);
if (previous_state != state_) {
- shell_window_->OnNativeWindowChanged();
+ app_window_->OnNativeWindowChanged();
}
}
@@ -402,7 +402,7 @@ void NativeAppWindowGtk::ActiveWindowChanged(GdkWindow* active_window) {
is_active_ = gtk_widget_get_window(GTK_WIDGET(window_)) == active_window;
if (is_active_)
- shell_window_->OnNativeWindowActivated();
+ app_window_->OnNativeWindowActivated();
}
// Callback for the delete event. This event is fired when the user tries to
@@ -445,7 +445,7 @@ gboolean NativeAppWindowGtk::OnConfigure(GtkWidget* widget,
void NativeAppWindowGtk::OnConfigureDebounced() {
gtk_window_util::UpdateWindowPosition(this, &bounds_, &restored_bounds_);
- shell_window_->OnNativeWindowChanged();
+ app_window_->OnNativeWindowChanged();
FOR_EACH_OBSERVER(web_modal::ModalDialogHostObserver,
observer_list_,
@@ -593,7 +593,7 @@ gboolean NativeAppWindowGtk::OnButtonPress(GtkWidget* widget,
// NativeAppWindow implementation:
void NativeAppWindowGtk::SetFullscreen(int fullscreen_types) {
- bool fullscreen = (fullscreen_types != ShellWindow::FULLSCREEN_TYPE_NONE);
+ bool fullscreen = (fullscreen_types != AppWindow::FULLSCREEN_TYPE_NONE);
content_thinks_its_fullscreen_ = fullscreen;
if (fullscreen) {
if (resizable_) {
@@ -625,8 +625,8 @@ bool NativeAppWindowGtk::IsDetached() const {
void NativeAppWindowGtk::UpdateWindowIcon() {
Profile* profile =
- Profile::FromBrowserContext(shell_window_->browser_context());
- gfx::Image app_icon = shell_window_->app_icon();
+ Profile::FromBrowserContext(app_window_->browser_context());
+ gfx::Image app_icon = app_window_->app_icon();
if (!app_icon.IsEmpty())
gtk_util::SetWindowIcon(window_, profile, app_icon.ToGdkPixbuf());
else
@@ -634,7 +634,7 @@ void NativeAppWindowGtk::UpdateWindowIcon() {
}
void NativeAppWindowGtk::UpdateWindowTitle() {
- base::string16 title = shell_window_->GetTitle();
+ base::string16 title = app_window_->GetTitle();
gtk_window_set_title(window_, base::UTF16ToUTF8(title).c_str());
}
@@ -648,7 +648,7 @@ void NativeAppWindowGtk::UpdateDraggableRegions(
if (!frameless_)
return;
- draggable_region_.reset(ShellWindow::RawDraggableRegionsToSkRegion(regions));
+ draggable_region_.reset(AppWindow::RawDraggableRegionsToSkRegion(regions));
}
SkRegion* NativeAppWindowGtk::GetDraggableRegion() {
@@ -700,15 +700,15 @@ void NativeAppWindowGtk::ShowWithApp() {}
void NativeAppWindowGtk::UpdateWindowMinMaxSize() {
GdkGeometry hints;
int hints_mask = 0;
- if (shell_window_->size_constraints().HasMinimumSize()) {
- gfx::Size min_size = shell_window_->size_constraints().GetMinimumSize();
+ if (app_window_->size_constraints().HasMinimumSize()) {
+ gfx::Size min_size = app_window_->size_constraints().GetMinimumSize();
hints.min_height = min_size.height();
hints.min_width = min_size.width();
hints_mask |= GDK_HINT_MIN_SIZE;
}
- if (shell_window_->size_constraints().HasMaximumSize()) {
- gfx::Size max_size = shell_window_->size_constraints().GetMaximumSize();
- const int kUnboundedSize = ShellWindow::SizeConstraints::kUnboundedSize;
+ if (app_window_->size_constraints().HasMaximumSize()) {
+ gfx::Size max_size = app_window_->size_constraints().GetMaximumSize();
+ const int kUnboundedSize = AppWindow::SizeConstraints::kUnboundedSize;
hints.max_height = max_size.height() == kUnboundedSize ?
G_MAXINT : max_size.height();
hints.max_width = max_size.width() == kUnboundedSize ?
diff --git a/chrome/browser/ui/gtk/apps/native_app_window_gtk.h b/chrome/browser/ui/gtk/apps/native_app_window_gtk.h
index ac15a4e..6b4cc65 100644
--- a/chrome/browser/ui/gtk/apps/native_app_window_gtk.h
+++ b/chrome/browser/ui/gtk/apps/native_app_window_gtk.h
@@ -7,7 +7,7 @@
#include <gtk/gtk.h>
-#include "apps/shell_window.h"
+#include "apps/app_window.h"
#include "apps/ui/native_app_window.h"
#include "base/observer_list.h"
#include "base/timer/timer.h"
@@ -30,8 +30,8 @@ class NativeAppWindowGtk : public apps::NativeAppWindow,
public ui::ActiveWindowWatcherXObserver,
public content::WebContentsObserver {
public:
- NativeAppWindowGtk(apps::ShellWindow* shell_window,
- const apps::ShellWindow::CreateParams& params);
+ NativeAppWindowGtk(apps::AppWindow* app_window,
+ const apps::AppWindow::CreateParams& params);
// ui::BaseWindow implementation.
virtual bool IsActive() const OVERRIDE;
@@ -95,10 +95,10 @@ class NativeAppWindowGtk : public apps::NativeAppWindow,
web_modal::ModalDialogHostObserver* observer) OVERRIDE;
content::WebContents* web_contents() const {
- return shell_window_->web_contents();
+ return app_window_->web_contents();
}
const extensions::Extension* extension() const {
- return shell_window_->extension();
+ return app_window_->extension();
}
virtual ~NativeAppWindowGtk();
@@ -124,7 +124,7 @@ class NativeAppWindowGtk : public apps::NativeAppWindow,
void OnConfigureDebounced();
- apps::ShellWindow* shell_window_; // weak - ShellWindow owns NativeAppWindow.
+ apps::AppWindow* app_window_; // weak - AppWindow owns NativeAppWindow.
GtkWindow* window_;
GdkWindowState state_;
diff --git a/chrome/browser/ui/views/app_list/win/app_list_controller_delegate_win.cc b/chrome/browser/ui/views/app_list/win/app_list_controller_delegate_win.cc
index 1094b8d..38cb76f 100644
--- a/chrome/browser/ui/views/app_list/win/app_list_controller_delegate_win.cc
+++ b/chrome/browser/ui/views/app_list/win/app_list_controller_delegate_win.cc
@@ -4,8 +4,8 @@
#include "chrome/browser/ui/views/app_list/win/app_list_controller_delegate_win.h"
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "chrome/browser/metro_utils/metro_chrome_win.h"
#include "chrome/browser/ui/app_list/app_list_icon_win.h"
#include "chrome/browser/ui/extensions/application_launch.h"
@@ -49,9 +49,9 @@ bool AppListControllerDelegateWin::CanDoCreateShortcutsFlow() {
void AppListControllerDelegateWin::FillLaunchParams(AppLaunchParams* params) {
params->desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE;
- apps::ShellWindow* any_existing_window =
- apps::ShellWindowRegistry::Get(params->profile)->
- GetCurrentShellWindowForApp(params->extension_id);
+ apps::AppWindow* any_existing_window =
+ apps::AppWindowRegistry::Get(params->profile)
+ ->GetCurrentAppWindowForApp(params->extension_id);
if (any_existing_window &&
chrome::GetHostDesktopTypeForNativeWindow(
any_existing_window->GetNativeWindow())
diff --git a/chrome/browser/ui/views/apps/chrome_shell_window_delegate_views.cc b/chrome/browser/ui/views/apps/chrome_shell_window_delegate_views.cc
index 4af6578..a529e00 100644
--- a/chrome/browser/ui/views/apps/chrome_shell_window_delegate_views.cc
+++ b/chrome/browser/ui/views/apps/chrome_shell_window_delegate_views.cc
@@ -8,9 +8,9 @@
// static
apps::NativeAppWindow* ChromeShellWindowDelegate::CreateNativeAppWindowImpl(
- apps::ShellWindow* shell_window,
- const apps::ShellWindow::CreateParams& params) {
+ apps::AppWindow* app_window,
+ const apps::AppWindow::CreateParams& params) {
NativeAppWindowViews* window = new NativeAppWindowViews;
- window->Init(shell_window, params);
+ window->Init(app_window, params);
return window;
}
diff --git a/chrome/browser/ui/views/apps/chrome_shell_window_delegate_views_win.cc b/chrome/browser/ui/views/apps/chrome_shell_window_delegate_views_win.cc
index 9ef69f3..76a8e88 100644
--- a/chrome/browser/ui/views/apps/chrome_shell_window_delegate_views_win.cc
+++ b/chrome/browser/ui/views/apps/chrome_shell_window_delegate_views_win.cc
@@ -8,9 +8,9 @@
// static
apps::NativeAppWindow* ChromeShellWindowDelegate::CreateNativeAppWindowImpl(
- apps::ShellWindow* shell_window,
- const apps::ShellWindow::CreateParams& params) {
+ apps::AppWindow* app_window,
+ const apps::AppWindow::CreateParams& params) {
NativeAppWindowViewsWin* window = new NativeAppWindowViewsWin;
- window->Init(shell_window, params);
+ window->Init(app_window, params);
return window;
}
diff --git a/chrome/browser/ui/views/apps/native_app_window_views.cc b/chrome/browser/ui/views/apps/native_app_window_views.cc
index 3a85e36..47a8ec6 100644
--- a/chrome/browser/ui/views/apps/native_app_window_views.cc
+++ b/chrome/browser/ui/views/apps/native_app_window_views.cc
@@ -4,8 +4,8 @@
#include "chrome/browser/ui/views/apps/native_app_window_views.h"
-#include "apps/shell_window.h"
-#include "apps/ui/views/shell_window_frame_view.h"
+#include "apps/app_window.h"
+#include "apps/ui/views/app_window_frame_view.h"
#include "base/command_line.h"
#include "base/file_util.h"
#include "base/path_service.h"
@@ -71,7 +71,7 @@
#include "ui/aura/window.h"
#endif
-using apps::ShellWindow;
+using apps::AppWindow;
namespace {
@@ -178,13 +178,13 @@ class NativeAppWindowStateDelegate : public ash::wm::WindowStateDelegate,
public ash::wm::WindowStateObserver,
public aura::WindowObserver {
public:
- NativeAppWindowStateDelegate(ShellWindow* shell_window,
+ NativeAppWindowStateDelegate(AppWindow* app_window,
apps::NativeAppWindow* native_app_window)
- : shell_window_(shell_window),
+ : app_window_(app_window),
window_state_(
ash::wm::GetWindowState(native_app_window->GetNativeWindow())) {
// Add a window state observer to exit fullscreen properly in case
- // fullscreen is exited without going through ShellWindow::Restore(). This
+ // fullscreen is exited without going through AppWindow::Restore(). This
// is the case when exiting immersive fullscreen via the "Restore" window
// control.
// TODO(pkotwicz): This is a hack. Remove ASAP. http://crbug.com/319048
@@ -204,9 +204,9 @@ class NativeAppWindowStateDelegate : public ash::wm::WindowStateDelegate,
// Windows which cannot be maximized should not be fullscreened.
DCHECK(window_state->IsFullscreen() || window_state->CanMaximize());
if (window_state->IsFullscreen())
- shell_window_->Restore();
+ app_window_->Restore();
else if (window_state->CanMaximize())
- shell_window_->OSFullscreen();
+ app_window_->OSFullscreen();
return true;
}
@@ -214,15 +214,14 @@ class NativeAppWindowStateDelegate : public ash::wm::WindowStateDelegate,
virtual void OnPostWindowShowTypeChange(
ash::wm::WindowState* window_state,
ash::wm::WindowShowType old_type) OVERRIDE {
- if (!window_state->IsFullscreen() &&
- !window_state->IsMinimized() &&
- shell_window_->GetBaseWindow()->IsFullscreenOrPending()) {
- shell_window_->Restore();
+ if (!window_state->IsFullscreen() && !window_state->IsMinimized() &&
+ app_window_->GetBaseWindow()->IsFullscreenOrPending()) {
+ app_window_->Restore();
// Usually OnNativeWindowChanged() is called when the window bounds are
// changed as a result of a show type change. Because the change in show
// type has already occurred, we need to call OnNativeWindowChanged()
// explicitly.
- shell_window_->OnNativeWindowChanged();
+ app_window_->OnNativeWindowChanged();
}
}
@@ -234,7 +233,7 @@ class NativeAppWindowStateDelegate : public ash::wm::WindowStateDelegate,
}
// Not owned.
- ShellWindow* shell_window_;
+ AppWindow* app_window_;
ash::wm::WindowState* window_state_;
DISALLOW_COPY_AND_ASSIGN(NativeAppWindowStateDelegate);
@@ -250,18 +249,17 @@ NativeAppWindowViews::NativeAppWindowViews()
weak_ptr_factory_(this) {
}
-void NativeAppWindowViews::Init(
- apps::ShellWindow* shell_window,
- const ShellWindow::CreateParams& create_params) {
- shell_window_ = shell_window;
- frameless_ = create_params.frame == ShellWindow::FRAME_NONE;
+void NativeAppWindowViews::Init(apps::AppWindow* app_window,
+ const AppWindow::CreateParams& create_params) {
+ app_window_ = app_window;
+ frameless_ = create_params.frame == AppWindow::FRAME_NONE;
transparent_background_ = create_params.transparent_background;
resizable_ = create_params.resizable;
Observe(web_contents());
window_ = new views::Widget;
- if (create_params.window_type == ShellWindow::WINDOW_TYPE_PANEL ||
- create_params.window_type == ShellWindow::WINDOW_TYPE_V1_PANEL) {
+ if (create_params.window_type == AppWindow::WINDOW_TYPE_PANEL ||
+ create_params.window_type == AppWindow::WINDOW_TYPE_V1_PANEL) {
InitializePanelWindow(create_params);
} else {
InitializeDefaultWindow(create_params);
@@ -270,7 +268,7 @@ void NativeAppWindowViews::Init(
Profile::FromBrowserContext(browser_context()),
window_->GetFocusManager(),
extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY,
- shell_window_));
+ app_window_));
OnViewWasResized();
window_->AddObserver(this);
@@ -285,7 +283,7 @@ void NativeAppWindowViews::OnBeforeWidgetInit(
views::Widget* widget) {}
void NativeAppWindowViews::InitializeDefaultWindow(
- const ShellWindow::CreateParams& create_params) {
+ const AppWindow::CreateParams& create_params) {
std::string app_name =
web_app::GenerateApplicationNameFromExtensionId(extension()->id());
@@ -403,7 +401,7 @@ HWND NativeAppWindowViews::GetNativeAppWindowHWND() const {
#endif
void NativeAppWindowViews::InitializePanelWindow(
- const ShellWindow::CreateParams& create_params) {
+ const AppWindow::CreateParams& create_params) {
views::Widget::InitParams params(views::Widget::InitParams::TYPE_PANEL);
params.delegate = this;
@@ -468,7 +466,7 @@ bool NativeAppWindowViews::ShouldUseChromeStyleFrame() const {
switches::kAppsUseNativeFrame);
}
-apps::ShellWindowFrameView* NativeAppWindowViews::CreateShellWindowFrameView() {
+apps::AppWindowFrameView* NativeAppWindowViews::CreateAppWindowFrameView() {
// By default the user can resize the window from slightly inside the bounds.
int resize_inside_bounds_size = kResizeInsideBoundsSize;
int resize_outside_bounds_size = 0;
@@ -484,7 +482,7 @@ apps::ShellWindowFrameView* NativeAppWindowViews::CreateShellWindowFrameView() {
resize_area_corner_size = ash::kResizeAreaCornerSize;
}
#endif
- apps::ShellWindowFrameView* frame_view = new apps::ShellWindowFrameView(this);
+ apps::AppWindowFrameView* frame_view = new apps::AppWindowFrameView(this);
frame_view->Init(window_,
resize_inside_bounds_size,
resize_outside_bounds_size,
@@ -614,7 +612,7 @@ void NativeAppWindowViews::FlashFrame(bool flash) {
}
bool NativeAppWindowViews::IsAlwaysOnTop() const {
- if (shell_window_->window_type_is_panel()) {
+ if (app_window_->window_type_is_panel()) {
#if defined(USE_ASH)
return ash::wm::GetWindowState(window_->GetNativeWindow())->
panel_attached();
@@ -635,8 +633,8 @@ void NativeAppWindowViews::ShowContextMenuForView(
const gfx::Point& p,
ui::MenuSourceType source_type) {
#if defined(USE_ASH) & defined(OS_CHROMEOS)
- scoped_ptr<ui::MenuModel> model = CreateMultiUserContextMenu(
- shell_window_->GetNativeWindow());
+ scoped_ptr<ui::MenuModel> model =
+ CreateMultiUserContextMenu(app_window_->GetNativeWindow());
if (!model.get())
return;
@@ -663,9 +661,9 @@ gfx::NativeView NativeAppWindowViews::GetHostView() const {
}
gfx::Point NativeAppWindowViews::GetDialogPosition(const gfx::Size& size) {
- gfx::Size shell_window_size = window_->GetWindowBoundsInScreen().size();
- return gfx::Point(shell_window_size.width() / 2 - size.width() / 2,
- shell_window_size.height() / 2 - size.height() / 2);
+ gfx::Size app_window_size = window_->GetWindowBoundsInScreen().size();
+ return gfx::Point(app_window_size.width() / 2 - size.width() / 2,
+ app_window_size.height() / 2 - size.height() / 2);
}
gfx::Size NativeAppWindowViews::GetMaximumDialogSize() {
@@ -692,7 +690,7 @@ void NativeAppWindowViews::OnViewWasResized() {
// WidgetDelegate implementation.
void NativeAppWindowViews::OnWidgetMove() {
- shell_window_->OnNativeWindowChanged();
+ app_window_->OnNativeWindowChanged();
}
views::View* NativeAppWindowViews::GetInitiallyFocusedView() {
@@ -700,24 +698,24 @@ views::View* NativeAppWindowViews::GetInitiallyFocusedView() {
}
bool NativeAppWindowViews::CanResize() const {
- return resizable_ && !shell_window_->size_constraints().HasFixedSize();
+ return resizable_ && !app_window_->size_constraints().HasFixedSize();
}
bool NativeAppWindowViews::CanMaximize() const {
- return resizable_ && !shell_window_->size_constraints().HasMaximumSize() &&
- !shell_window_->window_type_is_panel();
+ return resizable_ && !app_window_->size_constraints().HasMaximumSize() &&
+ !app_window_->window_type_is_panel();
}
base::string16 NativeAppWindowViews::GetWindowTitle() const {
- return shell_window_->GetTitle();
+ return app_window_->GetTitle();
}
bool NativeAppWindowViews::ShouldShowWindowTitle() const {
- return shell_window_->window_type() == ShellWindow::WINDOW_TYPE_V1_PANEL;
+ return app_window_->window_type() == AppWindow::WINDOW_TYPE_V1_PANEL;
}
gfx::ImageSkia NativeAppWindowViews::GetWindowAppIcon() {
- gfx::Image app_icon = shell_window_->app_icon();
+ gfx::Image app_icon = app_window_->app_icon();
if (app_icon.IsEmpty())
return GetWindowIcon();
else
@@ -725,7 +723,7 @@ gfx::ImageSkia NativeAppWindowViews::GetWindowAppIcon() {
}
gfx::ImageSkia NativeAppWindowViews::GetWindowIcon() {
- content::WebContents* web_contents = shell_window_->web_contents();
+ content::WebContents* web_contents = app_window_->web_contents();
if (web_contents) {
FaviconTabHelper* favicon_tab_helper =
FaviconTabHelper::FromWebContents(web_contents);
@@ -737,18 +735,18 @@ gfx::ImageSkia NativeAppWindowViews::GetWindowIcon() {
}
bool NativeAppWindowViews::ShouldShowWindowIcon() const {
- return shell_window_->window_type() == ShellWindow::WINDOW_TYPE_V1_PANEL;
+ return app_window_->window_type() == AppWindow::WINDOW_TYPE_V1_PANEL;
}
void NativeAppWindowViews::SaveWindowPlacement(const gfx::Rect& bounds,
ui::WindowShowState show_state) {
views::WidgetDelegate::SaveWindowPlacement(bounds, show_state);
- shell_window_->OnNativeWindowChanged();
+ app_window_->OnNativeWindowChanged();
}
void NativeAppWindowViews::DeleteDelegate() {
window_->RemoveObserver(this);
- shell_window_->OnNativeClose();
+ app_window_->OnNativeClose();
}
views::Widget* NativeAppWindowViews::GetWidget() {
@@ -771,9 +769,9 @@ views::NonClientFrameView* NativeAppWindowViews::CreateNonClientFrameView(
// WindowStateDelegate if one is not already set.
ash::wm::GetWindowState(GetNativeWindow())->SetDelegate(
scoped_ptr<ash::wm::WindowStateDelegate>(
- new NativeAppWindowStateDelegate(shell_window_, this)).Pass());
+ new NativeAppWindowStateDelegate(app_window_, this)).Pass());
- if (shell_window_->window_type_is_panel()) {
+ if (app_window_->window_type_is_panel()) {
ash::PanelFrameView::FrameType frame_type = frameless_ ?
ash::PanelFrameView::FRAME_NONE : ash::PanelFrameView::FRAME_ASH;
views::NonClientFrameView* frame_view =
@@ -802,7 +800,7 @@ views::NonClientFrameView* NativeAppWindowViews::CreateNonClientFrameView(
}
#endif
if (ShouldUseChromeStyleFrame())
- return CreateShellWindowFrameView();
+ return CreateAppWindowFrameView();
return views::WidgetDelegateView::CreateNonClientFrameView(widget);
}
@@ -819,7 +817,7 @@ bool NativeAppWindowViews::ShouldDescendIntoChildForEventHandling(
const gfx::Point& location) {
#if defined(USE_AURA)
if (child->Contains(web_view_->web_contents()->GetView()->GetNativeView())) {
- // Shell window should claim mouse events that fall within the draggable
+ // App window should claim mouse events that fall within the draggable
// region.
return !draggable_region_.get() ||
!draggable_region_->contains(location.x(), location.y());
@@ -833,14 +831,14 @@ bool NativeAppWindowViews::ShouldDescendIntoChildForEventHandling(
void NativeAppWindowViews::OnWidgetVisibilityChanged(views::Widget* widget,
bool visible) {
- shell_window_->OnNativeWindowChanged();
+ app_window_->OnNativeWindowChanged();
}
void NativeAppWindowViews::OnWidgetActivationChanged(views::Widget* widget,
bool active) {
- shell_window_->OnNativeWindowChanged();
+ app_window_->OnNativeWindowChanged();
if (active)
- shell_window_->OnNativeWindowActivated();
+ app_window_->OnNativeWindowActivated();
}
// WebContentsObserver implementation.
@@ -890,11 +888,11 @@ gfx::Size NativeAppWindowViews::GetPreferredSize() {
}
gfx::Size NativeAppWindowViews::GetMinimumSize() {
- return shell_window_->size_constraints().GetMinimumSize();
+ return app_window_->size_constraints().GetMinimumSize();
}
gfx::Size NativeAppWindowViews::GetMaximumSize() {
- return shell_window_->size_constraints().GetMaximumSize();
+ return app_window_->size_constraints().GetMaximumSize();
}
void NativeAppWindowViews::OnFocus() {
@@ -935,9 +933,9 @@ bool NativeAppWindowViews::AcceleratorPressed(
void NativeAppWindowViews::SetFullscreen(int fullscreen_types) {
// Fullscreen not supported by panels.
- if (shell_window_->window_type_is_panel())
+ if (app_window_->window_type_is_panel())
return;
- is_fullscreen_ = (fullscreen_types != ShellWindow::FULLSCREEN_TYPE_NONE);
+ is_fullscreen_ = (fullscreen_types != AppWindow::FULLSCREEN_TYPE_NONE);
window_->SetFullscreen(is_fullscreen_);
#if defined(USE_ASH)
@@ -946,13 +944,13 @@ void NativeAppWindowViews::SetFullscreen(int fullscreen_types) {
// fullscreen is the fullscreen type used by the OS.
immersive_fullscreen_controller_->SetEnabled(
ash::ImmersiveFullscreenController::WINDOW_TYPE_PACKAGED_APP,
- (fullscreen_types & ShellWindow::FULLSCREEN_TYPE_OS) != 0);
+ (fullscreen_types & AppWindow::FULLSCREEN_TYPE_OS) != 0);
// Autohide the shelf instead of hiding the shelf completely when only in
// OS fullscreen.
ash::wm::WindowState* window_state =
ash::wm::GetWindowState(window_->GetNativeWindow());
- window_state->set_hide_shelf_when_fullscreen(
- fullscreen_types != ShellWindow::FULLSCREEN_TYPE_OS);
+ window_state->set_hide_shelf_when_fullscreen(fullscreen_types !=
+ AppWindow::FULLSCREEN_TYPE_OS);
DCHECK(ash::Shell::HasInstance());
ash::Shell::GetInstance()->UpdateShelfVisibility();
}
@@ -968,7 +966,7 @@ bool NativeAppWindowViews::IsFullscreenOrPending() const {
}
bool NativeAppWindowViews::IsDetached() const {
- if (!shell_window_->window_type_is_panel())
+ if (!app_window_->window_type_is_panel())
return false;
#if defined(USE_ASH)
return !ash::wm::GetWindowState(window_->GetNativeWindow())->panel_attached();
@@ -987,8 +985,8 @@ void NativeAppWindowViews::UpdateWindowTitle() {
void NativeAppWindowViews::UpdateBadgeIcon() {
const gfx::Image* icon = NULL;
- if (!shell_window_->badge_icon().IsEmpty()) {
- icon = &shell_window_->badge_icon();
+ if (!app_window_->badge_icon().IsEmpty()) {
+ icon = &app_window_->badge_icon();
// chrome::DrawTaskbarDecoration can do interesting things with non-square
// bitmaps.
// TODO(benwells): Refactor chrome::DrawTaskbarDecoration to not be avatar
@@ -1007,7 +1005,7 @@ void NativeAppWindowViews::UpdateDraggableRegions(
if (!frameless_)
return;
- draggable_region_.reset(ShellWindow::RawDraggableRegionsToSkRegion(regions));
+ draggable_region_.reset(AppWindow::RawDraggableRegionsToSkRegion(regions));
OnViewWasResized();
}
diff --git a/chrome/browser/ui/views/apps/native_app_window_views.h b/chrome/browser/ui/views/apps/native_app_window_views.h
index 4bd3fb6..da0f117 100644
--- a/chrome/browser/ui/views/apps/native_app_window_views.h
+++ b/chrome/browser/ui/views/apps/native_app_window_views.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_UI_VIEWS_APPS_NATIVE_APP_WINDOW_VIEWS_H_
#define CHROME_BROWSER_UI_VIEWS_APPS_NATIVE_APP_WINDOW_VIEWS_H_
-#include "apps/shell_window.h"
+#include "apps/app_window.h"
#include "apps/ui/native_app_window.h"
#include "base/observer_list.h"
#include "content/public/browser/web_contents_observer.h"
@@ -31,7 +31,7 @@ class ImmersiveFullscreenController;
class ExtensionKeybindingRegistryViews;
namespace apps {
-class ShellWindowFrameView;
+class AppWindowFrameView;
}
namespace content {
@@ -61,8 +61,8 @@ class NativeAppWindowViews : public apps::NativeAppWindow,
public:
NativeAppWindowViews();
virtual ~NativeAppWindowViews();
- void Init(apps::ShellWindow* shell_window,
- const apps::ShellWindow::CreateParams& create_params);
+ void Init(apps::AppWindow* app_window,
+ const apps::AppWindow::CreateParams& create_params);
SkRegion* shape() { return shape_.get(); }
@@ -77,26 +77,24 @@ class NativeAppWindowViews : public apps::NativeAppWindow,
virtual void Activate() OVERRIDE;
content::BrowserContext* browser_context() {
- return shell_window_->browser_context();
+ return app_window_->browser_context();
}
- const extensions::Extension* extension() {
- return shell_window_->extension();
- }
+ const extensions::Extension* extension() { return app_window_->extension(); }
private:
friend class ShapedAppWindowTargeterTest;
void InitializeDefaultWindow(
- const apps::ShellWindow::CreateParams& create_params);
+ const apps::AppWindow::CreateParams& create_params);
void InitializePanelWindow(
- const apps::ShellWindow::CreateParams& create_params);
+ const apps::AppWindow::CreateParams& create_params);
void OnViewWasResized();
bool ShouldUseChromeStyleFrame() const;
// Caller owns the returned object.
- apps::ShellWindowFrameView* CreateShellWindowFrameView();
+ apps::AppWindowFrameView* CreateAppWindowFrameView();
#if defined(OS_WIN)
void OnShortcutInfoLoaded(
@@ -205,11 +203,9 @@ class NativeAppWindowViews : public apps::NativeAppWindow,
virtual void RemoveObserver(
web_modal::ModalDialogHostObserver* observer) OVERRIDE;
- content::WebContents* web_contents() {
- return shell_window_->web_contents();
- }
+ content::WebContents* web_contents() { return app_window_->web_contents(); }
- apps::ShellWindow* shell_window_; // weak - ShellWindow owns NativeAppWindow.
+ apps::AppWindow* app_window_; // Not owned.
views::WebView* web_view_;
views::Widget* window_;
bool is_fullscreen_;
diff --git a/chrome/browser/ui/views/apps/native_app_window_views_win.cc b/chrome/browser/ui/views/apps/native_app_window_views_win.cc
index 37c4cf5..a6d0fba 100644
--- a/chrome/browser/ui/views/apps/native_app_window_views_win.cc
+++ b/chrome/browser/ui/views/apps/native_app_window_views_win.cc
@@ -4,8 +4,8 @@
#include "chrome/browser/ui/views/apps/native_app_window_views_win.h"
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "ash/shell.h"
#include "chrome/browser/apps/per_app_settings_service.h"
#include "chrome/browser/apps/per_app_settings_service_factory.h"
@@ -38,9 +38,9 @@ void NativeAppWindowViewsWin::OnBeforeWidgetInit(
views::Widget::InitParams* init_params, views::Widget* widget) {
// If an app has any existing windows, ensure new ones are created on the
// same desktop.
- apps::ShellWindow* any_existing_window =
- apps::ShellWindowRegistry::Get(browser_context())
- ->GetCurrentShellWindowForApp(extension()->id());
+ apps::AppWindow* any_existing_window =
+ apps::AppWindowRegistry::Get(browser_context())
+ ->GetCurrentAppWindowForApp(extension()->id());
chrome::HostDesktopType desktop_type;
if (any_existing_window) {
desktop_type = chrome::GetHostDesktopTypeForNativeWindow(
diff --git a/chrome/browser/ui/views/select_file_dialog_extension.cc b/chrome/browser/ui/views/select_file_dialog_extension.cc
index 7111985..9a0d055 100644
--- a/chrome/browser/ui/views/select_file_dialog_extension.cc
+++ b/chrome/browser/ui/views/select_file_dialog_extension.cc
@@ -4,8 +4,8 @@
#include "chrome/browser/ui/views/select_file_dialog_extension.h"
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "apps/ui/native_app_window.h"
#include "base/bind.h"
#include "base/callback.h"
@@ -36,7 +36,7 @@
#include "ui/shell_dialogs/selected_file_info.h"
#include "ui/views/widget/widget.h"
-using apps::ShellWindow;
+using apps::AppWindow;
using content::BrowserThread;
namespace {
@@ -278,26 +278,27 @@ void SelectFileDialogExtension::SelectFileImpl(
// The web contents to associate the dialog with.
content::WebContents* web_contents = NULL;
- // To get the base_window and profile, either a Browser or ShellWindow is
+ // To get the base_window and profile, either a Browser or AppWindow is
// needed.
Browser* owner_browser = NULL;
- ShellWindow* shell_window = NULL;
+ AppWindow* app_window = NULL;
- // If owner_window is supplied, use that to find a browser or a shell window.
+ // If owner_window is supplied, use that to find a browser or a app window.
if (owner_window) {
owner_browser = chrome::FindBrowserWithWindow(owner_window);
if (!owner_browser) {
// If an owner_window was supplied but we couldn't find a browser, this
- // could be for a shell window.
- shell_window = apps::ShellWindowRegistry::
- GetShellWindowForNativeWindowAnyProfile(owner_window);
+ // could be for a app window.
+ app_window =
+ apps::AppWindowRegistry::GetAppWindowForNativeWindowAnyProfile(
+ owner_window);
}
}
- if (shell_window) {
- DCHECK(!shell_window->window_type_is_panel());
- base_window = shell_window->GetBaseWindow();
- web_contents = shell_window->web_contents();
+ if (app_window) {
+ DCHECK(!app_window->window_type_is_panel());
+ base_window = app_window->GetBaseWindow();
+ web_contents = app_window->web_contents();
} else {
// If the owning window is still unknown, this could be a background page or
// and extension popup. Use the last active browser.
diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
index 4ff0161..491c188 100644
--- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
+++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
@@ -6,9 +6,9 @@
#include "apps/app_load_service.h"
#include "apps/app_restore_service.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "apps/saved_files_service.h"
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
#include "base/auto_reset.h"
#include "base/base64.h"
#include "base/bind.h"
@@ -1121,9 +1121,9 @@ ExtensionSettingsHandler::GetInspectablePagesForExtension(
process_manager->GetRenderViewHostsForExtension(extension->id()),
&result);
- // Get shell window views
- GetShellWindowPagesForExtensionProfile(extension,
- extension_service_->profile(), &result);
+ // Get app window views
+ GetAppWindowPagesForExtensionProfile(
+ extension, extension_service_->profile(), &result);
// Include a link to start the lazy background page, if applicable.
if (BackgroundInfo::HasLazyBackgroundPage(extension) &&
@@ -1138,7 +1138,7 @@ ExtensionSettingsHandler::GetInspectablePagesForExtension(
}
// Repeat for the incognito process, if applicable. Don't try to get
- // shell windows for incognito processes.
+ // app windows for incognito processes.
if (extension_service_->profile()->HasOffTheRecordProfile() &&
IncognitoInfo::IsSplitMode(extension) &&
util::IsIncognitoEnabled(extension->id(),
@@ -1195,20 +1195,21 @@ void ExtensionSettingsHandler::GetInspectablePagesForExtensionProcess(
}
}
-void ExtensionSettingsHandler::GetShellWindowPagesForExtensionProfile(
+void ExtensionSettingsHandler::GetAppWindowPagesForExtensionProfile(
const Extension* extension,
Profile* profile,
std::vector<ExtensionPage>* result) {
- apps::ShellWindowRegistry* registry = apps::ShellWindowRegistry::Get(profile);
+ apps::AppWindowRegistry* registry = apps::AppWindowRegistry::Get(profile);
if (!registry) return;
- const apps::ShellWindowRegistry::ShellWindowList windows =
- registry->GetShellWindowsForApp(extension->id());
+ const apps::AppWindowRegistry::AppWindowList windows =
+ registry->GetAppWindowsForApp(extension->id());
bool has_generated_background_page =
BackgroundInfo::HasGeneratedBackgroundPage(extension);
- for (apps::ShellWindowRegistry::const_iterator it = windows.begin();
- it != windows.end(); ++it) {
+ for (apps::AppWindowRegistry::const_iterator it = windows.begin();
+ it != windows.end();
+ ++it) {
WebContents* web_contents = (*it)->web_contents();
RenderViewHost* host = web_contents->GetRenderViewHost();
content::RenderProcessHost* process = host->GetProcess();
diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.h b/chrome/browser/ui/webui/extensions/extension_settings_handler.h
index 75dd1fe..5c48818 100644
--- a/chrome/browser/ui/webui/extensions/extension_settings_handler.h
+++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.h
@@ -199,10 +199,9 @@ class ExtensionSettingsHandler
const Extension* extension,
const std::set<content::RenderViewHost*>& views,
std::vector<ExtensionPage>* result);
- void GetShellWindowPagesForExtensionProfile(
- const Extension* extension,
- Profile* profile,
- std::vector<ExtensionPage>* result);
+ void GetAppWindowPagesForExtensionProfile(const Extension* extension,
+ Profile* profile,
+ std::vector<ExtensionPage>* result);
// Returns the ExtensionUninstallDialog object for this class, creating it if
// needed.
diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc
index 397d8ab..54a236c 100644
--- a/chrome/browser/ui/webui/options/browser_options_handler.cc
+++ b/chrome/browser/ui/webui/options/browser_options_handler.cc
@@ -7,8 +7,8 @@
#include <string>
#include <vector>
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/command_line.h"
diff --git a/chrome/browser/ui/webui/options/options_handlers_helper.cc b/chrome/browser/ui/webui/options/options_handlers_helper.cc
index f754eac..3f43637 100644
--- a/chrome/browser/ui/webui/options/options_handlers_helper.cc
+++ b/chrome/browser/ui/webui/options/options_handlers_helper.cc
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "base/bind.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -24,12 +24,12 @@ chrome::HostDesktopType GetDesktopType(content::WebUI* web_ui) {
if (browser)
return browser->host_desktop_type();
- apps::ShellWindow* shell_window =
- apps::ShellWindowRegistry::Get(Profile::FromWebUI(web_ui))->
- GetShellWindowForRenderViewHost(web_contents->GetRenderViewHost());
- if (shell_window) {
+ apps::AppWindow* app_window =
+ apps::AppWindowRegistry::Get(Profile::FromWebUI(web_ui))
+ ->GetAppWindowForRenderViewHost(web_contents->GetRenderViewHost());
+ if (app_window) {
return chrome::GetHostDesktopTypeForNativeWindow(
- shell_window->GetNativeWindow());
+ app_window->GetNativeWindow());
}
return chrome::GetActiveDesktop();
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 932f921..78d4ea32 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -156,7 +156,7 @@
},
'sources': [
'../apps/app_shim/app_shim_quit_interactive_uitest_mac.mm',
- '../apps/shell_window_interactive_uitest.cc',
+ '../apps/app_window_interactive_uitest.cc',
'../ui/views/corewm/desktop_capture_controller_unittest.cc',
'../ui/views/widget/widget_interactive_uitest.cc',
'browser/apps/app_browsertest_util.cc',
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi
index a4c545d..a620eea 100644
--- a/chrome/chrome_tests_unit.gypi
+++ b/chrome/chrome_tests_unit.gypi
@@ -531,9 +531,9 @@
'sources': [
'../apps/app_keep_alive_service_unittest.cc',
'../apps/app_shim/app_shim_host_mac_unittest.cc',
- '../apps/saved_files_service_unittest.cc',
'../apps/app_shim/extension_app_shim_handler_mac_unittest.cc',
- '../apps/shell_window_geometry_cache_unittest.cc',
+ '../apps/app_window_geometry_cache_unittest.cc',
+ '../apps/saved_files_service_unittest.cc',
'../components/autofill/content/renderer/test_password_autofill_agent.cc',
'../components/autofill/content/renderer/test_password_autofill_agent.h',
'../components/autofill/content/renderer/test_password_generation_agent.cc',
diff --git a/chrome/test/remoting/remote_desktop_browsertest.cc b/chrome/test/remoting/remote_desktop_browsertest.cc
index 0a48d27..da1cd74 100644
--- a/chrome/test/remoting/remote_desktop_browsertest.cc
+++ b/chrome/test/remoting/remote_desktop_browsertest.cc
@@ -180,7 +180,7 @@ void RemoteDesktopBrowserTest::LaunchChromotingApp() {
web_contents_stack_.push_back(web_contents);
if (is_platform_app()) {
- EXPECT_EQ(GetFirstShellWindowWebContents(), active_web_contents());
+ EXPECT_EQ(GetFirstAppWindowWebContents(), active_web_contents());
} else {
// For apps v1 only, the DOMOperationObserver is not ready at the LOAD_STOP
// event. A half second wait is necessary for the subsequent javascript
diff --git a/extensions/browser/extension_prefs.h b/extensions/browser/extension_prefs.h
index 6d5ac2d..89258ae 100644
--- a/extensions/browser/extension_prefs.h
+++ b/extensions/browser/extension_prefs.h
@@ -500,7 +500,7 @@ class ExtensionPrefs : public ExtensionScopedPrefs,
void SetNeedsStorageGarbageCollection(bool value);
bool NeedsStorageGarbageCollection();
- // Used by ShellWindowGeometryCache to persist its cache. These methods
+ // Used by AppWindowGeometryCache to persist its cache. These methods
// should not be called directly.
const base::DictionaryValue* GetGeometryCache(
const std::string& extension_id) const;
diff --git a/extensions/common/view_type.h b/extensions/common/view_type.h
index e38dc20..3815da0 100644
--- a/extensions/common/view_type.h
+++ b/extensions/common/view_type.h
@@ -14,6 +14,8 @@ namespace extensions {
// data.
enum ViewType {
VIEW_TYPE_INVALID,
+ // TODO(jamescook): Rename this to VIEW_TYPE_APP_WINDOW after figuring out
+ // if the strings can be changed. http://crbug.com/344067
VIEW_TYPE_APP_SHELL,
VIEW_TYPE_BACKGROUND_CONTENTS,
VIEW_TYPE_EXTENSION_BACKGROUND_PAGE,