Index: athena/main/web_task.cc |
diff --git a/athena/main/web_task.cc b/athena/main/web_task.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..eb8567fdfb756a2cff507622629b9c6644077ee5 |
--- /dev/null |
+++ b/athena/main/web_task.cc |
@@ -0,0 +1,40 @@ |
+// 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_task.h" |
+ |
+#include "athena/task/public/task_manager.h" |
+#include "base/strings/utf_string_conversions.h" |
+#include "content/public/browser/web_contents.h" |
+ |
+WebTask::WebTask(content::WebContents* contents) |
+ : content::WebContentsObserver(contents) { |
+} |
+ |
+WebTask::~WebTask() { |
+ athena::TaskManager::Get()->RemoveTask(this); |
+} |
+ |
+SkColor WebTask::GetRepresentativeColor() { |
+ // TODO(sad): Compute the color from the favicon. |
+ return SK_ColorGRAY; |
+} |
+ |
+std::string WebTask::GetTitle() { |
+ return base::UTF16ToUTF8(web_contents()->GetTitle()); |
+} |
+ |
+aura::Window* WebTask::GetNativeWindow() { |
+ return web_contents()->GetNativeView(); |
+} |
+ |
+void WebTask::TitleWasSet(content::NavigationEntry* entry, |
+ bool explicit_set) { |
+ athena::TaskManager::Get()->UpdateTask(this); |
+} |
+ |
+void WebTask::DidUpdateFaviconURL( |
+ const std::vector<content::FaviconURL>& candidates) { |
+ athena::TaskManager::Get()->UpdateTask(this); |
+} |