Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1487)

Unified Diff: athena/main/athena_app_window_controller.cc

Issue 335003003: Introduces AppActivity and handler of chrome.shell API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: AppWindowOwner Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: athena/main/athena_app_window_controller.cc
diff --git a/athena/main/athena_app_window_controller.cc b/athena/main/athena_app_window_controller.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3ec6199011a66a4734ee5b38a3f1bade6e1a098c
--- /dev/null
+++ b/athena/main/athena_app_window_controller.cc
@@ -0,0 +1,58 @@
+// 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 "athena/main/athena_app_window_controller.h"
+
+#include "apps/shell/browser/shell_app_window.h"
+#include "athena/activity/public/activity_factory.h"
+#include "athena/activity/public/activity_manager.h"
+#include "base/memory/scoped_ptr.h"
+#include "content/public/browser/web_contents_observer.h"
+
+namespace athena {
+
+namespace {
+
+class AppWindowOwner : public content::WebContentsObserver {
James Cook 2014/06/16 16:12:30 Could you document why the WebContents needs to ow
Jun Mukai 2014/06/16 17:46:52 Actually WebContents doesn't own the app window, t
Jun Mukai 2014/06/16 17:58:11 Thinking about this, and possibly better to make A
+ public:
+ AppWindowOwner(apps::ShellAppWindow* app_window)
+ : content::WebContentsObserver(app_window->GetAssociatedWebContents()),
+ app_window_(app_window) {
+ }
+
+ // content::WebContentsObserver:
+ virtual void RenderFrameDeleted(
+ content::RenderFrameHost* render_frame_host) OVERRIDE {
+ delete this;
+ }
+
+ private:
+ scoped_ptr<apps::ShellAppWindow> app_window_;
+ DISALLOW_COPY_AND_ASSIGN(AppWindowOwner);
James Cook 2014/06/16 16:12:31 nit: blank line above
Jun Mukai 2014/06/16 17:46:52 Done.
+};
+
+} // namespace
+
+AthenaAppWindowController::AthenaAppWindowController() {
+}
+
+AthenaAppWindowController::~AthenaAppWindowController() {
+}
+
+apps::ShellAppWindow* AthenaAppWindowController::CreateAppWindow(
+ content::BrowserContext* context) {
+ apps::ShellAppWindow* app_window = new apps::ShellAppWindow();
+ app_window->Init(context, gfx::Size(100, 100));
+ ActivityManager::Get()->AddActivity(ActivityFactory::Get()->CreateAppActivity(
+ app_window->GetAssociatedWebContents()));
+ new AppWindowOwner(app_window);
+
+ return app_window;
+}
+
+void AthenaAppWindowController::CloseAppWindows() {
+ // Do nothing.
+}
+
+} // namespace athena

Powered by Google App Engine
This is Rietveld 408576698