| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "athena/main/web_activity.h" | 5 #include "athena/main/web_activity.h" |
| 6 | 6 |
| 7 #include "athena/activity/public/activity_manager.h" | 7 #include "athena/activity/public/activity_manager.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
| 10 | 10 |
| 11 WebActivity::WebActivity(content::WebContents* contents) | 11 WebActivity::WebActivity(content::WebContents* contents) |
| 12 : content::WebContentsObserver(contents) { | 12 : content::WebContentsObserver(contents) { |
| 13 } | 13 } |
| 14 | 14 |
| 15 WebActivity::~WebActivity() { | 15 WebActivity::~WebActivity() { |
| 16 athena::ActivityManager::Get()->RemoveActivity(this); | |
| 17 } | 16 } |
| 18 | 17 |
| 19 athena::ActivityViewModel* WebActivity::GetActivityViewModel() { | 18 athena::ActivityViewModel* WebActivity::GetActivityViewModel() { |
| 20 return this; | 19 return this; |
| 21 } | 20 } |
| 22 | 21 |
| 23 SkColor WebActivity::GetRepresentativeColor() { | 22 SkColor WebActivity::GetRepresentativeColor() { |
| 24 // TODO(sad): Compute the color from the favicon. | 23 // TODO(sad): Compute the color from the favicon. |
| 25 return SK_ColorGRAY; | 24 return SK_ColorGRAY; |
| 26 } | 25 } |
| 27 | 26 |
| 28 std::string WebActivity::GetTitle() { | 27 std::string WebActivity::GetTitle() { |
| 29 return base::UTF16ToUTF8(web_contents()->GetTitle()); | 28 return base::UTF16ToUTF8(web_contents()->GetTitle()); |
| 30 } | 29 } |
| 31 | 30 |
| 32 aura::Window* WebActivity::GetNativeWindow() { | 31 aura::Window* WebActivity::GetNativeWindow() { |
| 33 return web_contents()->GetNativeView(); | 32 return web_contents()->GetNativeView(); |
| 34 } | 33 } |
| 35 | 34 |
| 36 void WebActivity::TitleWasSet(content::NavigationEntry* entry, | 35 void WebActivity::TitleWasSet(content::NavigationEntry* entry, |
| 37 bool explicit_set) { | 36 bool explicit_set) { |
| 38 athena::ActivityManager::Get()->UpdateActivity(this); | 37 athena::ActivityManager::Get()->UpdateActivity(this); |
| 39 } | 38 } |
| 40 | 39 |
| 41 void WebActivity::DidUpdateFaviconURL( | 40 void WebActivity::DidUpdateFaviconURL( |
| 42 const std::vector<content::FaviconURL>& candidates) { | 41 const std::vector<content::FaviconURL>& candidates) { |
| 43 athena::ActivityManager::Get()->UpdateActivity(this); | 42 athena::ActivityManager::Get()->UpdateActivity(this); |
| 44 } | 43 } |
| OLD | NEW |