summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/extensions/extension_tabs_module.cc12
-rw-r--r--chrome/browser/extensions/extension_tabs_module_constants.cc1
-rw-r--r--chrome/browser/extensions/extension_tabs_module_constants.h1
-rw-r--r--chrome/browser/extensions/platform_app_browsertest.cc11
-rw-r--r--chrome/browser/ui/extensions/shell_window.cc67
-rw-r--r--chrome/browser/ui/extensions/shell_window.h4
-rw-r--r--chrome/common/extensions/api/_permission_features.json2
-rw-r--r--chrome/common/extensions/api/windows.json4
-rw-r--r--chrome/common/extensions/extension_permission_set.cc2
-rw-r--r--chrome/test/data/extensions/platform_apps/context_menu/manifest.json2
-rw-r--r--chrome/test/data/extensions/platform_apps/context_menu/test.js5
-rw-r--r--chrome/test/data/extensions/platform_apps/iframes/manifest.json2
-rw-r--r--chrome/test/data/extensions/platform_apps/iframes/test.js5
-rw-r--r--chrome/test/data/extensions/platform_apps/minimal/manifest.json2
-rw-r--r--chrome/test/data/extensions/platform_apps/minimal/test.js5
-rw-r--r--chrome/test/data/extensions/platform_apps/navigation/manifest.json2
-rw-r--r--chrome/test/data/extensions/platform_apps/navigation/test.js5
-rw-r--r--chrome/test/data/extensions/platform_apps/windows_api/manifest.json2
-rw-r--r--chrome/test/data/extensions/platform_apps/windows_api/test.html1
-rw-r--r--chrome/test/data/extensions/platform_apps/windows_api/test.js61
20 files changed, 38 insertions, 158 deletions
diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc
index af88edf..dc4f2da 100644
--- a/chrome/browser/extensions/extension_tabs_module.cc
+++ b/chrome/browser/extensions/extension_tabs_module.cc
@@ -564,18 +564,6 @@ bool CreateWindowFunction::RunImpl() {
window_type = Browser::TYPE_PANEL;
else
window_type = Browser::TYPE_POPUP;
- } else if (type_str == keys::kWindowTypeValueShell &&
- GetExtension()->is_platform_app()) {
- // TODO(jeremya): remove this method of creating shell windows.
- GURL window_url = urls.empty() ? GURL(chrome::kAboutBlankURL) : urls[0];
- ShellWindow::CreateParams params;
- params.bounds = window_bounds;
- ShellWindow* shell_window = ShellWindow::Create(
- window_profile, GetExtension(), window_url, params);
- shell_window->Show();
- result_.reset(shell_window->extension_window_controller()->
- CreateWindowValueWithTabs());
- return true;
} else if (type_str != keys::kWindowTypeValueNormal) {
error_ = keys::kInvalidWindowTypeError;
return false;
diff --git a/chrome/browser/extensions/extension_tabs_module_constants.cc b/chrome/browser/extensions/extension_tabs_module_constants.cc
index 7ddd6e3..2b71b5a 100644
--- a/chrome/browser/extensions/extension_tabs_module_constants.cc
+++ b/chrome/browser/extensions/extension_tabs_module_constants.cc
@@ -67,7 +67,6 @@ const char kWindowTypeValueNormal[] = "normal";
const char kWindowTypeValuePopup[] = "popup";
const char kWindowTypeValuePanel[] = "panel";
const char kWindowTypeValueApp[] = "app";
-const char kWindowTypeValueShell[] = "shell";
const char kCanOnlyMoveTabsWithinNormalWindowsError[] = "Tabs can only be "
"moved to and from normal windows.";
diff --git a/chrome/browser/extensions/extension_tabs_module_constants.h b/chrome/browser/extensions/extension_tabs_module_constants.h
index daa35f4..19b7c37 100644
--- a/chrome/browser/extensions/extension_tabs_module_constants.h
+++ b/chrome/browser/extensions/extension_tabs_module_constants.h
@@ -72,7 +72,6 @@ extern const char kWindowTypeValueNormal[];
extern const char kWindowTypeValuePopup[];
extern const char kWindowTypeValuePanel[];
extern const char kWindowTypeValueApp[];
-extern const char kWindowTypeValueShell[];
// Error messages.
extern const char kNoCrashBrowserError[];
diff --git a/chrome/browser/extensions/platform_app_browsertest.cc b/chrome/browser/extensions/platform_app_browsertest.cc
index 748090ee..fbb99a4 100644
--- a/chrome/browser/extensions/platform_app_browsertest.cc
+++ b/chrome/browser/extensions/platform_app_browsertest.cc
@@ -150,7 +150,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, ExtensionWindowingApis) {
// Launch a platform app that shows a window.
ExtensionTestMessageListener launched_listener("Launched", false);
- const Extension* platform_app = LoadAndLaunchPlatformApp("minimal");
+ LoadAndLaunchPlatformApp("minimal");
ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
ASSERT_EQ(1U, GetShellWindowCount());
ShellWindowRegistry::ShellWindowSet shell_windows =
@@ -164,18 +164,17 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, ExtensionWindowingApis) {
ASSERT_FALSE(RunGetWindowFunctionForExtension(shell_window_id, extension));
// The app can also only see one window (its own).
- ASSERT_EQ(1U, RunGetWindowsFunctionForExtension(platform_app));
- ASSERT_TRUE(RunGetWindowFunctionForExtension(shell_window_id, platform_app));
+ // 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.
// Launch another platform app that also shows a window.
ExtensionTestMessageListener launched_listener2("Launched", false);
- const Extension* platform_app2 = LoadAndLaunchPlatformApp("context_menu");
+ 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());
- ASSERT_EQ(1U, RunGetWindowsFunctionForExtension(platform_app));
- ASSERT_EQ(1U, RunGetWindowsFunctionForExtension(platform_app2));
+ // TODO(jeremya): as above, this requires more extension functions.
}
// TODO(benwells): fix these tests for ChromeOS.
diff --git a/chrome/browser/ui/extensions/shell_window.cc b/chrome/browser/ui/extensions/shell_window.cc
index dade814..5dd6ace 100644
--- a/chrome/browser/ui/extensions/shell_window.cc
+++ b/chrome/browser/ui/extensions/shell_window.cc
@@ -7,7 +7,6 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/extensions/extension_process_manager.h"
#include "chrome/browser/extensions/extension_tabs_module_constants.h"
-#include "chrome/browser/extensions/extension_window_controller.h"
#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/browser/file_select_helper.h"
#include "chrome/browser/intents/web_intents_util.h"
@@ -41,64 +40,6 @@ static const int kDefaultWidth = 512;
static const int kDefaultHeight = 384;
} // namespace
-namespace internal {
-
-class ShellWindowController : public ExtensionWindowController {
- public:
- ShellWindowController(ShellWindow* shell_window, Profile* profile);
-
- // Overriden from ExtensionWindowController
- virtual int GetWindowId() const OVERRIDE;
- virtual std::string GetWindowTypeText() const OVERRIDE;
- virtual base::DictionaryValue* CreateWindowValueWithTabs() const OVERRIDE;
- virtual bool CanClose(Reason* reason) const OVERRIDE;
- virtual void SetFullscreenMode(bool is_fullscreen,
- const GURL& extension_url) const OVERRIDE;
- virtual bool IsVisibleToExtension(
- const extensions::Extension* extension) const OVERRIDE;
-
- private:
- ShellWindow* shell_window_;
-
- DISALLOW_COPY_AND_ASSIGN(ShellWindowController);
-};
-
-ShellWindowController::ShellWindowController(
- ShellWindow* shell_window,
- Profile* profile)
- : ExtensionWindowController(shell_window, profile),
- shell_window_(shell_window) {
-}
-
-int ShellWindowController::GetWindowId() const {
- return static_cast<int>(shell_window_->session_id().id());
-}
-
-std::string ShellWindowController::GetWindowTypeText() const {
- return extension_tabs_module_constants::kWindowTypeValueShell;
-}
-
-base::DictionaryValue* ShellWindowController::CreateWindowValueWithTabs()
- const {
- return CreateWindowValue();
-}
-
-bool ShellWindowController::CanClose(Reason* reason) const {
- return true;
-}
-
-void ShellWindowController::SetFullscreenMode(bool is_fullscreen,
- const GURL& extension_url) const {
- // TODO(mihaip): implement
-}
-
-bool ShellWindowController::IsVisibleToExtension(
- const extensions::Extension* extension) const {
- return shell_window_->extension() == extension;
-}
-
-} // namespace internal
-
ShellWindow::CreateParams::CreateParams()
: frame(ShellWindow::CreateParams::FRAME_CHROME),
bounds(10, 10, kDefaultWidth, kDefaultHeight) {
@@ -144,10 +85,6 @@ ShellWindow::ShellWindow(Profile* profile,
// Prevent the browser process from shutting down while this window is open.
browser::StartKeepAlive();
- // Make this window available to the extension API.
- extension_window_controller_.reset(
- new internal::ShellWindowController(this, profile_));
-
ShellWindowRegistry::Get(profile_)->AddShellWindow(this);
}
@@ -213,7 +150,7 @@ bool ShellWindow::IsPopupOrPanel(const WebContents* source) const {
void ShellWindow::MoveContents(WebContents* source, const gfx::Rect& pos) {
DCHECK(source == web_contents_);
- extension_window_controller_->window()->SetBounds(pos);
+ SetBounds(pos);
}
void ShellWindow::NavigationStateChanged(
@@ -244,7 +181,7 @@ void ShellWindow::Observe(int type,
}
ExtensionWindowController* ShellWindow::GetExtensionWindowController() const {
- return extension_window_controller_.get();
+ return NULL;
}
void ShellWindow::OnRequest(const ExtensionHostMsg_Request_Params& params) {
diff --git a/chrome/browser/ui/extensions/shell_window.h b/chrome/browser/ui/extensions/shell_window.h
index edb7109..70cfffb 100644
--- a/chrome/browser/ui/extensions/shell_window.h
+++ b/chrome/browser/ui/extensions/shell_window.h
@@ -59,9 +59,6 @@ class ShellWindow : public content::NotificationObserver,
const CreateParams params);
const SessionID& session_id() const { return session_id_; }
- const ExtensionWindowController* extension_window_controller() const {
- return extension_window_controller_.get();
- }
const extensions::Extension* extension() const { return extension_; }
content::WebContents* web_contents() const { return web_contents_; }
@@ -128,7 +125,6 @@ class ShellWindow : public content::NotificationObserver,
// web_contents_ is owned by contents_wrapper_.
content::WebContents* web_contents_;
content::NotificationRegistrar registrar_;
- scoped_ptr<ExtensionWindowController> extension_window_controller_;
ExtensionFunctionDispatcher extension_function_dispatcher_;
DISALLOW_COPY_AND_ASSIGN(ShellWindow);
diff --git a/chrome/common/extensions/api/_permission_features.json b/chrome/common/extensions/api/_permission_features.json
index ead25b6..ac2d56c 100644
--- a/chrome/common/extensions/api/_permission_features.json
+++ b/chrome/common/extensions/api/_permission_features.json
@@ -217,7 +217,7 @@
},
"tabs": {
"channel": "stable",
- "extension_types": ["extension", "packaged_app", "platform_app"]
+ "extension_types": ["extension", "packaged_app"]
},
"terminalPrivate": {
"channel": "stable",
diff --git a/chrome/common/extensions/api/windows.json b/chrome/common/extensions/api/windows.json
index 58b6cf2..9e3cd85 100644
--- a/chrome/common/extensions/api/windows.json
+++ b/chrome/common/extensions/api/windows.json
@@ -22,7 +22,7 @@
"type": {
"type": "string",
"description": "The type of browser window this is.",
- "enum": ["normal", "popup", "panel", "app", "shell"]
+ "enum": ["normal", "popup", "panel", "app"]
},
"state": {
"type": "string",
@@ -174,7 +174,7 @@
"type": "string",
"optional": true,
"description": "Specifies what type of browser window to create. The 'panel' type creates a popup unless the '--enable-panels' flag is set.",
- "enum": ["normal", "popup", "panel", "shell"]
+ "enum": ["normal", "popup", "panel"]
}
},
"optional": true
diff --git a/chrome/common/extensions/extension_permission_set.cc b/chrome/common/extensions/extension_permission_set.cc
index 85f2a83..fb392dd 100644
--- a/chrome/common/extensions/extension_permission_set.cc
+++ b/chrome/common/extensions/extension_permission_set.cc
@@ -367,8 +367,6 @@ void ExtensionAPIPermission::RegisterAllPermissions(
// Register aliases.
info->RegisterAlias("unlimitedStorage", kOldUnlimitedStoragePermission);
- // TODO(mihaip): Remove this alias for platform apps, and only give them
- // access to the chrome.windows.* APIs, but not the chrome.tabs.* ones.
info->RegisterAlias("tabs", kWindowsPermission);
// TODO(mihaip): Should be removed for the M20 branch, see
// http://crbug.com/120447 for more details.
diff --git a/chrome/test/data/extensions/platform_apps/context_menu/manifest.json b/chrome/test/data/extensions/platform_apps/context_menu/manifest.json
index 4f62a5d..4bd3363 100644
--- a/chrome/test/data/extensions/platform_apps/context_menu/manifest.json
+++ b/chrome/test/data/extensions/platform_apps/context_menu/manifest.json
@@ -5,7 +5,7 @@
"manifest_version": 2,
"permissions": [
"experimental",
- "windows",
+ "appWindow",
"contextMenus"
],
"background": {
diff --git a/chrome/test/data/extensions/platform_apps/context_menu/test.js b/chrome/test/data/extensions/platform_apps/context_menu/test.js
index f762ade..9b1d96e 100644
--- a/chrome/test/data/extensions/platform_apps/context_menu/test.js
+++ b/chrome/test/data/extensions/platform_apps/context_menu/test.js
@@ -8,9 +8,6 @@ chrome.experimental.app.onLaunched.addListener(function() {
title: 'Extension Item 1',
},
function() {
- chrome.windows.create({
- url: 'main.html',
- type: 'shell'
- });
+ chrome.appWindow.create('main.html', {}, function() {});
});
});
diff --git a/chrome/test/data/extensions/platform_apps/iframes/manifest.json b/chrome/test/data/extensions/platform_apps/iframes/manifest.json
index ad4ad8e..32b4de32 100644
--- a/chrome/test/data/extensions/platform_apps/iframes/manifest.json
+++ b/chrome/test/data/extensions/platform_apps/iframes/manifest.json
@@ -5,7 +5,7 @@
"manifest_version": 2,
"permissions": [
"experimental",
- "windows"
+ "appWindow"
],
"background": {
"scripts": ["test.js"]
diff --git a/chrome/test/data/extensions/platform_apps/iframes/test.js b/chrome/test/data/extensions/platform_apps/iframes/test.js
index 68d54a8..ce719f7 100644
--- a/chrome/test/data/extensions/platform_apps/iframes/test.js
+++ b/chrome/test/data/extensions/platform_apps/iframes/test.js
@@ -3,8 +3,5 @@
// found in the LICENSE file.
chrome.experimental.app.onLaunched.addListener(function() {
- chrome.windows.create({
- url: 'main.html',
- type: 'shell'
- });
+ chrome.appWindow.create('main.html', {}, function () {});
});
diff --git a/chrome/test/data/extensions/platform_apps/minimal/manifest.json b/chrome/test/data/extensions/platform_apps/minimal/manifest.json
index 8dec6b1..0f3b6f2 100644
--- a/chrome/test/data/extensions/platform_apps/minimal/manifest.json
+++ b/chrome/test/data/extensions/platform_apps/minimal/manifest.json
@@ -5,7 +5,7 @@
"manifest_version": 2,
"permissions": [
"experimental",
- "windows"
+ "appWindow"
],
"background": {
"scripts": ["test.js"]
diff --git a/chrome/test/data/extensions/platform_apps/minimal/test.js b/chrome/test/data/extensions/platform_apps/minimal/test.js
index 68d54a8..ce719f7 100644
--- a/chrome/test/data/extensions/platform_apps/minimal/test.js
+++ b/chrome/test/data/extensions/platform_apps/minimal/test.js
@@ -3,8 +3,5 @@
// found in the LICENSE file.
chrome.experimental.app.onLaunched.addListener(function() {
- chrome.windows.create({
- url: 'main.html',
- type: 'shell'
- });
+ chrome.appWindow.create('main.html', {}, function () {});
});
diff --git a/chrome/test/data/extensions/platform_apps/navigation/manifest.json b/chrome/test/data/extensions/platform_apps/navigation/manifest.json
index 1596ea0..ec6b8f3 100644
--- a/chrome/test/data/extensions/platform_apps/navigation/manifest.json
+++ b/chrome/test/data/extensions/platform_apps/navigation/manifest.json
@@ -5,7 +5,7 @@
"manifest_version": 2,
"permissions": [
"experimental",
- "windows"
+ "appWindow"
],
"background": {
"scripts": ["test.js"]
diff --git a/chrome/test/data/extensions/platform_apps/navigation/test.js b/chrome/test/data/extensions/platform_apps/navigation/test.js
index 68d54a8..44a3ba3 100644
--- a/chrome/test/data/extensions/platform_apps/navigation/test.js
+++ b/chrome/test/data/extensions/platform_apps/navigation/test.js
@@ -3,8 +3,5 @@
// found in the LICENSE file.
chrome.experimental.app.onLaunched.addListener(function() {
- chrome.windows.create({
- url: 'main.html',
- type: 'shell'
- });
+ chrome.appWindow.create('main.html', {}, function () {})
});
diff --git a/chrome/test/data/extensions/platform_apps/windows_api/manifest.json b/chrome/test/data/extensions/platform_apps/windows_api/manifest.json
index 3db46d8..d068188 100644
--- a/chrome/test/data/extensions/platform_apps/windows_api/manifest.json
+++ b/chrome/test/data/extensions/platform_apps/windows_api/manifest.json
@@ -5,7 +5,7 @@
"manifest_version": 2,
"permissions": [
"experimental",
- "windows"
+ "appWindow"
],
"background": {
"scripts": ["test.js"]
diff --git a/chrome/test/data/extensions/platform_apps/windows_api/test.html b/chrome/test/data/extensions/platform_apps/windows_api/test.html
new file mode 100644
index 0000000..c341a40
--- /dev/null
+++ b/chrome/test/data/extensions/platform_apps/windows_api/test.html
@@ -0,0 +1 @@
+<!-- empty -->
diff --git a/chrome/test/data/extensions/platform_apps/windows_api/test.js b/chrome/test/data/extensions/platform_apps/windows_api/test.js
index 2e71c9b..09e3dbf 100644
--- a/chrome/test/data/extensions/platform_apps/windows_api/test.js
+++ b/chrome/test/data/extensions/platform_apps/windows_api/test.js
@@ -5,51 +5,26 @@
var callbackPass = chrome.test.callbackPass;
chrome.experimental.app.onLaunched.addListener(function() {
- // Only a few chrome.windows.* API methods are tested, it is assumed that the
- // full API is tested elsewhere.
chrome.test.runTests([
function testCreateWindow() {
- var getShellWindowCount = function(callback) {
- chrome.windows.getAll(function(windows) {
- callback(windows.filter(
- function(window) { return window.type == 'shell' }).length);
- });
- };
-
- getShellWindowCount(callbackPass(function(shellWindowCount) {
- chrome.test.assertEq(0, shellWindowCount);
- chrome.windows.create(
- {type: 'shell', width: 128, height: 128},
- callbackPass(function() {
- getShellWindowCount(callbackPass(function(shellWindowCount) {
- chrome.test.assertEq(1, shellWindowCount);
- }));
- }));
- }));
- },
-
- function testUpdateWindowWidth() {
- chrome.windows.create(
- {type: 'shell', width: 128, height: 128},
- callbackPass(function(window) {
- chrome.windows.update(
- window.id,
- // 256 is a width that will snap to the Aura grid, thus this
- // should be the actual width on Aura (when read back).
- {width: 256, height: 128},
- callbackPass(function() {
- // The timeout is rather lame, but reading back the width from
- // the window manager (on Linux) immediately still reports the
- // old value.
- setTimeout(callbackPass(function() {
- chrome.windows.getCurrent(callbackPass(function(window) {
- chrome.test.assertEq(256, window.width);
- }));
- }), 1000);
- }));
- }));
- },
-
+ chrome.appWindow.create('test.html', {}, callbackPass(function (win) {
+ chrome.test.assertTrue(typeof win.window === 'object');
+ }))
+ },
+ function testUpdateWindowWidth() {
+ chrome.appWindow.create('test.html',
+ {width:512, height:384, frame:'custom'},
+ callbackPass(function(win) {
+ // TODO(jeremya): assert that width and height specified in options
+ // above specify the innerWidth, not the outerWidth.
+ //chrome.test.assertEq(512, win.outerWidth);
+ //chrome.test.assertEq(384, win.outerHeight);
+ var oldWidth = win.outerWidth, oldHeight = win.outerHeight;
+ win.resizeBy(-256, 0);
+ chrome.test.assertEq(oldWidth - 256, win.outerWidth);
+ chrome.test.assertEq(oldHeight, win.outerHeight);
+ }));
+ },
]);
});