summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/app_controller_mac.mm6
-rw-r--r--chrome/browser/app_controller_mac_browsertest.mm8
-rw-r--r--chrome/browser/chromeos/app_mode/app_session_lifetime.cc8
-rw-r--r--chrome/browser/extensions/DEPS1
-rw-r--r--chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc5
-rw-r--r--chrome/browser/extensions/api/app_window/app_window_api.cc7
-rw-r--r--chrome/browser/extensions/api/app_window/app_window_apitest.cc8
-rw-r--r--chrome/browser/extensions/api/developer_private/developer_private_api.cc3
-rw-r--r--chrome/browser/extensions/api/file_system/file_system_api.cc5
-rw-r--r--chrome/browser/extensions/api/identity/web_auth_flow.cc4
-rw-r--r--chrome/browser/extensions/api/identity/web_auth_flow.h6
-rw-r--r--chrome/browser/extensions/api/media_galleries/media_galleries_api.cc4
-rw-r--r--chrome/browser/extensions/api/tabs/tabs_api.cc2
-rw-r--r--chrome/browser/extensions/extension_service.cc1
-rw-r--r--chrome/browser/extensions/extension_tab_util.cc6
-rw-r--r--chrome/browser/extensions/platform_app_browsertest.cc3
-rw-r--r--chrome/browser/extensions/platform_app_browsertest_util.cc3
-rw-r--r--chrome/browser/extensions/shell_window_registry.cc306
-rw-r--r--chrome/browser/extensions/shell_window_registry.h153
-rw-r--r--chrome/browser/extensions/web_view_interactive_browsertest.cc6
-rw-r--r--chrome/browser/extensions/window_open_apitest.cc4
-rw-r--r--chrome/browser/ui/ash/chrome_shell_delegate.cc4
-rw-r--r--chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc8
-rw-r--r--chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc2
-rw-r--r--chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_browsertest.cc8
-rw-r--r--chrome/browser/ui/ash/launcher/shell_window_launcher_controller.cc2
-rw-r--r--chrome/browser/ui/ash/launcher/shell_window_launcher_controller.h6
-rw-r--r--chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc4
-rw-r--r--chrome/browser/ui/extensions/apps_metro_handler_win.cc4
-rw-r--r--chrome/browser/ui/views/select_file_dialog_extension.cc4
-rw-r--r--chrome/browser/ui/webui/extensions/extension_settings_handler.cc8
-rw-r--r--chrome/chrome_browser_extensions.gypi2
32 files changed, 73 insertions, 528 deletions
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index 859a539..d360a60 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -6,6 +6,7 @@
#include "apps/app_shim/extension_app_shim_handler_mac.h"
#include "apps/shell_window.h"
+#include "apps/shell_window_registry.h"
#include "base/auto_reset.h"
#include "base/bind.h"
#include "base/command_line.h"
@@ -28,7 +29,6 @@
#include "chrome/browser/download/download_service_factory.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_system.h"
-#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/printing/print_dialog_cloud.h"
@@ -388,7 +388,7 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
}
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)app {
- using extensions::ShellWindowRegistry;
+ using apps::ShellWindowRegistry;
// If there are no windows, quit immediately.
if (chrome::BrowserIterator().done() &&
@@ -1425,7 +1425,7 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
- (void)showOrHideMenuItemsForPackagedApp:(NSNotification*)notification {
NSMenu* mainMenu = [NSApp mainMenu];
apps::ShellWindow* shellWindow =
- extensions::ShellWindowRegistry::GetShellWindowForNativeWindowAnyProfile(
+ apps::ShellWindowRegistry::GetShellWindowForNativeWindowAnyProfile(
[notification object]);
if (!shellWindow) {
diff --git a/chrome/browser/app_controller_mac_browsertest.mm b/chrome/browser/app_controller_mac_browsertest.mm
index 02059a5..0190fa2 100644
--- a/chrome/browser/app_controller_mac_browsertest.mm
+++ b/chrome/browser/app_controller_mac_browsertest.mm
@@ -4,6 +4,7 @@
#import <Cocoa/Cocoa.h>
+#include "apps/shell_window_registry.h"
#include "base/command_line.h"
#include "base/mac/scoped_nsobject.h"
#include "base/strings/sys_string_conversions.h"
@@ -11,7 +12,6 @@
#import "chrome/browser/app_controller_mac.h"
#include "chrome/browser/extensions/extension_test_message_listener.h"
#include "chrome/browser/extensions/platform_app_browsertest_util.h"
-#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
@@ -77,7 +77,7 @@ IN_PROC_BROWSER_TEST_F(AppControllerPlatformAppBrowserTest,
// 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 =
- extensions::ShellWindowRegistry::Get(profile())->
+ apps::ShellWindowRegistry::Get(profile())->
GetShellWindowsForApp(app_1->id()).front();
[[NSNotificationCenter defaultCenter]
postNotificationName:NSWindowDidBecomeMainNotification
@@ -94,7 +94,7 @@ IN_PROC_BROWSER_TEST_F(AppControllerPlatformAppBrowserTest,
// When another app is focused, the menu item for the app should change.
apps::ShellWindow* app_2_shell_window =
- extensions::ShellWindowRegistry::Get(profile())->
+ apps::ShellWindowRegistry::Get(profile())->
GetShellWindowsForApp(app_2->id()).front();
[[NSNotificationCenter defaultCenter]
postNotificationName:NSWindowDidBecomeMainNotification
@@ -131,7 +131,7 @@ IN_PROC_BROWSER_TEST_F(AppControllerPlatformAppBrowserTest,
InstallAndLaunchPlatformApp("minimal");
ASSERT_TRUE(listener.WaitUntilSatisfied());
- NSWindow* app_window = extensions::ShellWindowRegistry::Get(profile())->
+ NSWindow* app_window = apps::ShellWindowRegistry::Get(profile())->
GetShellWindowsForApp(app->id()).front()->GetNativeWindow();
NSWindow* browser_window = browser()->window()->GetNativeWindow();
diff --git a/chrome/browser/chromeos/app_mode/app_session_lifetime.cc b/chrome/browser/chromeos/app_mode/app_session_lifetime.cc
index 48514f0..e140e882 100644
--- a/chrome/browser/chromeos/app_mode/app_session_lifetime.cc
+++ b/chrome/browser/chromeos/app_mode/app_session_lifetime.cc
@@ -4,17 +4,17 @@
#include "chrome/browser/chromeos/app_mode/app_session_lifetime.h"
+#include "apps/shell_window_registry.h"
#include "base/basictypes.h"
#include "base/lazy_instance.h"
#include "base/prefs/pref_service.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/app_mode/kiosk_app_update_service.h"
-#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/policy/browser_policy_connector.h"
#include "chrome/common/pref_names.h"
-using extensions::ShellWindowRegistry;
+using apps::ShellWindowRegistry;
namespace chromeos {
@@ -35,7 +35,7 @@ class AppWindowWatcher : public ShellWindowRegistry::Observer {
}
private:
- // extensions::ShellWindowRegistry::Observer overrides:
+ // apps::ShellWindowRegistry::Observer overrides:
virtual void OnShellWindowAdded(apps::ShellWindow* shell_window) OVERRIDE {}
virtual void OnShellWindowIconChanged(apps::ShellWindow* shell_window)
OVERRIDE {}
@@ -46,7 +46,7 @@ class AppWindowWatcher : public ShellWindowRegistry::Observer {
}
}
- extensions::ShellWindowRegistry* window_registry_;
+ apps::ShellWindowRegistry* window_registry_;
DISALLOW_COPY_AND_ASSIGN(AppWindowWatcher);
};
diff --git a/chrome/browser/extensions/DEPS b/chrome/browser/extensions/DEPS
index 290e2e5..d16e654 100644
--- a/chrome/browser/extensions/DEPS
+++ b/chrome/browser/extensions/DEPS
@@ -8,6 +8,7 @@ include_rules = [
"+apps/launcher.h",
"+apps/native_app_window.h",
"+apps/shell_window.h",
+ "+apps/shell_window_registry.h",
# TODO(tfarina): Remove all these. crbug.com/125846.
# DO NOT ADD ANY MORE ITEMS TO THE LIST BELOW!
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 ef7fc9a..dcda353 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
@@ -6,8 +6,8 @@
#include "apps/native_app_window.h"
#include "apps/shell_window.h"
+#include "apps/shell_window_registry.h"
#include "base/command_line.h"
-#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/common/extensions/api/app_current_window_internal.h"
#include "chrome/common/extensions/api/app_window.h"
#include "chrome/common/extensions/features/feature_channel.h"
@@ -32,7 +32,8 @@ const char kDevChannelOnly[] =
} // namespace
bool AppCurrentWindowInternalExtensionFunction::RunImpl() {
- ShellWindowRegistry* registry = ShellWindowRegistry::Get(profile());
+ apps::ShellWindowRegistry* registry =
+ apps::ShellWindowRegistry::Get(profile());
DCHECK(registry);
content::RenderViewHost* rvh = render_view_host();
if (!rvh)
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 bcb83d0..7fa2492 100644
--- a/chrome/browser/extensions/api/app_window/app_window_api.cc
+++ b/chrome/browser/extensions/api/app_window/app_window_api.cc
@@ -7,13 +7,13 @@
#include "apps/app_window_contents.h"
#include "apps/native_app_window.h"
#include "apps/shell_window.h"
+#include "apps/shell_window_registry.h"
#include "base/command_line.h"
#include "base/time/time.h"
#include "base/values.h"
#include "chrome/browser/app_mode/app_mode_utils.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/devtools/devtools_window.h"
-#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/browser/extensions/window_controller.h"
#include "chrome/browser/ui/apps/chrome_shell_window_delegate.h"
#include "chrome/common/extensions/api/app_window.h"
@@ -150,7 +150,7 @@ bool AppWindowCreateFunction::RunImpl() {
create_params.window_key = *options->id;
if (!options->singleton || *options->singleton) {
- ShellWindow* window = ShellWindowRegistry::Get(profile())->
+ ShellWindow* window = apps::ShellWindowRegistry::Get(profile())->
GetShellWindowForAppAndKey(extension_id(),
create_params.window_key);
if (window) {
@@ -318,7 +318,8 @@ bool AppWindowCreateFunction::RunImpl() {
SetCreateResultFromShellWindow(shell_window, result);
SetResult(result);
- if (ShellWindowRegistry::Get(profile())->HadDevToolsAttached(created_view)) {
+ if (apps::ShellWindowRegistry::Get(profile())->
+ 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 aee3c9c..a4f3909 100644
--- a/chrome/browser/extensions/api/app_window/app_window_apitest.cc
+++ b/chrome/browser/extensions/api/app_window/app_window_apitest.cc
@@ -4,11 +4,11 @@
#include "apps/native_app_window.h"
#include "apps/shell_window.h"
+#include "apps/shell_window_registry.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/extensions/extension_test_message_listener.h"
#include "chrome/browser/extensions/platform_app_browsertest_util.h"
-#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/test/base/testing_profile.h"
#include "ui/base/base_window.h"
@@ -23,15 +23,15 @@ using apps::ShellWindow;
namespace {
class TestShellWindowRegistryObserver
- : public extensions::ShellWindowRegistry::Observer {
+ : public apps::ShellWindowRegistry::Observer {
public:
explicit TestShellWindowRegistryObserver(Profile* profile)
: profile_(profile),
icon_updates_(0) {
- extensions::ShellWindowRegistry::Get(profile_)->AddObserver(this);
+ apps::ShellWindowRegistry::Get(profile_)->AddObserver(this);
}
virtual ~TestShellWindowRegistryObserver() {
- extensions::ShellWindowRegistry::Get(profile_)->RemoveObserver(this);
+ apps::ShellWindowRegistry::Get(profile_)->RemoveObserver(this);
}
// Overridden from ShellWindowRegistry::Observer:
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 986598c..a7d8732 100644
--- a/chrome/browser/extensions/api/developer_private/developer_private_api.cc
+++ b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
@@ -8,6 +8,7 @@
#include "apps/app_restore_service.h"
#include "apps/saved_files_service.h"
#include "apps/shell_window.h"
+#include "apps/shell_window_registry.h"
#include "base/base64.h"
#include "base/command_line.h"
#include "base/file_util.h"
@@ -27,7 +28,6 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/extensions/management_policy.h"
-#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/browser/extensions/unpacked_installer.h"
#include "chrome/browser/extensions/updater/extension_updater.h"
#include "chrome/browser/platform_util.h"
@@ -67,6 +67,7 @@
#include "webkit/common/blob/shareable_file_reference.h"
using apps::ShellWindow;
+using apps::ShellWindowRegistry;
using content::RenderViewHost;
namespace extensions {
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 fe66380..7ebf9e2 100644
--- a/chrome/browser/extensions/api/file_system/file_system_api.cc
+++ b/chrome/browser/extensions/api/file_system/file_system_api.cc
@@ -6,6 +6,7 @@
#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"
@@ -20,7 +21,6 @@
#include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_system.h"
-#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/ui/chrome_select_file_policy.h"
#include "chrome/common/chrome_paths.h"
@@ -741,7 +741,8 @@ void FileSystemChooseEntryFunction::ShowPicker(
// platform-app only.
content::WebContents* web_contents = NULL;
if (extension_->is_platform_app()) {
- ShellWindowRegistry* registry = ShellWindowRegistry::Get(profile());
+ apps::ShellWindowRegistry* registry =
+ apps::ShellWindowRegistry::Get(profile());
DCHECK(registry);
ShellWindow* shell_window = registry->GetShellWindowForRenderViewHost(
render_view_host());
diff --git a/chrome/browser/extensions/api/identity/web_auth_flow.cc b/chrome/browser/extensions/api/identity/web_auth_flow.cc
index 60624a2..977f1f1 100644
--- a/chrome/browser/extensions/api/identity/web_auth_flow.cc
+++ b/chrome/browser/extensions/api/identity/web_auth_flow.cc
@@ -59,7 +59,7 @@ WebAuthFlow::~WebAuthFlow() {
WebContentsObserver::Observe(NULL);
if (!shell_window_key_.empty()) {
- ShellWindowRegistry::Get(profile_)->RemoveObserver(this);
+ apps::ShellWindowRegistry::Get(profile_)->RemoveObserver(this);
if (shell_window_ && shell_window_->web_contents())
shell_window_->web_contents()->Close();
@@ -67,7 +67,7 @@ WebAuthFlow::~WebAuthFlow() {
}
void WebAuthFlow::Start() {
- ShellWindowRegistry::Get(profile_)->AddObserver(this);
+ apps::ShellWindowRegistry::Get(profile_)->AddObserver(this);
// Attach a random ID string to the window so we can recoginize it
// in OnShellWindowAdded.
diff --git a/chrome/browser/extensions/api/identity/web_auth_flow.h b/chrome/browser/extensions/api/identity/web_auth_flow.h
index 077b1f0..e1a9852 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 "chrome/browser/extensions/shell_window_registry.h"
+#include "apps/shell_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 ShellWindowRegistry::Observer {
+ public apps::ShellWindowRegistry::Observer {
public:
enum Mode {
INTERACTIVE, // Show UI to the user if necessary.
@@ -91,7 +91,7 @@ class WebAuthFlow : public content::NotificationObserver,
private:
friend class ::WebAuthFlowTest;
- // ShellWindowRegistry::Observer implementation.
+ // ::ShellWindowRegistry::Observer implementation.
virtual void OnShellWindowAdded(apps::ShellWindow* shell_window) OVERRIDE;
virtual void OnShellWindowIconChanged(apps::ShellWindow* shell_window)
OVERRIDE;
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 25a47d2..cc5fe09 100644
--- a/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
+++ b/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
@@ -11,13 +11,13 @@
#include <vector>
#include "apps/shell_window.h"
+#include "apps/shell_window_registry.h"
#include "base/memory/scoped_ptr.h"
#include "base/platform_file.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/browser/media_galleries/media_file_system_registry.h"
#include "chrome/browser/media_galleries/media_galleries_dialog_controller.h"
#include "chrome/browser/storage_monitor/storage_monitor.h"
@@ -214,7 +214,7 @@ void MediaGalleriesGetMediaFileSystemsFunction::ShowDialog() {
// If there is no WebContentsModalDialogManager, then this contents is
// probably the background page for an app. Try to find a shell window to
// host the dialog.
- ShellWindow* window = ShellWindowRegistry::Get(profile())->
+ ShellWindow* window = apps::ShellWindowRegistry::Get(profile())->
GetCurrentShellWindowForApp(GetExtension()->id());
if (window) {
contents = window->web_contents();
diff --git a/chrome/browser/extensions/api/tabs/tabs_api.cc b/chrome/browser/extensions/api/tabs/tabs_api.cc
index cbe4a0d..d574db9 100644
--- a/chrome/browser/extensions/api/tabs/tabs_api.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_api.cc
@@ -93,9 +93,9 @@
#endif // OS_WIN
#if defined(USE_ASH)
+#include "apps/shell_window_registry.h"
#include "ash/ash_switches.h"
#include "chrome/browser/extensions/api/tabs/ash_panel_contents.h"
-#include "chrome/browser/extensions/shell_window_registry.h"
#endif
using apps::ShellWindow;
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index f64decb..f4e5ae8 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -59,7 +59,6 @@
#include "chrome/browser/extensions/management_policy.h"
#include "chrome/browser/extensions/pending_extension_manager.h"
#include "chrome/browser/extensions/permissions_updater.h"
-#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/browser/extensions/unpacked_installer.h"
#include "chrome/browser/extensions/update_observer.h"
#include "chrome/browser/extensions/updater/extension_updater.h"
diff --git a/chrome/browser/extensions/extension_tab_util.cc b/chrome/browser/extensions/extension_tab_util.cc
index b5d5ab9..8b427ab 100644
--- a/chrome/browser/extensions/extension_tab_util.cc
+++ b/chrome/browser/extensions/extension_tab_util.cc
@@ -5,8 +5,8 @@
#include "chrome/browser/extensions/extension_tab_util.h"
#include "apps/shell_window.h"
+#include "apps/shell_window_registry.h"
#include "chrome/browser/extensions/api/tabs/tabs_constants.h"
-#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/browser/extensions/tab_helper.h"
#include "chrome/browser/extensions/window_controller.h"
#include "chrome/browser/extensions/window_controller_list.h"
@@ -44,8 +44,8 @@ namespace {
extensions::WindowController* GetShellWindowController(
const WebContents* contents) {
Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
- extensions::ShellWindowRegistry* registry =
- extensions::ShellWindowRegistry::Get(profile);
+ apps::ShellWindowRegistry* registry =
+ apps::ShellWindowRegistry::Get(profile);
if (!registry)
return NULL;
ShellWindow* shell_window =
diff --git a/chrome/browser/extensions/platform_app_browsertest.cc b/chrome/browser/extensions/platform_app_browsertest.cc
index 1f124a8..8126988 100644
--- a/chrome/browser/extensions/platform_app_browsertest.cc
+++ b/chrome/browser/extensions/platform_app_browsertest.cc
@@ -5,6 +5,7 @@
#include "apps/launcher.h"
#include "apps/native_app_window.h"
#include "apps/shell_window.h"
+#include "apps/shell_window_registry.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/file_util.h"
@@ -28,7 +29,6 @@
#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/extensions/extension_test_message_listener.h"
#include "chrome/browser/extensions/platform_app_browsertest_util.h"
-#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/browser/tab_contents/render_view_context_menu.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/extensions/application_launch.h"
@@ -48,6 +48,7 @@
#include "url/gurl.h"
using apps::ShellWindow;
+using apps::ShellWindowRegistry;
using content::WebContents;
using web_modal::WebContentsModalDialogManager;
diff --git a/chrome/browser/extensions/platform_app_browsertest_util.cc b/chrome/browser/extensions/platform_app_browsertest_util.cc
index b896892..3348a00 100644
--- a/chrome/browser/extensions/platform_app_browsertest_util.cc
+++ b/chrome/browser/extensions/platform_app_browsertest_util.cc
@@ -6,11 +6,11 @@
#include "apps/app_window_contents.h"
#include "apps/native_app_window.h"
+#include "apps/shell_window_registry.h"
#include "base/command_line.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/extensions/api/tabs/tabs_api.h"
#include "chrome/browser/extensions/extension_function_test_utils.h"
-#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/browser/ui/apps/chrome_shell_window_delegate.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/extensions/application_launch.h"
@@ -20,6 +20,7 @@
#include "extensions/common/switches.h"
using apps::ShellWindow;
+using apps::ShellWindowRegistry;
using content::WebContents;
namespace utils = extension_function_test_utils;
diff --git a/chrome/browser/extensions/shell_window_registry.cc b/chrome/browser/extensions/shell_window_registry.cc
deleted file mode 100644
index d4275af..0000000
--- a/chrome/browser/extensions/shell_window_registry.cc
+++ /dev/null
@@ -1,306 +0,0 @@
-// Copyright (c) 2012 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/native_app_window.h"
-#include "apps/shell_window.h"
-#include "chrome/browser/browser_process.h"
-#include "chrome/browser/extensions/shell_window_registry.h"
-#include "chrome/browser/profiles/incognito_helpers.h"
-#include "chrome/browser/profiles/profile_manager.h"
-#include "chrome/common/extensions/extension.h"
-#include "components/browser_context_keyed_service/browser_context_dependency_manager.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"
-
-using apps::ShellWindow;
-
-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 extensions::ShellWindowRegistry* registry,
- content::RenderViewHost* render_view_host) {
- 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 extensions {
-
-ShellWindowRegistry::ShellWindowRegistry(Profile* profile)
- : profile_(profile),
- 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(Profile* profile) {
- return Factory::GetForProfile(profile, 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<Profile*> profiles =
- g_browser_process->profile_manager()->GetLoadedProfiles();
- for (std::vector<Profile*>::const_iterator i = profiles.begin();
- i != profiles.end(); ++i) {
- ShellWindowRegistry* registry = Factory::GetForProfile(*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<Profile*> profiles =
- g_browser_process->profile_manager()->GetLoadedProfiles();
- for (std::vector<Profile*>::const_iterator i = profiles.begin();
- i != profiles.end(); ++i) {
- ShellWindowRegistry* registry = Factory::GetForProfile(*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() != profile_)
- 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::GetForProfile(
- Profile* profile, bool create) {
- return static_cast<ShellWindowRegistry*>(
- GetInstance()->GetServiceForBrowserContext(profile, 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* profile) const {
- return new ShellWindowRegistry(static_cast<Profile*>(profile));
-}
-
-bool ShellWindowRegistry::Factory::ServiceIsCreatedWithBrowserContext() const {
- return true;
-}
-
-bool ShellWindowRegistry::Factory::ServiceIsNULLWhileTesting() const {
- return false;
-}
-
-content::BrowserContext* ShellWindowRegistry::Factory::GetBrowserContextToUse(
- content::BrowserContext* context) const {
- return chrome::GetBrowserContextRedirectedInIncognito(context);
-}
-
-} // namespace extensions
diff --git a/chrome/browser/extensions/shell_window_registry.h b/chrome/browser/extensions/shell_window_registry.h
deleted file mode 100644
index fb5f48e..0000000
--- a/chrome/browser/extensions/shell_window_registry.h
+++ /dev/null
@@ -1,153 +0,0 @@
-// Copyright (c) 2012 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_REGISTRY_H_
-#define CHROME_BROWSER_EXTENSIONS_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"
-
-class Profile;
-
-namespace apps {
-class ShellWindow;
-}
-
-namespace content {
-class DevToolsAgentHost;
-class RenderViewHost;
-}
-
-namespace extensions {
-
-// The ShellWindowRegistry tracks the ShellWindows for all platform apps for a
-// particular profile.
-// This class is planned to evolve into tracking all PlatformApps for a
-// particular profile, with a PlatformApp encapsulating all views (background
-// page, shell windows, tray view, panels etc.) and other app level behaviour
-// (e.g. notifications the app is interested in, lifetime of the background
-// page).
-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(Profile* profile);
- virtual ~ShellWindowRegistry();
-
- // Returns the instance for the given profile, or NULL if none. This is
- // a convenience wrapper around ShellWindowRegistry::Factory::GetForProfile.
- static ShellWindowRegistry* Get(Profile* profile);
-
- 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 profiles.
- static apps::ShellWindow* GetShellWindowForNativeWindowAnyProfile(
- gfx::NativeWindow window);
-
- // Returns true if the number of shell windows registered across all profiles
- // 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* GetForProfile(Profile* profile, bool create);
-
- static Factory* GetInstance();
- private:
- friend struct DefaultSingletonTraits<Factory>;
-
- Factory();
- virtual ~Factory();
-
- // BrowserContextKeyedServiceFactory
- virtual BrowserContextKeyedService* BuildServiceInstanceFor(
- content::BrowserContext* profile) 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);
-
- Profile* profile_;
- ShellWindowList shell_windows_;
- InspectedWindowSet inspected_windows_;
- ObserverList<Observer> observers_;
- base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_;
-};
-
-} // namespace extensions
-
-#endif // CHROME_BROWSER_EXTENSIONS_SHELL_WINDOW_REGISTRY_H_
diff --git a/chrome/browser/extensions/web_view_interactive_browsertest.cc b/chrome/browser/extensions/web_view_interactive_browsertest.cc
index 95fcfb8..170fb9b 100644
--- a/chrome/browser/extensions/web_view_interactive_browsertest.cc
+++ b/chrome/browser/extensions/web_view_interactive_browsertest.cc
@@ -3,11 +3,11 @@
// found in the LICENSE file.
#include "apps/shell_window.h"
+#include "apps/shell_window_registry.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/extensions/extension_test_message_listener.h"
#include "chrome/browser/extensions/platform_app_browsertest_util.h"
-#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/test_launcher_utils.h"
#include "chrome/test/base/ui_test_utils.h"
@@ -59,8 +59,8 @@ class WebViewInteractiveTest
}
gfx::NativeWindow GetPlatformAppWindow() {
- const extensions::ShellWindowRegistry::ShellWindowList& shell_windows =
- extensions::ShellWindowRegistry::Get(
+ const apps::ShellWindowRegistry::ShellWindowList& shell_windows =
+ apps::ShellWindowRegistry::Get(
browser()->profile())->shell_windows();
return (*shell_windows.begin())->GetNativeWindow();
}
diff --git a/chrome/browser/extensions/window_open_apitest.cc b/chrome/browser/extensions/window_open_apitest.cc
index 4991a97..b16edc1bf 100644
--- a/chrome/browser/extensions/window_open_apitest.cc
+++ b/chrome/browser/extensions/window_open_apitest.cc
@@ -28,7 +28,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#if defined(USE_ASH)
-#include "chrome/browser/extensions/shell_window_registry.h"
+#include "apps/shell_window_registry.h"
#endif
#if defined(USE_ASH) && !defined(OS_WIN)
@@ -53,7 +53,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_WindowOpen) {
int GetPanelCount(Browser* browser) {
#if defined(USE_ASH_PANELS)
- return static_cast<int>(extensions::ShellWindowRegistry::Get(
+ return static_cast<int>(apps::ShellWindowRegistry::Get(
browser->profile())->shell_windows().size());
#else
return PanelManager::GetInstance()->num_panels();
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.cc b/chrome/browser/ui/ash/chrome_shell_delegate.cc
index 1d0d4f6..2a22df0 100644
--- a/chrome/browser/ui/ash/chrome_shell_delegate.cc
+++ b/chrome/browser/ui/ash/chrome_shell_delegate.cc
@@ -6,6 +6,7 @@
#include "apps/native_app_window.h"
#include "apps/shell_window.h"
+#include "apps/shell_window_registry.h"
#include "ash/ash_switches.h"
#include "ash/host/root_window_host_factory.h"
#include "ash/launcher/launcher_types.h"
@@ -21,7 +22,6 @@
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/app_mode/app_mode_utils.h"
#include "chrome/browser/chrome_notification_types.h"
-#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/sessions/tab_restore_service.h"
@@ -187,7 +187,7 @@ void ChromeShellDelegate::ToggleFullscreen() {
}
// |window| may belong to a shell window.
- apps::ShellWindow* shell_window = extensions::ShellWindowRegistry::
+ apps::ShellWindow* shell_window = apps::ShellWindowRegistry::
GetShellWindowForNativeWindowAnyProfile(window);
if (shell_window) {
if (is_fullscreen)
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc b/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc
index d8cb05b..9b80b95 100644
--- a/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc
+++ b/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/ui/ash/chrome_shell_delegate.h"
#include "apps/native_app_window.h"
+#include "apps/shell_window_registry.h"
#include "ash/keyboard_overlay/keyboard_overlay_view.h"
#include "ash/wm/window_util.h"
#include "base/command_line.h"
@@ -20,7 +21,6 @@
#include "chrome/browser/chromeos/system/ash_system_tray_delegate.h"
#include "chrome/browser/extensions/api/terminal/terminal_extension_helper.h"
#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/speech/tts_controller.h"
#include "chrome/browser/ui/ash/caps_lock_delegate_chromeos.h"
@@ -70,9 +70,9 @@ void ChromeShellDelegate::OpenFileManager(bool as_dialog) {
}
} else {
Profile* const profile = ProfileManager::GetDefaultProfileOrOffTheRecord();
- const extensions::ShellWindowRegistry* const registry =
- extensions::ShellWindowRegistry::Get(profile);
- const extensions::ShellWindowRegistry::ShellWindowList list =
+ const apps::ShellWindowRegistry* const registry =
+ apps::ShellWindowRegistry::Get(profile);
+ const apps::ShellWindowRegistry::ShellWindowList list =
registry->GetShellWindowsForApp(kFileBrowserDomain);
if (list.empty()) {
// Open the new window.
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 1cae4cc..801538a 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
@@ -6,6 +6,7 @@
#include "apps/native_app_window.h"
#include "apps/shell_window.h"
+#include "apps/shell_window_registry.h"
#include "ash/ash_switches.h"
#include "ash/launcher/launcher.h"
#include "ash/launcher/launcher_model.h"
@@ -25,7 +26,6 @@
#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/extensions/extension_test_message_listener.h"
#include "chrome/browser/extensions/platform_app_browsertest_util.h"
-#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_browsertest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_browsertest.cc
index 8c0cfba..248b19a 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_browsertest.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_browsertest.cc
@@ -6,6 +6,7 @@
#include "apps/native_app_window.h"
#include "apps/shell_window.h"
+#include "apps/shell_window_registry.h"
#include "ash/ash_switches.h"
#include "ash/display/display_controller.h"
#include "ash/launcher/launcher.h"
@@ -26,7 +27,6 @@
#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/extensions/extension_test_message_listener.h"
#include "chrome/browser/extensions/platform_app_browsertest_util.h"
-#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_list/app_list_service.h"
#include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.h"
@@ -72,16 +72,16 @@ class TestEvent : public ui::Event {
};
class TestShellWindowRegistryObserver
- : public extensions::ShellWindowRegistry::Observer {
+ : public apps::ShellWindowRegistry::Observer {
public:
explicit TestShellWindowRegistryObserver(Profile* profile)
: profile_(profile),
icon_updates_(0) {
- extensions::ShellWindowRegistry::Get(profile_)->AddObserver(this);
+ apps::ShellWindowRegistry::Get(profile_)->AddObserver(this);
}
virtual ~TestShellWindowRegistryObserver() {
- extensions::ShellWindowRegistry::Get(profile_)->RemoveObserver(this);
+ apps::ShellWindowRegistry::Get(profile_)->RemoveObserver(this);
}
// Overridden from ShellWindowRegistry::Observer:
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 779a8f9..618397c 100644
--- a/chrome/browser/ui/ash/launcher/shell_window_launcher_controller.cc
+++ b/chrome/browser/ui/ash/launcher/shell_window_launcher_controller.cc
@@ -28,7 +28,7 @@ std::string GetAppLauncherId(ShellWindow* shell_window) {
ShellWindowLauncherController::ShellWindowLauncherController(
ChromeLauncherController* owner)
: owner_(owner),
- registry_(extensions::ShellWindowRegistry::Get(owner->profile())),
+ registry_(apps::ShellWindowRegistry::Get(owner->profile())),
activation_client_(NULL) {
registry_->AddObserver(this);
if (ash::Shell::HasInstance()) {
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 c47c357..3669f72 100644
--- a/chrome/browser/ui/ash/launcher/shell_window_launcher_controller.h
+++ b/chrome/browser/ui/ash/launcher/shell_window_launcher_controller.h
@@ -9,7 +9,7 @@
#include <map>
#include <string>
-#include "chrome/browser/extensions/shell_window_registry.h"
+#include "apps/shell_window_registry.h"
#include "ui/aura/client/activation_change_observer.h"
#include "ui/aura/window_observer.h"
@@ -34,7 +34,7 @@ class ShellWindowLauncherItemController;
// aura window manager. It handles adding and removing launcher items from
// ChromeLauncherController.
class ShellWindowLauncherController
- : public extensions::ShellWindowRegistry::Observer,
+ : public apps::ShellWindowRegistry::Observer,
public aura::WindowObserver,
public aura::client::ActivationChangeObserver {
public:
@@ -68,7 +68,7 @@ class ShellWindowLauncherController
ShellWindowLauncherItemController* ControllerForWindow(aura::Window* window);
ChromeLauncherController* owner_;
- extensions::ShellWindowRegistry* registry_; // Unowned convenience pointer
+ apps::ShellWindowRegistry* registry_; // Unowned convenience pointer
aura::client::ActivationClient* activation_client_;
// Map of app launcher id to controller.
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
index f66df35..1302645 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
@@ -10,6 +10,7 @@
#include "apps/native_app_window.h"
#include "apps/shell_window.h"
+#include "apps/shell_window_registry.h"
#include "base/base64.h"
#include "base/bind.h"
#include "base/i18n/rtl.h"
@@ -22,7 +23,6 @@
#include "base/time/time.h"
#include "chrome/browser/autofill/personal_data_manager_factory.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/autofill/autofill_credit_card_bubble_controller.h"
@@ -247,7 +247,7 @@ ui::BaseWindow* GetBaseWindowForWebContents(
gfx::NativeWindow native_window =
web_contents->GetView()->GetTopLevelNativeWindow();
apps::ShellWindow* shell_window =
- extensions::ShellWindowRegistry::
+ apps::ShellWindowRegistry::
GetShellWindowForNativeWindowAnyProfile(native_window);
return shell_window->GetBaseWindow();
}
diff --git a/chrome/browser/ui/extensions/apps_metro_handler_win.cc b/chrome/browser/ui/extensions/apps_metro_handler_win.cc
index 0f253b2..f59f675 100644
--- a/chrome/browser/ui/extensions/apps_metro_handler_win.cc
+++ b/chrome/browser/ui/extensions/apps_metro_handler_win.cc
@@ -5,7 +5,7 @@
#include "chrome/browser/ui/extensions/apps_metro_handler_win.h"
#include "apps/shell_window.h"
-#include "chrome/browser/extensions/shell_window_registry.h"
+#include "apps/shell_window_registry.h"
#include "chrome/browser/ui/simple_message_box.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -14,7 +14,7 @@
namespace chrome {
bool VerifySwitchToMetroForApps(gfx::NativeWindow parent_window) {
- if (!extensions::ShellWindowRegistry::IsShellWindowRegisteredInAnyProfile(
+ if (!apps::ShellWindowRegistry::IsShellWindowRegisteredInAnyProfile(
apps::ShellWindow::WINDOW_TYPE_DEFAULT)) {
return true;
}
diff --git a/chrome/browser/ui/views/select_file_dialog_extension.cc b/chrome/browser/ui/views/select_file_dialog_extension.cc
index 538dbed..e3324aa 100644
--- a/chrome/browser/ui/views/select_file_dialog_extension.cc
+++ b/chrome/browser/ui/views/select_file_dialog_extension.cc
@@ -6,6 +6,7 @@
#include "apps/native_app_window.h"
#include "apps/shell_window.h"
+#include "apps/shell_window_registry.h"
#include "base/bind.h"
#include "base/callback.h"
#include "base/logging.h"
@@ -17,7 +18,6 @@
#include "chrome/browser/extensions/extension_host.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_system.h"
-#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/session_tab_helper.h"
#include "chrome/browser/ui/browser.h"
@@ -270,7 +270,7 @@ void SelectFileDialogExtension::SelectFileImpl(
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 = extensions::ShellWindowRegistry::
+ shell_window = apps::ShellWindowRegistry::
GetShellWindowForNativeWindowAnyProfile(owner_window);
}
}
diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
index 37c1c1a..ac1482c 100644
--- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
+++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
@@ -8,6 +8,7 @@
#include "apps/app_restore_service.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"
@@ -34,7 +35,6 @@
#include "chrome/browser/extensions/extension_warning_set.h"
#include "chrome/browser/extensions/lazy_background_task_queue.h"
#include "chrome/browser/extensions/management_policy.h"
-#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/browser/extensions/unpacked_installer.h"
#include "chrome/browser/extensions/updater/extension_updater.h"
#include "chrome/browser/google/google_util.h"
@@ -1037,13 +1037,13 @@ void ExtensionSettingsHandler::GetShellWindowPagesForExtensionProfile(
const Extension* extension,
Profile* profile,
std::vector<ExtensionPage>* result) {
- ShellWindowRegistry* registry = ShellWindowRegistry::Get(profile);
+ apps::ShellWindowRegistry* registry = apps::ShellWindowRegistry::Get(profile);
if (!registry) return;
- const ShellWindowRegistry::ShellWindowList windows =
+ const apps::ShellWindowRegistry::ShellWindowList windows =
registry->GetShellWindowsForApp(extension->id());
- for (ShellWindowRegistry::const_iterator it = windows.begin();
+ for (apps::ShellWindowRegistry::const_iterator it = windows.begin();
it != windows.end(); ++it) {
WebContents* web_contents = (*it)->web_contents();
RenderViewHost* host = web_contents->GetRenderViewHost();
diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi
index 193f792..e0b89cf 100644
--- a/chrome/chrome_browser_extensions.gypi
+++ b/chrome/chrome_browser_extensions.gypi
@@ -745,8 +745,6 @@
'browser/extensions/script_bubble_controller.h',
'browser/extensions/script_executor.cc',
'browser/extensions/script_executor.h',
- 'browser/extensions/shell_window_registry.cc',
- 'browser/extensions/shell_window_registry.h',
'browser/extensions/standard_management_policy_provider.cc',
'browser/extensions/standard_management_policy_provider.h',
'browser/extensions/startup_helper.cc',