| 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/webrtc/desktop_media_list_ash.h" | 5 #include "chrome/browser/media/webrtc/desktop_media_list_ash.h" |
| 6 | 6 |
| 7 #include "ash/public/cpp/shell_window_ids.h" | 7 #include "ash/public/cpp/shell_window_ids.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "chrome/grit/generated_resources.h" | 9 #include "chrome/grit/generated_resources.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 if (!container) | 48 if (!container) |
| 49 return; | 49 return; |
| 50 for (aura::Window::Windows::const_iterator it = container->children().begin(); | 50 for (aura::Window::Windows::const_iterator it = container->children().begin(); |
| 51 it != container->children().end(); ++it) { | 51 it != container->children().end(); ++it) { |
| 52 if (!(*it)->IsVisible() || !(*it)->CanFocus()) | 52 if (!(*it)->IsVisible() || !(*it)->CanFocus()) |
| 53 continue; | 53 continue; |
| 54 content::DesktopMediaID id = content::DesktopMediaID::RegisterAuraWindow( | 54 content::DesktopMediaID id = content::DesktopMediaID::RegisterAuraWindow( |
| 55 content::DesktopMediaID::TYPE_WINDOW, *it); | 55 content::DesktopMediaID::TYPE_WINDOW, *it); |
| 56 if (id.aura_id == view_dialog_id_.aura_id) | 56 if (id.aura_id == view_dialog_id_.aura_id) |
| 57 continue; | 57 continue; |
| 58 SourceDescription window_source(id, (*it)->title()); | 58 SourceDescription window_source(id, (*it)->GetTitle()); |
| 59 sources->push_back(window_source); | 59 sources->push_back(window_source); |
| 60 | 60 |
| 61 CaptureThumbnail(window_source.id, *it); | 61 CaptureThumbnail(window_source.id, *it); |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| 65 void DesktopMediaListAsh::EnumerateSources( | 65 void DesktopMediaListAsh::EnumerateSources( |
| 66 std::vector<DesktopMediaListAsh::SourceDescription>* sources) { | 66 std::vector<DesktopMediaListAsh::SourceDescription>* sources) { |
| 67 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 67 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 68 | 68 |
| 69 aura::Window::Windows root_windows = ash::Shell::GetAllRootWindows(); | 69 aura::Window::Windows root_windows = ash::Shell::GetAllRootWindows(); |
| 70 | 70 |
| 71 for (size_t i = 0; i < root_windows.size(); ++i) { | 71 for (size_t i = 0; i < root_windows.size(); ++i) { |
| 72 if (source_types_ & SCREENS) { | 72 if (source_types_ & SCREENS) { |
| 73 SourceDescription screen_source( | 73 SourceDescription screen_source( |
| 74 content::DesktopMediaID::RegisterAuraWindow( | 74 content::DesktopMediaID::RegisterAuraWindow( |
| 75 content::DesktopMediaID::TYPE_SCREEN, root_windows[i]), | 75 content::DesktopMediaID::TYPE_SCREEN, root_windows[i]), |
| 76 root_windows[i]->title()); | 76 root_windows[i]->GetTitle()); |
| 77 | 77 |
| 78 if (root_windows[i] == ash::Shell::GetPrimaryRootWindow()) | 78 if (root_windows[i] == ash::Shell::GetPrimaryRootWindow()) |
| 79 sources->insert(sources->begin(), screen_source); | 79 sources->insert(sources->begin(), screen_source); |
| 80 else | 80 else |
| 81 sources->push_back(screen_source); | 81 sources->push_back(screen_source); |
| 82 | 82 |
| 83 if (screen_source.name.empty()) { | 83 if (screen_source.name.empty()) { |
| 84 if (root_windows.size() > 1) { | 84 if (root_windows.size() > 1) { |
| 85 // 'Screen' in 'Screen 1, Screen 2, etc ' might be inflected in some | 85 // 'Screen' in 'Screen 1, Screen 2, etc ' might be inflected in some |
| 86 // languages depending on the number although rather unlikely. To be | 86 // languages depending on the number although rather unlikely. To be |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 133 |
| 134 --pending_window_capture_requests_; | 134 --pending_window_capture_requests_; |
| 135 DCHECK_GE(pending_window_capture_requests_, 0); | 135 DCHECK_GE(pending_window_capture_requests_, 0); |
| 136 | 136 |
| 137 if (!pending_window_capture_requests_) { | 137 if (!pending_window_capture_requests_) { |
| 138 // Once we've finished capturing all windows post a task for the next list | 138 // Once we've finished capturing all windows post a task for the next list |
| 139 // update. | 139 // update. |
| 140 ScheduleNextRefresh(); | 140 ScheduleNextRefresh(); |
| 141 } | 141 } |
| 142 } | 142 } |
| OLD | NEW |