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/main/web_activity.h" |
| 6 |
| 7 #include "athena/activity/public/activity_manager.h" |
| 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "content/public/browser/web_contents.h" |
| 10 |
| 11 WebActivity::WebActivity(content::WebContents* contents) |
| 12 : content::WebContentsObserver(contents) { |
| 13 } |
| 14 |
| 15 WebActivity::~WebActivity() { |
| 16 athena::ActivityManager::Get()->RemoveActivity(this); |
| 17 } |
| 18 |
| 19 athena::ActivityViewModel* WebActivity::GetActivityViewModel() { |
| 20 return this; |
| 21 } |
| 22 |
| 23 SkColor WebActivity::GetRepresentativeColor() { |
| 24 // TODO(sad): Compute the color from the favicon. |
| 25 return SK_ColorGRAY; |
| 26 } |
| 27 |
| 28 std::string WebActivity::GetTitle() { |
| 29 return base::UTF16ToUTF8(web_contents()->GetTitle()); |
| 30 } |
| 31 |
| 32 aura::Window* WebActivity::GetNativeWindow() { |
| 33 return web_contents()->GetNativeView(); |
| 34 } |
| 35 |
| 36 void WebActivity::TitleWasSet(content::NavigationEntry* entry, |
| 37 bool explicit_set) { |
| 38 athena::ActivityManager::Get()->UpdateActivity(this); |
| 39 } |
| 40 |
| 41 void WebActivity::DidUpdateFaviconURL( |
| 42 const std::vector<content::FaviconURL>& candidates) { |
| 43 athena::ActivityManager::Get()->UpdateActivity(this); |
| 44 } |
OLD | NEW |