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

Side by Side Diff: chrome/browser/ui/views/desktop_capture/desktop_media_picker_views.cc

Issue 2270543003: Display Window Icon In Picker UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improve Comments Created 4 years, 3 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 "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "chrome/browser/media/desktop_media_list.h" 9 #include "chrome/browser/media/desktop_media_list.h"
10 #include "chrome/browser/ui/browser_finder.h" 10 #include "chrome/browser/ui/browser_finder.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 const SkColor bg_color = GetNativeTheme()->GetSystemColor( 77 const SkColor bg_color = GetNativeTheme()->GetSystemColor(
78 ui::NativeTheme::kColorId_MenuBackgroundColor); 78 ui::NativeTheme::kColorId_MenuBackgroundColor);
79 79
80 if (screen_list) { 80 if (screen_list) {
81 source_types_.push_back(DesktopMediaID::TYPE_SCREEN); 81 source_types_.push_back(DesktopMediaID::TYPE_SCREEN);
82 82
83 const DesktopMediaSourceViewStyle kSingleScreenStyle( 83 const DesktopMediaSourceViewStyle kSingleScreenStyle(
84 1, // columns 84 1, // columns
85 gfx::Size(360, 280), // item_size 85 gfx::Size(360, 280), // item_size
86 gfx::Rect(), // icon_rect
86 gfx::Rect(), // label_rect 87 gfx::Rect(), // label_rect
87 gfx::HorizontalAlignment::ALIGN_CENTER, // text_alignment 88 gfx::HorizontalAlignment::ALIGN_CENTER, // text_alignment
88 gfx::Rect(20, 20, 320, 240), // image_rect 89 gfx::Rect(20, 20, 320, 240), // image_rect
89 4, // selection_border_thickness 90 4, // selection_border_thickness
90 5); // focus_rectangle_inset 91 5); // focus_rectangle_inset
91 92
92 const DesktopMediaSourceViewStyle kGenericScreenStyle( 93 const DesktopMediaSourceViewStyle kGenericScreenStyle(
93 2, // columns 94 2, // columns
94 gfx::Size(270, 220), // item_size 95 gfx::Size(270, 220), // item_size
96 gfx::Rect(), // icon_rect
95 gfx::Rect(15, 165, 240, 40), // label_rect 97 gfx::Rect(15, 165, 240, 40), // label_rect
96 gfx::HorizontalAlignment::ALIGN_CENTER, // text_alignment 98 gfx::HorizontalAlignment::ALIGN_CENTER, // text_alignment
97 gfx::Rect(15, 15, 240, 150), // image_rect 99 gfx::Rect(15, 15, 240, 150), // image_rect
98 2, // selection_border_thickness 100 2, // selection_border_thickness
99 5); // focus_rectangle_inset 101 5); // focus_rectangle_inset
100 102
101 views::ScrollView* screen_scroll_view = 103 views::ScrollView* screen_scroll_view =
102 views::ScrollView::CreateScrollViewWithBorder(); 104 views::ScrollView::CreateScrollViewWithBorder();
103 base::string16 screen_title_text = 105 base::string16 screen_title_text =
104 l10n_util::GetStringUTF16(IDS_DESKTOP_MEDIA_PICKER_SOURCE_TYPE_SCREEN); 106 l10n_util::GetStringUTF16(IDS_DESKTOP_MEDIA_PICKER_SOURCE_TYPE_SCREEN);
(...skipping 10 matching lines...) Expand all
115 views::Background::CreateSolidBackground(bg_color)); 117 views::Background::CreateSolidBackground(bg_color));
116 118
117 pane_->AddTab(screen_title_text, screen_scroll_view); 119 pane_->AddTab(screen_title_text, screen_scroll_view);
118 pane_->set_listener(this); 120 pane_->set_listener(this);
119 } 121 }
120 122
121 if (window_list) { 123 if (window_list) {
122 source_types_.push_back(DesktopMediaID::TYPE_WINDOW); 124 source_types_.push_back(DesktopMediaID::TYPE_WINDOW);
123 125
124 const DesktopMediaSourceViewStyle kWindowStyle( 126 const DesktopMediaSourceViewStyle kWindowStyle(
125 3, // columns 127 3, // columns
126 gfx::Size(180, 160), // item_size 128 gfx::Size(180, 160), // item_size
127 gfx::Rect(10, 110, 160, 40), // label_rect 129 gfx::Rect(10, 120, 20, 20), // icon_rect
128 gfx::HorizontalAlignment::ALIGN_CENTER, // text_alignment 130 gfx::Rect(32, 110, 138, 40), // label_rect
129 gfx::Rect(8, 8, 164, 104), // image_rect 131 gfx::HorizontalAlignment::ALIGN_LEFT, // text_alignment
130 2, // selection_border_thickness 132 gfx::Rect(8, 8, 164, 104), // image_rect
131 5); // focus_rectangle_inset 133 2, // selection_border_thickness
134 5); // focus_rectangle_inset
132 135
133 views::ScrollView* window_scroll_view = 136 views::ScrollView* window_scroll_view =
134 views::ScrollView::CreateScrollViewWithBorder(); 137 views::ScrollView::CreateScrollViewWithBorder();
135 base::string16 window_title_text = 138 base::string16 window_title_text =
136 l10n_util::GetStringUTF16(IDS_DESKTOP_MEDIA_PICKER_SOURCE_TYPE_WINDOW); 139 l10n_util::GetStringUTF16(IDS_DESKTOP_MEDIA_PICKER_SOURCE_TYPE_WINDOW);
137 list_views_.push_back(new DesktopMediaListView(this, std::move(window_list), 140 list_views_.push_back(new DesktopMediaListView(this, std::move(window_list),
138 kWindowStyle, kWindowStyle, 141 kWindowStyle, kWindowStyle,
139 window_title_text)); 142 window_title_text));
140 window_scroll_view->SetContents(list_views_.back()); 143 window_scroll_view->SetContents(list_views_.back());
141 window_scroll_view->ClipHeightTo(kWindowStyle.item_size.height(), 144 window_scroll_view->ClipHeightTo(kWindowStyle.item_size.height(),
142 kWindowStyle.item_size.height() * 2); 145 kWindowStyle.item_size.height() * 2);
143 window_scroll_view->set_hide_horizontal_scrollbar(true); 146 window_scroll_view->set_hide_horizontal_scrollbar(true);
144 window_scroll_view->set_background( 147 window_scroll_view->set_background(
145 views::Background::CreateSolidBackground(bg_color)); 148 views::Background::CreateSolidBackground(bg_color));
146 149
147 pane_->AddTab(window_title_text, window_scroll_view); 150 pane_->AddTab(window_title_text, window_scroll_view);
148 pane_->set_listener(this); 151 pane_->set_listener(this);
149 } 152 }
150 153
151 if (tab_list) { 154 if (tab_list) {
152 source_types_.push_back(DesktopMediaID::TYPE_WEB_CONTENTS); 155 source_types_.push_back(DesktopMediaID::TYPE_WEB_CONTENTS);
153 156
154 const DesktopMediaSourceViewStyle kTabStyle( 157 const DesktopMediaSourceViewStyle kTabStyle(
155 1, // columns 158 1, // columns
156 gfx::Size(600, 30), // item_size 159 gfx::Size(600, 30), // item_size
160 gfx::Rect(), // icon_rect
157 gfx::Rect(46, 0, 490, 30), // label_rect 161 gfx::Rect(46, 0, 490, 30), // label_rect
158 gfx::HorizontalAlignment::ALIGN_LEFT, // text_alignment 162 gfx::HorizontalAlignment::ALIGN_LEFT, // text_alignment
159 gfx::Rect(10, 2, 26, 26), // image_rect 163 gfx::Rect(10, 2, 26, 26), // image_rect
160 1, // selection_border_thickness 164 1, // selection_border_thickness
161 0); // focus_rectangle_inset 165 0); // focus_rectangle_inset
162 166
163 views::ScrollView* tab_scroll_view = 167 views::ScrollView* tab_scroll_view =
164 views::ScrollView::CreateScrollViewWithBorder(); 168 views::ScrollView::CreateScrollViewWithBorder();
165 base::string16 tab_title_text = 169 base::string16 tab_title_text =
166 l10n_util::GetStringUTF16(IDS_DESKTOP_MEDIA_PICKER_SOURCE_TYPE_TAB); 170 l10n_util::GetStringUTF16(IDS_DESKTOP_MEDIA_PICKER_SOURCE_TYPE_TAB);
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 445
442 // static 446 // static
443 std::unique_ptr<DesktopMediaPicker> DesktopMediaPicker::Create() { 447 std::unique_ptr<DesktopMediaPicker> DesktopMediaPicker::Create() {
444 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 448 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
445 extensions::switches::kDisableDesktopCapturePickerNewUI)) { 449 extensions::switches::kDisableDesktopCapturePickerNewUI)) {
446 return std::unique_ptr<DesktopMediaPicker>( 450 return std::unique_ptr<DesktopMediaPicker>(
447 new deprecated::DesktopMediaPickerViews()); 451 new deprecated::DesktopMediaPickerViews());
448 } 452 }
449 return std::unique_ptr<DesktopMediaPicker>(new DesktopMediaPickerViews()); 453 return std::unique_ptr<DesktopMediaPicker>(new DesktopMediaPickerViews());
450 } 454 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698