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

Side by Side Diff: athena/content/app_activity.cc

Issue 335003003: Introduces AppActivity and handler of chrome.shell API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: AppWindowOwner Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698