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/content_activity_factory.h" | 5 #include "athena/content/content_activity_factory.h" |
6 | 6 |
7 #include "athena/content/app_activity.h" | 7 #include "athena/content/app_activity.h" |
8 #include "extensions/browser/app_window/app_window.h" | 8 #include "extensions/browser/app_window/app_window.h" |
9 #include "ui/views/controls/webview/webview.h" | |
9 | 10 |
10 // TODO(oshima): Consolidate this and app shell implementation once | 11 // TODO(oshima): Consolidate this and app shell implementation once |
11 // crbug.com/403726 is fixed. | 12 // crbug.com/403726 is fixed. |
12 namespace athena { | 13 namespace athena { |
13 namespace { | 14 namespace { |
14 | 15 |
15 class ChromeAppActivity : public AppActivity { | 16 class ChromeAppActivity : public AppActivity { |
16 public: | 17 public: |
17 explicit ChromeAppActivity(extensions::AppWindow* app_window) | 18 ChromeAppActivity(extensions::AppWindow* app_window, views::WebView* web_view) |
18 : AppActivity(app_window->extension_id()), app_window_(app_window) {} | 19 : AppActivity(app_window->extension_id()), |
20 app_window_(app_window), | |
21 web_view_(web_view) { | |
22 Observe(app_window_->web_contents()); | |
Jun Mukai
2014/09/10 23:35:38
It is a bit unclear to me that app_window_->web_co
oshima
2014/09/11 00:12:34
Good point. Done.
| |
23 } | |
19 | 24 |
20 private: | 25 private: |
21 virtual ~ChromeAppActivity() {} | 26 virtual ~ChromeAppActivity() {} |
22 | 27 |
28 // ActivityViewModel overrides: | |
29 virtual views::Widget* CreateWidget() OVERRIDE { | |
30 // This is necessary to register apps. | |
31 // TODO(oshima): This will become unnecessary once the | |
32 // shell_app_window is removed. | |
33 GetContentsView(); | |
34 return web_view_->GetWidget(); | |
35 } | |
36 | |
23 // AppActivity: | 37 // AppActivity: |
24 virtual content::WebContents* GetWebContents() OVERRIDE { | 38 virtual views::WebView* GetWebView() OVERRIDE { return web_view_; } |
25 return app_window_->web_contents(); | |
26 } | |
27 | 39 |
28 // Not owned. | 40 // Not owned. |
29 extensions::AppWindow* app_window_; | 41 extensions::AppWindow* app_window_; |
42 views::WebView* web_view_; | |
30 | 43 |
31 DISALLOW_COPY_AND_ASSIGN(ChromeAppActivity); | 44 DISALLOW_COPY_AND_ASSIGN(ChromeAppActivity); |
32 }; | 45 }; |
33 | 46 |
34 } // namespace | 47 } // namespace |
35 | 48 |
36 Activity* ContentActivityFactory::CreateAppActivity( | 49 Activity* ContentActivityFactory::CreateAppActivity( |
37 extensions::AppWindow* app_window) { | 50 extensions::AppWindow* app_window, |
38 return new ChromeAppActivity(app_window); | 51 views::WebView* web_view) { |
52 return new ChromeAppActivity(app_window, web_view); | |
39 } | 53 } |
40 | 54 |
41 Activity* ContentActivityFactory::CreateAppActivity( | 55 Activity* ContentActivityFactory::CreateAppActivity( |
42 extensions::ShellAppWindow* app_window, | 56 extensions::ShellAppWindow* app_window, |
43 const std::string& app_id) { | 57 const std::string& app_id) { |
44 return NULL; | 58 return NULL; |
45 } | 59 } |
46 | 60 |
47 } // namespace athena | 61 } // namespace athena |
OLD | NEW |