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