OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "athena/content/shell/shell_app_activity.h" | 5 #include "athena/content/shell/shell_app_activity.h" |
6 | 6 |
| 7 #include "extensions/browser/app_window/app_window.h" |
| 8 #include "extensions/browser/app_window/native_app_window.h" |
7 #include "extensions/shell/browser/shell_app_window.h" | 9 #include "extensions/shell/browser/shell_app_window.h" |
8 | 10 |
9 namespace athena { | 11 namespace athena { |
10 | 12 |
| 13 ShellAppActivity::ShellAppActivity(extensions::AppWindow* app_window) |
| 14 : AppActivity(app_window->extension_id()), app_window_(app_window) { |
| 15 } |
| 16 |
11 ShellAppActivity::ShellAppActivity(extensions::ShellAppWindow* app_window, | 17 ShellAppActivity::ShellAppActivity(extensions::ShellAppWindow* app_window, |
12 const std::string& app_id) | 18 const std::string& app_id) |
13 : AppActivity(app_id), shell_app_window_(app_window) { | 19 : AppActivity(app_id), app_window_(NULL), shell_app_window_(app_window) { |
14 } | 20 } |
15 | 21 |
16 ShellAppActivity::~ShellAppActivity() { | 22 ShellAppActivity::~ShellAppActivity() { |
| 23 if (app_window_) |
| 24 app_window_->GetBaseWindow()->Close(); // Deletes |app_window_|. |
17 } | 25 } |
18 | 26 |
19 content::WebContents* ShellAppActivity::GetWebContents() { | 27 content::WebContents* ShellAppActivity::GetWebContents() { |
| 28 if (app_window_) |
| 29 return app_window_->web_contents(); |
| 30 DCHECK(shell_app_window_); |
20 return shell_app_window_->GetAssociatedWebContents(); | 31 return shell_app_window_->GetAssociatedWebContents(); |
21 } | 32 } |
22 | 33 |
23 } // namespace athena | 34 } // namespace athena |
OLD | NEW |