| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/fake_desktop_media_list.h" | 5 #include "chrome/browser/media/fake_desktop_media_list.h" |
| 6 | 6 |
| 7 #include "chrome/browser/media/desktop_media_list_observer.h" | 7 #include "chrome/browser/media/desktop_media_list_observer.h" |
| 8 #include "ui/gfx/skia_util.h" | 8 #include "ui/gfx/skia_util.h" |
| 9 | 9 |
| 10 FakeDesktopMediaList::FakeDesktopMediaList() : observer_(NULL) {} | 10 FakeDesktopMediaList::FakeDesktopMediaList() : observer_(NULL) {} |
| 11 FakeDesktopMediaList::~FakeDesktopMediaList() {} | 11 FakeDesktopMediaList::~FakeDesktopMediaList() {} |
| 12 | 12 |
| 13 void FakeDesktopMediaList::AddSource(int id) { | 13 void FakeDesktopMediaList::AddSource(int id) { |
| 14 Source source; | 14 Source source; |
| 15 source.id = content::DesktopMediaID(content::DesktopMediaID::TYPE_WINDOW, id); | 15 source.id = content::DesktopMediaID(content::DesktopMediaID::TYPE_WINDOW, id); |
| 16 source.name = base::Int64ToString16(id); | 16 source.name = base::Int64ToString16(id); |
| 17 | 17 |
| 18 sources_.push_back(source); | 18 sources_.push_back(source); |
| 19 observer_->OnSourceAdded(sources_.size() - 1); | 19 observer_->OnSourceAdded(sources_.size() - 1); |
| 20 } | 20 } |
| 21 | 21 |
| 22 void FakeDesktopMediaList::RemoveSource(int index) { | 22 void FakeDesktopMediaList::RemoveSource(int index) { |
| 23 sources_.erase(sources_.begin() + index); | 23 sources_.erase(sources_.begin() + index); |
| 24 observer_->OnSourceRemoved(sources_.size() - 1); | 24 observer_->OnSourceRemoved(index); |
| 25 } | 25 } |
| 26 | 26 |
| 27 void FakeDesktopMediaList::MoveSource(int old_index, int new_index) { | 27 void FakeDesktopMediaList::MoveSource(int old_index, int new_index) { |
| 28 Source source = sources_[old_index]; | 28 Source source = sources_[old_index]; |
| 29 sources_.erase(sources_.begin() + old_index); | 29 sources_.erase(sources_.begin() + old_index); |
| 30 sources_.insert(sources_.begin() + new_index, source); | 30 sources_.insert(sources_.begin() + new_index, source); |
| 31 observer_->OnSourceMoved(old_index, new_index); | 31 observer_->OnSourceMoved(old_index, new_index); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void FakeDesktopMediaList::SetSourceThumbnail(int index) { | 34 void FakeDesktopMediaList::SetSourceThumbnail(int index) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 56 bitmap.eraseARGB(255, 0, 255, 0); | 56 bitmap.eraseARGB(255, 0, 255, 0); |
| 57 thumbnail_ = gfx::ImageSkia::CreateFrom1xBitmap(bitmap); | 57 thumbnail_ = gfx::ImageSkia::CreateFrom1xBitmap(bitmap); |
| 58 } | 58 } |
| 59 | 59 |
| 60 int FakeDesktopMediaList::GetSourceCount() const { return sources_.size(); } | 60 int FakeDesktopMediaList::GetSourceCount() const { return sources_.size(); } |
| 61 | 61 |
| 62 const DesktopMediaList::Source& FakeDesktopMediaList::GetSource( | 62 const DesktopMediaList::Source& FakeDesktopMediaList::GetSource( |
| 63 int index) const { | 63 int index) const { |
| 64 return sources_[index]; | 64 return sources_[index]; |
| 65 } | 65 } |
| OLD | NEW |