Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Side by Side Diff: chrome/browser/ui/views/desktop_media_picker_views_deprecated.cc

Issue 1960293003: Remove OS_CHROMEOS from ui/ash code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "desktop_media_picker_views_deprecated.h" 5 #include "desktop_media_picker_views_deprecated.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "chrome/browser/media/combined_desktop_media_list.h" 14 #include "chrome/browser/media/combined_desktop_media_list.h"
15 #include "chrome/browser/media/desktop_media_list.h" 15 #include "chrome/browser/media/desktop_media_list.h"
16 #include "chrome/browser/ui/ash/ash_util.h"
17 #include "chrome/common/chrome_switches.h" 16 #include "chrome/common/chrome_switches.h"
18 #include "chrome/grit/generated_resources.h" 17 #include "chrome/grit/generated_resources.h"
19 #include "components/constrained_window/constrained_window_views.h" 18 #include "components/constrained_window/constrained_window_views.h"
20 #include "components/web_modal/web_contents_modal_dialog_manager.h" 19 #include "components/web_modal/web_contents_modal_dialog_manager.h"
21 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
22 #include "content/public/browser/render_frame_host.h" 21 #include "content/public/browser/render_frame_host.h"
23 #include "content/public/browser/web_contents_delegate.h" 22 #include "content/public/browser/web_contents_delegate.h"
24 #include "grit/components_strings.h" 23 #include "grit/components_strings.h"
25 #include "ui/aura/window_tree_host.h" 24 #include "ui/aura/window_tree_host.h"
26 #include "ui/base/l10n/l10n_util.h" 25 #include "ui/base/l10n/l10n_util.h"
(...skipping 25 matching lines...) Expand all
52 const int kListItemHeight = 51 const int kListItemHeight =
53 kThumbnailMargin * 2 + kThumbnailHeight + kLabelHeight; 52 kThumbnailMargin * 2 + kThumbnailHeight + kLabelHeight;
54 const int kListColumns = 3; 53 const int kListColumns = 3;
55 const int kTotalListWidth = kListColumns * kListItemWidth; 54 const int kTotalListWidth = kListColumns * kListItemWidth;
56 55
57 const int kDesktopMediaSourceViewGroupId = 1; 56 const int kDesktopMediaSourceViewGroupId = 1;
58 57
59 const char kDesktopMediaSourceViewClassName[] = 58 const char kDesktopMediaSourceViewClassName[] =
60 "DesktopMediaPicker_DesktopMediaSourceView"; 59 "DesktopMediaPicker_DesktopMediaSourceView";
61 60
61 #if !defined(USE_ASH)
62 DesktopMediaID::Id AcceleratedWidgetToDesktopMediaId( 62 DesktopMediaID::Id AcceleratedWidgetToDesktopMediaId(
63 gfx::AcceleratedWidget accelerated_widget) { 63 gfx::AcceleratedWidget accelerated_widget) {
64 #if defined(OS_WIN) 64 #if defined(OS_WIN)
65 return reinterpret_cast<DesktopMediaID::Id>(accelerated_widget); 65 return reinterpret_cast<DesktopMediaID::Id>(accelerated_widget);
66 #else 66 #else
67 return static_cast<DesktopMediaID::Id>(accelerated_widget); 67 return static_cast<DesktopMediaID::Id>(accelerated_widget);
68 #endif 68 #endif
69 } 69 }
70 #endif
70 71
71 int GetMediaListViewHeightForRows(size_t rows) { 72 int GetMediaListViewHeightForRows(size_t rows) {
72 return kListItemHeight * rows; 73 return kListItemHeight * rows;
73 } 74 }
74 75
75 } // namespace 76 } // namespace
76 77
77 namespace deprecated { 78 namespace deprecated {
78 79
79 DesktopMediaSourceView::DesktopMediaSourceView(DesktopMediaListView* parent, 80 DesktopMediaSourceView::DesktopMediaSourceView(DesktopMediaListView* parent,
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 473
473 // If the picker is not modal to the calling web contents then it is displayed 474 // If the picker is not modal to the calling web contents then it is displayed
474 // in its own top-level window, so in that case it needs to be filtered out of 475 // in its own top-level window, so in that case it needs to be filtered out of
475 // the list of top-level windows available for capture, and to achieve that 476 // the list of top-level windows available for capture, and to achieve that
476 // the Id is passed to DesktopMediaList. 477 // the Id is passed to DesktopMediaList.
477 DesktopMediaID dialog_window_id; 478 DesktopMediaID dialog_window_id;
478 if (!modal_dialog) { 479 if (!modal_dialog) {
479 dialog_window_id = DesktopMediaID::RegisterAuraWindow( 480 dialog_window_id = DesktopMediaID::RegisterAuraWindow(
480 DesktopMediaID::TYPE_WINDOW, widget->GetNativeWindow()); 481 DesktopMediaID::TYPE_WINDOW, widget->GetNativeWindow());
481 482
482 bool is_ash_window = false; 483 // Set native window ID if the windows is outside Ash.
483 #if defined(USE_ASH) 484 #if !defined(USE_ASH)
484 is_ash_window = chrome::IsNativeWindowInAsh(widget->GetNativeWindow()); 485 dialog_window_id.id = AcceleratedWidgetToDesktopMediaId(
486 widget->GetNativeWindow()->GetHost()->GetAcceleratedWidget());
485 #endif 487 #endif
486
487 // Set native window ID if the windows is outside Ash.
488 if (!is_ash_window) {
489 dialog_window_id.id = AcceleratedWidgetToDesktopMediaId(
490 widget->GetNativeWindow()->GetHost()->GetAcceleratedWidget());
491 }
492 } 488 }
493 489
494 sources_list_view_->StartUpdating(dialog_window_id); 490 sources_list_view_->StartUpdating(dialog_window_id);
495 } 491 }
496 492
497 DesktopMediaPickerDialogView::~DesktopMediaPickerDialogView() {} 493 DesktopMediaPickerDialogView::~DesktopMediaPickerDialogView() {}
498 494
499 void DesktopMediaPickerDialogView::DetachParent() { 495 void DesktopMediaPickerDialogView::DetachParent() {
500 parent_ = NULL; 496 parent_ = NULL;
501 } 497 }
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 DCHECK(!callback_.is_null()); 657 DCHECK(!callback_.is_null());
662 658
663 // Notify the |callback_| asynchronously because it may need to destroy 659 // Notify the |callback_| asynchronously because it may need to destroy
664 // DesktopMediaPicker. 660 // DesktopMediaPicker.
665 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, 661 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
666 base::Bind(callback_, source)); 662 base::Bind(callback_, source));
667 callback_.Reset(); 663 callback_.Reset();
668 } 664 }
669 665
670 } // namespace deprecated 666 } // namespace deprecated
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698