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

Side by Side Diff: athena/content/chrome/content_activity_factory.cc

Issue 558243002: V2 app support step2 : Use NativeAppWindow for Activity's window. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comment Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « athena/content/app_activity_unittest.cc ('k') | athena/content/content_activity_factory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 DCHECK_EQ(app_window->web_contents(), web_view->GetWebContents());
23 Observe(app_window_->web_contents());
24 }
19 25
20 private: 26 private:
21 virtual ~ChromeAppActivity() {} 27 virtual ~ChromeAppActivity() {}
22 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
23 // AppActivity: 38 // AppActivity:
24 virtual content::WebContents* GetWebContents() OVERRIDE { 39 virtual views::WebView* GetWebView() OVERRIDE { return web_view_; }
25 return app_window_->web_contents();
26 }
27 40
28 // Not owned. 41 // Not owned.
29 extensions::AppWindow* app_window_; 42 extensions::AppWindow* app_window_;
43 views::WebView* web_view_;
30 44
31 DISALLOW_COPY_AND_ASSIGN(ChromeAppActivity); 45 DISALLOW_COPY_AND_ASSIGN(ChromeAppActivity);
32 }; 46 };
33 47
34 } // namespace 48 } // namespace
35 49
36 Activity* ContentActivityFactory::CreateAppActivity( 50 Activity* ContentActivityFactory::CreateAppActivity(
37 extensions::AppWindow* app_window) { 51 extensions::AppWindow* app_window,
38 return new ChromeAppActivity(app_window); 52 views::WebView* web_view) {
53 return new ChromeAppActivity(app_window, web_view);
39 } 54 }
40 55
41 Activity* ContentActivityFactory::CreateAppActivity( 56 Activity* ContentActivityFactory::CreateAppActivity(
42 extensions::ShellAppWindow* app_window, 57 extensions::ShellAppWindow* app_window,
43 const std::string& app_id) { 58 const std::string& app_id) {
44 return NULL; 59 return NULL;
45 } 60 }
46 61
47 } // namespace athena 62 } // namespace athena
OLDNEW
« no previous file with comments | « athena/content/app_activity_unittest.cc ('k') | athena/content/content_activity_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698