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/app_activity.h" | 5 #include "athena/content/app_activity.h" |
6 | 6 |
7 #include "apps/shell/browser/shell_app_window.h" | 7 #include "apps/shell/browser/shell_app_window.h" |
8 #include "athena/activity/public/activity_manager.h" | 8 #include "athena/activity/public/activity_manager.h" |
9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
10 #include "ui/views/controls/webview/webview.h" | 10 #include "ui/views/controls/webview/webview.h" |
11 | 11 |
12 namespace athena { | 12 namespace athena { |
13 | 13 |
14 // TODO(mukai): specifies the same accelerators of WebActivity. | 14 // TODO(mukai): specifies the same accelerators of WebActivity. |
15 AppActivity::AppActivity(apps::ShellAppWindow* app_window) | 15 AppActivity::AppActivity(apps::ShellAppWindow* app_window) |
16 : app_window_(app_window), web_view_(NULL) { | 16 : app_window_(app_window), web_view_(NULL) { |
17 DCHECK(app_window_); | 17 DCHECK(app_window_); |
18 } | 18 } |
19 | 19 |
20 AppActivity::~AppActivity() { | 20 AppActivity::~AppActivity() { |
21 } | 21 } |
22 | 22 |
23 ActivityViewModel* AppActivity::GetActivityViewModel() { | 23 ActivityViewModel* AppActivity::GetActivityViewModel() { |
24 return this; | 24 return this; |
25 } | 25 } |
26 | 26 |
27 void AppActivity::Init() { | 27 void AppActivity::Init() { |
28 } | 28 } |
29 | 29 |
30 SkColor AppActivity::GetRepresentativeColor() { | 30 SkColor AppActivity::GetRepresentativeColor() const { |
31 // TODO(sad): Compute the color from the favicon. | 31 // TODO(sad): Compute the color from the favicon. |
32 return SK_ColorGRAY; | 32 return SK_ColorGRAY; |
33 } | 33 } |
34 | 34 |
35 base::string16 AppActivity::GetTitle() { | 35 base::string16 AppActivity::GetTitle() const { |
36 return web_view_->GetWebContents()->GetTitle(); | 36 return web_view_->GetWebContents()->GetTitle(); |
37 } | 37 } |
38 | 38 |
| 39 bool AppActivity::UsesFrame() const { |
| 40 return false; |
| 41 } |
| 42 |
39 views::View* AppActivity::GetContentsView() { | 43 views::View* AppActivity::GetContentsView() { |
40 if (!web_view_) { | 44 if (!web_view_) { |
| 45 // TODO(oshima): use apps::NativeAppWindowViews |
41 content::WebContents* web_contents = | 46 content::WebContents* web_contents = |
42 app_window_->GetAssociatedWebContents(); | 47 app_window_->GetAssociatedWebContents(); |
43 web_view_ = new views::WebView(web_contents->GetBrowserContext()); | 48 web_view_ = new views::WebView(web_contents->GetBrowserContext()); |
44 web_view_->SetWebContents(web_contents); | 49 web_view_->SetWebContents(web_contents); |
45 Observe(web_contents); | 50 Observe(web_contents); |
46 } | 51 } |
47 return web_view_; | 52 return web_view_; |
48 } | 53 } |
49 | 54 |
50 void AppActivity::TitleWasSet(content::NavigationEntry* entry, | 55 void AppActivity::TitleWasSet(content::NavigationEntry* entry, |
51 bool explicit_set) { | 56 bool explicit_set) { |
52 ActivityManager::Get()->UpdateActivity(this); | 57 ActivityManager::Get()->UpdateActivity(this); |
53 } | 58 } |
54 | 59 |
55 void AppActivity::DidUpdateFaviconURL( | 60 void AppActivity::DidUpdateFaviconURL( |
56 const std::vector<content::FaviconURL>& candidates) { | 61 const std::vector<content::FaviconURL>& candidates) { |
57 ActivityManager::Get()->UpdateActivity(this); | 62 ActivityManager::Get()->UpdateActivity(this); |
58 } | 63 } |
59 | 64 |
60 } // namespace athena | 65 } // namespace athena |
OLD | NEW |