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

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

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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_media_picker_views.h" 5 #include "chrome/browser/ui/views/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"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 // Detect tap gesture using ET_GESTURE_TAP_DOWN so the view also gets focused 202 // Detect tap gesture using ET_GESTURE_TAP_DOWN so the view also gets focused
203 // on the long tap (when the tap gesture starts). 203 // on the long tap (when the tap gesture starts).
204 if (event->type() == ui::ET_GESTURE_TAP_DOWN) { 204 if (event->type() == ui::ET_GESTURE_TAP_DOWN) {
205 RequestFocus(); 205 RequestFocus();
206 event->SetHandled(); 206 event->SetHandled();
207 } 207 }
208 } 208 }
209 209
210 DesktopMediaListView::DesktopMediaListView( 210 DesktopMediaListView::DesktopMediaListView(
211 DesktopMediaPickerDialogView* parent, 211 DesktopMediaPickerDialogView* parent,
212 scoped_ptr<DesktopMediaList> media_list) 212 std::unique_ptr<DesktopMediaList> media_list)
213 : parent_(parent), media_list_(std::move(media_list)), weak_factory_(this) { 213 : parent_(parent), media_list_(std::move(media_list)), weak_factory_(this) {
214 media_list_->SetThumbnailSize(gfx::Size(kThumbnailWidth, kThumbnailHeight)); 214 media_list_->SetThumbnailSize(gfx::Size(kThumbnailWidth, kThumbnailHeight));
215 SetFocusable(true); 215 SetFocusable(true);
216 } 216 }
217 217
218 DesktopMediaListView::~DesktopMediaListView() {} 218 DesktopMediaListView::~DesktopMediaListView() {}
219 219
220 void DesktopMediaListView::StartUpdating(DesktopMediaID dialog_window_id) { 220 void DesktopMediaListView::StartUpdating(DesktopMediaID dialog_window_id) {
221 media_list_->SetViewDialogWindowId(dialog_window_id); 221 media_list_->SetViewDialogWindowId(dialog_window_id);
222 media_list_->StartUpdating(this); 222 media_list_->StartUpdating(this);
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 OnSelectionChanged(); 388 OnSelectionChanged();
389 OnDoubleClick(); 389 OnDoubleClick();
390 } 390 }
391 391
392 DesktopMediaPickerDialogView::DesktopMediaPickerDialogView( 392 DesktopMediaPickerDialogView::DesktopMediaPickerDialogView(
393 content::WebContents* parent_web_contents, 393 content::WebContents* parent_web_contents,
394 gfx::NativeWindow context, 394 gfx::NativeWindow context,
395 DesktopMediaPickerViews* parent, 395 DesktopMediaPickerViews* parent,
396 const base::string16& app_name, 396 const base::string16& app_name,
397 const base::string16& target_name, 397 const base::string16& target_name,
398 scoped_ptr<DesktopMediaList> media_list, 398 std::unique_ptr<DesktopMediaList> media_list,
399 bool request_audio) 399 bool request_audio)
400 : parent_(parent), 400 : parent_(parent),
401 app_name_(app_name), 401 app_name_(app_name),
402 description_label_(new views::Label()), 402 description_label_(new views::Label()),
403 audio_share_checkbox_(nullptr), 403 audio_share_checkbox_(nullptr),
404 sources_scroll_view_(views::ScrollView::CreateScrollViewWithBorder()), 404 sources_scroll_view_(views::ScrollView::CreateScrollViewWithBorder()),
405 sources_list_view_( 405 sources_list_view_(
406 new DesktopMediaListView(this, std::move(media_list))) { 406 new DesktopMediaListView(this, std::move(media_list))) {
407 // TODO(estade): we should be getting the inside-border spacing by default as 407 // TODO(estade): we should be getting the inside-border spacing by default as
408 // a DialogDelegateView subclass, via default BubbleFrameView content margins. 408 // a DialogDelegateView subclass, via default BubbleFrameView content margins.
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 dialog_->DetachParent(); 605 dialog_->DetachParent();
606 dialog_->GetWidget()->Close(); 606 dialog_->GetWidget()->Close();
607 } 607 }
608 } 608 }
609 609
610 void DesktopMediaPickerViews::Show(content::WebContents* web_contents, 610 void DesktopMediaPickerViews::Show(content::WebContents* web_contents,
611 gfx::NativeWindow context, 611 gfx::NativeWindow context,
612 gfx::NativeWindow parent, 612 gfx::NativeWindow parent,
613 const base::string16& app_name, 613 const base::string16& app_name,
614 const base::string16& target_name, 614 const base::string16& target_name,
615 scoped_ptr<DesktopMediaList> media_list, 615 std::unique_ptr<DesktopMediaList> media_list,
616 bool request_audio, 616 bool request_audio,
617 const DoneCallback& done_callback) { 617 const DoneCallback& done_callback) {
618 callback_ = done_callback; 618 callback_ = done_callback;
619 dialog_ = new DesktopMediaPickerDialogView( 619 dialog_ = new DesktopMediaPickerDialogView(
620 web_contents, context, this, app_name, target_name, std::move(media_list), 620 web_contents, context, this, app_name, target_name, std::move(media_list),
621 request_audio); 621 request_audio);
622 } 622 }
623 623
624 void DesktopMediaPickerViews::NotifyDialogResult(DesktopMediaID source) { 624 void DesktopMediaPickerViews::NotifyDialogResult(DesktopMediaID source) {
625 // Once this method is called the |dialog_| will close and destroy itself. 625 // Once this method is called the |dialog_| will close and destroy itself.
626 dialog_->DetachParent(); 626 dialog_->DetachParent();
627 dialog_ = NULL; 627 dialog_ = NULL;
628 628
629 DCHECK(!callback_.is_null()); 629 DCHECK(!callback_.is_null());
630 630
631 // Notify the |callback_| asynchronously because it may need to destroy 631 // Notify the |callback_| asynchronously because it may need to destroy
632 // DesktopMediaPicker. 632 // DesktopMediaPicker.
633 content::BrowserThread::PostTask( 633 content::BrowserThread::PostTask(
634 content::BrowserThread::UI, FROM_HERE, 634 content::BrowserThread::UI, FROM_HERE,
635 base::Bind(callback_, source)); 635 base::Bind(callback_, source));
636 callback_.Reset(); 636 callback_.Reset();
637 } 637 }
638 638
639 // static 639 // static
640 scoped_ptr<DesktopMediaPicker> DesktopMediaPicker::Create() { 640 std::unique_ptr<DesktopMediaPicker> DesktopMediaPicker::Create() {
641 return scoped_ptr<DesktopMediaPicker>(new DesktopMediaPickerViews()); 641 return std::unique_ptr<DesktopMediaPicker>(new DesktopMediaPickerViews());
642 } 642 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/desktop_media_picker_views.h ('k') | chrome/browser/ui/views/desktop_media_picker_views_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698