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

Unified 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: AppWindow ownership 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 side-by-side diff with in-line comments
Download patch
Index: athena/content/app_activity.cc
diff --git a/athena/content/app_activity.cc b/athena/content/app_activity.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d0890fa7988074404f02b0978b2f9cc27e892cb0
--- /dev/null
+++ b/athena/content/app_activity.cc
@@ -0,0 +1,60 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "athena/content/app_activity.h"
+
+#include "apps/shell/browser/shell_app_window.h"
+#include "athena/activity/public/activity_manager.h"
+#include "content/public/browser/web_contents.h"
+#include "ui/views/controls/webview/webview.h"
+
+namespace athena {
+
+// 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.
+AppActivity::AppActivity(apps::ShellAppWindow* app_window)
+ : app_window_(app_window), web_view_(NULL) {
+ DCHECK(app_window_);
+}
+
+AppActivity::~AppActivity() {
+}
+
+ActivityViewModel* AppActivity::GetActivityViewModel() {
+ return this;
+}
+
+void AppActivity::Init() {
+}
+
+SkColor AppActivity::GetRepresentativeColor() {
+ // TODO(sad): Compute the color from the favicon.
+ return SK_ColorGRAY;
+}
+
+base::string16 AppActivity::GetTitle() {
+ return web_view_->GetWebContents()->GetTitle();
+}
+
+views::View* AppActivity::GetContentsView() {
+ if (!web_view_) {
+ content::WebContents* web_contents =
+ app_window_->GetAssociatedWebContents();
+ web_view_ = new views::WebView(web_contents->GetBrowserContext());
+ web_view_->SetWebContents(web_contents);
+ Observe(web_contents);
+ }
+ return web_view_;
+}
+
+void AppActivity::TitleWasSet(content::NavigationEntry* entry,
+ bool explicit_set) {
+ ActivityManager::Get()->UpdateActivity(this);
+}
+
+void AppActivity::DidUpdateFaviconURL(
+ const std::vector<content::FaviconURL>& candidates) {
+ ActivityManager::Get()->UpdateActivity(this);
+}
+
+} // namespace athena

Powered by Google App Engine
This is Rietveld 408576698