| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/media/tab_desktop_media_list.h" | 5 #include "chrome/browser/media/tab_desktop_media_list.h" |
| 6 | 6 |
| 7 #include "base/hash.h" | 7 #include "base/hash.h" |
| 8 #include "base/threading/sequenced_worker_pool.h" | 8 #include "base/threading/sequenced_worker_pool.h" |
| 9 #include "chrome/browser/profiles/profile_manager.h" | 9 #include "chrome/browser/profiles/profile_manager.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 11 #include "chrome/browser/ui/browser_list.h" | 11 #include "chrome/browser/ui/browser_list.h" |
| 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 13 #include "chrome/grit/generated_resources.h" | 13 #include "chrome/grit/generated_resources.h" |
| 14 #include "components/favicon/content/content_favicon_driver.h" | 14 #include "components/favicon/content/content_favicon_driver.h" |
| 15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 16 #include "content/public/browser/render_frame_host.h" | 16 #include "content/public/browser/render_frame_host.h" |
| 17 #include "content/public/browser/render_process_host.h" | 17 #include "content/public/browser/render_process_host.h" |
| 18 #include "media/base/video_util.h" | 18 #include "media/base/video_util.h" |
| 19 #include "third_party/skia/include/core/SkCanvas.h" | 19 #include "third_party/skia/include/core/SkCanvas.h" |
| 20 #include "third_party/skia/include/core/SkImage.h" | 20 #include "third_party/skia/include/core/SkImage.h" |
| 21 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
| 22 #include "ui/gfx/image/image.h" |
| 22 | 23 |
| 23 using content::BrowserThread; | 24 using content::BrowserThread; |
| 24 using content::DesktopMediaID; | 25 using content::DesktopMediaID; |
| 25 | 26 |
| 26 namespace { | 27 namespace { |
| 27 | 28 |
| 28 // Returns a hash of a favicon to detect when the favicon of media source has | 29 // Returns a hash of a favicon to detect when the favicon of media source has |
| 29 // changed. | 30 // changed. |
| 30 uint32_t GetImageHash(const gfx::Image& favicon) { | 31 uint32_t GetImageHash(const gfx::Image& favicon) { |
| 31 SkBitmap bitmap = favicon.AsBitmap(); | 32 SkBitmap bitmap = favicon.AsBitmap(); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 177 |
| 177 // ScheduleNextRefresh() needs to be called after all calls for | 178 // ScheduleNextRefresh() needs to be called after all calls for |
| 178 // UpdateSourceThumbnail() have done. Therefore, a DoNothing task is posted | 179 // UpdateSourceThumbnail() have done. Therefore, a DoNothing task is posted |
| 179 // to the same sequenced task runner that CreateEnlargedFaviconImag() | 180 // to the same sequenced task runner that CreateEnlargedFaviconImag() |
| 180 // is posted. | 181 // is posted. |
| 181 thumbnail_task_runner_.get()->PostTaskAndReply( | 182 thumbnail_task_runner_.get()->PostTaskAndReply( |
| 182 FROM_HERE, base::Bind(&base::DoNothing), | 183 FROM_HERE, base::Bind(&base::DoNothing), |
| 183 base::Bind(&TabDesktopMediaList::ScheduleNextRefresh, | 184 base::Bind(&TabDesktopMediaList::ScheduleNextRefresh, |
| 184 weak_factory_.GetWeakPtr())); | 185 weak_factory_.GetWeakPtr())); |
| 185 } | 186 } |
| OLD | NEW |