OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "athena/main/athena_app_window_controller.h" | |
6 | |
7 #include "apps/shell/browser/shell_app_window.h" | |
8 #include "athena/activity/public/activity_factory.h" | |
9 #include "athena/activity/public/activity_manager.h" | |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "content/public/browser/web_contents_observer.h" | |
12 | |
13 namespace athena { | |
14 | |
15 namespace { | |
16 | |
17 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
| |
18 public: | |
19 AppWindowOwner(apps::ShellAppWindow* app_window) | |
20 : content::WebContentsObserver(app_window->GetAssociatedWebContents()), | |
21 app_window_(app_window) { | |
22 } | |
23 | |
24 // content::WebContentsObserver: | |
25 virtual void RenderFrameDeleted( | |
26 content::RenderFrameHost* render_frame_host) OVERRIDE { | |
27 delete this; | |
28 } | |
29 | |
30 private: | |
31 scoped_ptr<apps::ShellAppWindow> app_window_; | |
32 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.
| |
33 }; | |
34 | |
35 } // namespace | |
36 | |
37 AthenaAppWindowController::AthenaAppWindowController() { | |
38 } | |
39 | |
40 AthenaAppWindowController::~AthenaAppWindowController() { | |
41 } | |
42 | |
43 apps::ShellAppWindow* AthenaAppWindowController::CreateAppWindow( | |
44 content::BrowserContext* context) { | |
45 apps::ShellAppWindow* app_window = new apps::ShellAppWindow(); | |
46 app_window->Init(context, gfx::Size(100, 100)); | |
47 ActivityManager::Get()->AddActivity(ActivityFactory::Get()->CreateAppActivity( | |
48 app_window->GetAssociatedWebContents())); | |
49 new AppWindowOwner(app_window); | |
50 | |
51 return app_window; | |
52 } | |
53 | |
54 void AthenaAppWindowController::CloseAppWindows() { | |
55 // Do nothing. | |
56 } | |
57 | |
58 } // namespace athena | |
OLD | NEW |