Chromium Code Reviews| 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 "apps/shell/browser/shell_app_window.h" | |
| 8 #include "athena/activity/public/activity_manager.h" | |
| 9 #include "content/public/browser/web_contents.h" | |
| 10 #include "ui/views/controls/webview/webview.h" | |
| 11 | |
| 12 namespace athena { | |
| 13 | |
| 14 // AppActivity is similar to WebActivity but doesn't have accelerators. | |
|
oshima
2014/06/16 18:40:08
Apps does not support accelerator because there wa
Jun Mukai
2014/06/16 18:48:15
Removed this comment, but do you mean eventually w
oshima
2014/06/16 18:53:16
yes please.
Jun Mukai
2014/06/16 18:59:33
Done.
| |
| 15 AppActivity::AppActivity(apps::ShellAppWindow* app_window) | |
| 16 : app_window_(app_window), web_view_(NULL) { | |
| 17 DCHECK(app_window_); | |
| 18 } | |
| 19 | |
| 20 AppActivity::~AppActivity() { | |
| 21 } | |
| 22 | |
| 23 ActivityViewModel* AppActivity::GetActivityViewModel() { | |
| 24 return this; | |
| 25 } | |
| 26 | |
| 27 void AppActivity::Init() { | |
| 28 } | |
| 29 | |
| 30 SkColor AppActivity::GetRepresentativeColor() { | |
| 31 // TODO(sad): Compute the color from the favicon. | |
| 32 return SK_ColorGRAY; | |
| 33 } | |
| 34 | |
| 35 base::string16 AppActivity::GetTitle() { | |
| 36 return web_view_->GetWebContents()->GetTitle(); | |
| 37 } | |
| 38 | |
| 39 views::View* AppActivity::GetContentsView() { | |
| 40 if (!web_view_) { | |
| 41 content::WebContents* web_contents = | |
| 42 app_window_->GetAssociatedWebContents(); | |
| 43 web_view_ = new views::WebView(web_contents->GetBrowserContext()); | |
| 44 web_view_->SetWebContents(web_contents); | |
| 45 Observe(web_contents); | |
| 46 } | |
| 47 return web_view_; | |
| 48 } | |
| 49 | |
| 50 void AppActivity::TitleWasSet(content::NavigationEntry* entry, | |
| 51 bool explicit_set) { | |
| 52 ActivityManager::Get()->UpdateActivity(this); | |
| 53 } | |
| 54 | |
| 55 void AppActivity::DidUpdateFaviconURL( | |
| 56 const std::vector<content::FaviconURL>& candidates) { | |
| 57 ActivityManager::Get()->UpdateActivity(this); | |
| 58 } | |
| 59 | |
| 60 } // namespace athena | |
| OLD | NEW |