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

Unified Diff: athena/main/web_activity.cc

Issue 302683002: athena: Add the concept of Activity and related managers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 7 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
« no previous file with comments | « athena/main/web_activity.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: athena/main/web_activity.cc
diff --git a/athena/main/web_activity.cc b/athena/main/web_activity.cc
new file mode 100644
index 0000000000000000000000000000000000000000..196e7e7c6969b0e91fdc6b1a49ccbe1ea4549a51
--- /dev/null
+++ b/athena/main/web_activity.cc
@@ -0,0 +1,44 @@
+// 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/main/web_activity.h"
+
+#include "athena/activity/public/activity_manager.h"
+#include "base/strings/utf_string_conversions.h"
+#include "content/public/browser/web_contents.h"
+
+WebActivity::WebActivity(content::WebContents* contents)
+ : content::WebContentsObserver(contents) {
+}
+
+WebActivity::~WebActivity() {
+ athena::ActivityManager::Get()->RemoveActivity(this);
+}
+
+athena::ActivityViewModel* WebActivity::GetActivityViewModel() {
+ return this;
+}
+
+SkColor WebActivity::GetRepresentativeColor() {
+ // TODO(sad): Compute the color from the favicon.
+ return SK_ColorGRAY;
+}
+
+std::string WebActivity::GetTitle() {
+ return base::UTF16ToUTF8(web_contents()->GetTitle());
+}
+
+aura::Window* WebActivity::GetNativeWindow() {
+ return web_contents()->GetNativeView();
+}
+
+void WebActivity::TitleWasSet(content::NavigationEntry* entry,
+ bool explicit_set) {
+ athena::ActivityManager::Get()->UpdateActivity(this);
+}
+
+void WebActivity::DidUpdateFaviconURL(
+ const std::vector<content::FaviconURL>& candidates) {
+ athena::ActivityManager::Get()->UpdateActivity(this);
+}
« no previous file with comments | « athena/main/web_activity.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698