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

Side by Side Diff: chrome/browser/ui/views/desktop_capture/desktop_media_picker_views.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 "chrome/browser/ui/views/desktop_capture/desktop_media_picker_views.h" 5 #include "chrome/browser/ui/views/desktop_capture/desktop_media_picker_views.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/browser/ui/views/desktop_media_picker_views_deprecated.h" 16 #include "chrome/browser/ui/views/desktop_media_picker_views_deprecated.h"
18 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
19 #include "chrome/grit/chromium_strings.h" 18 #include "chrome/grit/chromium_strings.h"
20 #include "chrome/grit/generated_resources.h" 19 #include "chrome/grit/generated_resources.h"
21 #include "chrome/grit/google_chrome_strings.h" 20 #include "chrome/grit/google_chrome_strings.h"
22 #include "components/constrained_window/constrained_window_views.h" 21 #include "components/constrained_window/constrained_window_views.h"
23 #include "components/web_modal/web_contents_modal_dialog_manager.h" 22 #include "components/web_modal/web_contents_modal_dialog_manager.h"
24 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
25 #include "content/public/browser/render_frame_host.h" 24 #include "content/public/browser/render_frame_host.h"
26 #include "content/public/browser/web_contents_delegate.h" 25 #include "content/public/browser/web_contents_delegate.h"
(...skipping 30 matching lines...) Expand all
57 const int kListItemHeight = 56 const int kListItemHeight =
58 kThumbnailMargin * 2 + kThumbnailHeight + kLabelHeight; 57 kThumbnailMargin * 2 + kThumbnailHeight + kLabelHeight;
59 const int kListColumns = 3; 58 const int kListColumns = 3;
60 const int kTotalListWidth = kListColumns * kListItemWidth; 59 const int kTotalListWidth = kListColumns * kListItemWidth;
61 60
62 const int kDesktopMediaSourceViewGroupId = 1; 61 const int kDesktopMediaSourceViewGroupId = 1;
63 62
64 const char kDesktopMediaSourceViewClassName[] = 63 const char kDesktopMediaSourceViewClassName[] =
65 "DesktopMediaPicker_DesktopMediaSourceView"; 64 "DesktopMediaPicker_DesktopMediaSourceView";
66 65
66 #if !defined(USE_ASH)
67 DesktopMediaID::Id AcceleratedWidgetToDesktopMediaId( 67 DesktopMediaID::Id AcceleratedWidgetToDesktopMediaId(
68 gfx::AcceleratedWidget accelerated_widget) { 68 gfx::AcceleratedWidget accelerated_widget) {
69 #if defined(OS_WIN) 69 #if defined(OS_WIN)
70 return reinterpret_cast<DesktopMediaID::Id>(accelerated_widget); 70 return reinterpret_cast<DesktopMediaID::Id>(accelerated_widget);
71 #else 71 #else
72 return static_cast<DesktopMediaID::Id>(accelerated_widget); 72 return static_cast<DesktopMediaID::Id>(accelerated_widget);
73 #endif 73 #endif
74 } 74 }
75 #endif
75 76
76 int GetMediaListViewHeightForRows(size_t rows) { 77 int GetMediaListViewHeightForRows(size_t rows) {
77 return kListItemHeight * rows; 78 return kListItemHeight * rows;
78 } 79 }
79 80
80 } // namespace 81 } // namespace
81 82
82 DesktopMediaSourceView::DesktopMediaSourceView(DesktopMediaListView* parent, 83 DesktopMediaSourceView::DesktopMediaSourceView(DesktopMediaListView* parent,
83 DesktopMediaID source_id) 84 DesktopMediaID source_id)
84 : parent_(parent), 85 : parent_(parent),
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 508
508 // If the picker is not modal to the calling web contents then it is displayed 509 // If the picker is not modal to the calling web contents then it is displayed
509 // in its own top-level window, so in that case it needs to be filtered out of 510 // in its own top-level window, so in that case it needs to be filtered out of
510 // the list of top-level windows available for capture, and to achieve that 511 // the list of top-level windows available for capture, and to achieve that
511 // the Id is passed to DesktopMediaList. 512 // the Id is passed to DesktopMediaList.
512 DesktopMediaID dialog_window_id; 513 DesktopMediaID dialog_window_id;
513 if (!modal_dialog) { 514 if (!modal_dialog) {
514 dialog_window_id = DesktopMediaID::RegisterAuraWindow( 515 dialog_window_id = DesktopMediaID::RegisterAuraWindow(
515 DesktopMediaID::TYPE_WINDOW, widget->GetNativeWindow()); 516 DesktopMediaID::TYPE_WINDOW, widget->GetNativeWindow());
516 517
517 bool is_ash_window = false; 518 // Set native window ID if the windows is outside Ash.
518 #if defined(USE_ASH) 519 #if !defined(USE_ASH)
519 is_ash_window = chrome::IsNativeWindowInAsh(widget->GetNativeWindow()); 520 dialog_window_id.id = AcceleratedWidgetToDesktopMediaId(
521 widget->GetNativeWindow()->GetHost()->GetAcceleratedWidget());
520 #endif 522 #endif
521
522 // Set native window ID if the windows is outside Ash.
523 if (!is_ash_window) {
524 dialog_window_id.id = AcceleratedWidgetToDesktopMediaId(
525 widget->GetNativeWindow()->GetHost()->GetAcceleratedWidget());
526 }
527 } 523 }
528 524
529 for (auto& list_view : list_views_) 525 for (auto& list_view : list_views_)
530 list_view->StartUpdating(dialog_window_id); 526 list_view->StartUpdating(dialog_window_id);
531 } 527 }
532 528
533 DesktopMediaPickerDialogView::~DesktopMediaPickerDialogView() {} 529 DesktopMediaPickerDialogView::~DesktopMediaPickerDialogView() {}
534 530
535 void DesktopMediaPickerDialogView::TabSelectedAt(int index) { 531 void DesktopMediaPickerDialogView::TabSelectedAt(int index) {
536 SwitchSourceType(index); 532 SwitchSourceType(index);
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 727
732 // static 728 // static
733 std::unique_ptr<DesktopMediaPicker> DesktopMediaPicker::Create() { 729 std::unique_ptr<DesktopMediaPicker> DesktopMediaPicker::Create() {
734 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 730 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
735 extensions::switches::kDisableDesktopCapturePickerOldUI)) { 731 extensions::switches::kDisableDesktopCapturePickerOldUI)) {
736 return std::unique_ptr<DesktopMediaPicker>( 732 return std::unique_ptr<DesktopMediaPicker>(
737 new deprecated::DesktopMediaPickerViews()); 733 new deprecated::DesktopMediaPickerViews());
738 } 734 }
739 return std::unique_ptr<DesktopMediaPicker>(new DesktopMediaPickerViews()); 735 return std::unique_ptr<DesktopMediaPicker>(new DesktopMediaPickerViews());
740 } 736 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698