Skip to content

Commit

Permalink
app_shell: Remove chrome.shell.onLaunched.
Browse files Browse the repository at this point in the history
app_shell can just use chrome.app.runtime.onLaunched now.

BUG=373821

Review URL: https://codereview.chromium.org/341333002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@279014 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
derat@chromium.org committed Jun 22, 2014
1 parent 3669d7d commit 49d738a
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 120 deletions.
2 changes: 0 additions & 2 deletions apps/shell/app_shell.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@
'browser/shell_network_controller_chromeos.h',
'browser/shell_runtime_api_delegate.cc',
'browser/shell_runtime_api_delegate.h',
'common/shell_app_runtime.cc',
'common/shell_app_runtime.h',
'common/shell_content_client.cc',
'common/shell_content_client.h',
'common/shell_extensions_client.cc',
Expand Down
14 changes: 0 additions & 14 deletions apps/shell/browser/api/shell/shell_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@
#include "apps/shell/common/api/shell.h"
#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "extensions/browser/event_router.h"
#include "extensions/common/extension.h"

using base::DictionaryValue;
using base::ListValue;

namespace CreateWindow = apps::shell_api::shell::CreateWindow;
namespace OnLaunched = apps::shell_api::shell::OnLaunched;

namespace apps {
namespace {
Expand All @@ -34,17 +31,6 @@ DictionaryValue* CreateResult(apps::ShellAppWindow* app_window) {

} // namespace

// static
void ShellAPI::DispatchOnLaunchedEvent(extensions::EventRouter* event_router,
const extensions::Extension* extension) {
scoped_ptr<DictionaryValue> launch_data(new DictionaryValue());
scoped_ptr<ListValue> event_args(new ListValue());
event_args->Append(launch_data.release());
scoped_ptr<extensions::Event> event(
new extensions::Event(OnLaunched::kEventName, event_args.Pass()));
event_router->DispatchEventWithLazyListener(extension->id(), event.Pass());
}

ShellCreateWindowFunction::ShellCreateWindowFunction() {
}

Expand Down
16 changes: 0 additions & 16 deletions apps/shell/browser/api/shell/shell_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,8 @@
#include "extensions/browser/extension_function.h"
#include "extensions/browser/extension_function_histogram_value.h"

namespace extensions {
class EventRouter;
class Extension;
}

namespace apps {

// Utilities for the chrome.shell API.
class ShellAPI {
public:
// Dispatches the onLaunched event.
static void DispatchOnLaunchedEvent(extensions::EventRouter* event_router,
const extensions::Extension* extension);

private:
DISALLOW_IMPLICIT_CONSTRUCTORS(ShellAPI);
};

// Implementation of the chrome.shell.createWindow() function for app_shell.
// Opens a fullscreen window and invokes the window callback to allow access to
// the JS contentWindow.
Expand Down
5 changes: 3 additions & 2 deletions apps/shell/browser/shell_extension_system.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
#include "extensions/browser/api/app_runtime/app_runtime_api.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
Expand Down Expand Up @@ -81,8 +82,8 @@ bool ShellExtensionSystem::LoadApp(const base::FilePath& app_dir) {
void ShellExtensionSystem::LaunchApp() {
// Send the onLaunched event.
DCHECK(extension_.get());
apps::ShellAPI::DispatchOnLaunchedEvent(event_router_.get(),
extension_.get());
AppRuntimeEventRouter::DispatchOnLaunchedEvent(browser_context_,
extension_.get());
}

void ShellExtensionSystem::Shutdown() {
Expand Down
9 changes: 2 additions & 7 deletions apps/shell/common/api/shell.idl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Use the <code>chrome.shell</code> API to watch for launch events and create
// windows. The <code>createWindow</code> API is a subset of
// Use the <code>chrome.shell</code> API to create windows. The
// <code>createWindow</code> API is a subset of
// <code>chrome.app.window.create</code>.
namespace shell {

Expand Down Expand Up @@ -33,9 +33,4 @@ namespace shell {
[nocompile] static AppWindow currentWindow();
[nocompile, nodoc] static void initializeAppWindow();
};

interface Events {
// Fired when the app is launched at app_shell startup.
static void onLaunched(optional object launchDataPlaceholder);
};
};
44 changes: 0 additions & 44 deletions apps/shell/common/shell_app_runtime.cc

This file was deleted.

27 changes: 0 additions & 27 deletions apps/shell/common/shell_app_runtime.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@
// have chrome.app APIs.
// Checking for "chrome.app.runtime" availability allows testing in a regular
// web page (like tests/manual.html).
if (typeof chrome !== 'undefined' &&
(chrome.shell || (chrome.app && chrome.app.runtime))) {
if (typeof chrome !== 'undefined' && chrome.app && chrome.app.runtime) {
// Compatibility for running under app_shell, which does not have app.window.
var createWindow =
chrome.shell ? chrome.shell.createWindow : chrome.app.window.create;
var onLaunched =
chrome.shell ? chrome.shell.onLaunched : chrome.app.runtime.onLaunched;

var showCalculatorWindow = function () {
createWindow('calculator.html', {
Expand All @@ -33,7 +30,7 @@ if (typeof chrome !== 'undefined' &&
});
}

onLaunched.addListener(showCalculatorWindow);
chrome.app.runtime.onLaunched.addListener(showCalculatorWindow);
}

function Controller(model, view) {
Expand Down
4 changes: 1 addition & 3 deletions extensions/test/data/platform_app/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
// Stub for app_shell.
var createWindow =
chrome.shell ? chrome.shell.createWindow : chrome.app.window.create;
var onLaunched =
chrome.shell ? chrome.shell.onLaunched : chrome.app.runtime.onLaunched;

onLaunched.addListener(function() {
chrome.app.runtime.onLaunched.addListener(function() {
createWindow('hello.html', {
'innerBounds': {
'width': 400,
Expand Down

0 comments on commit 49d738a

Please sign in to comment.