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