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

Side by Side Diff: chrome/browser/ui/views/external_protocol_dialog.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/external_protocol_dialog.h" 5 #include "chrome/browser/ui/views/external_protocol_dialog.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 17 matching lines...) Expand all
28 28
29 } // namespace 29 } // namespace
30 30
31 /////////////////////////////////////////////////////////////////////////////// 31 ///////////////////////////////////////////////////////////////////////////////
32 // ExternalProtocolHandler 32 // ExternalProtocolHandler
33 33
34 // static 34 // static
35 void ExternalProtocolHandler::RunExternalProtocolDialog( 35 void ExternalProtocolHandler::RunExternalProtocolDialog(
36 const GURL& url, int render_process_host_id, int routing_id, 36 const GURL& url, int render_process_host_id, int routing_id,
37 ui::PageTransition page_transition, bool has_user_gesture) { 37 ui::PageTransition page_transition, bool has_user_gesture) {
38 scoped_ptr<ExternalProtocolDialogDelegate> delegate( 38 std::unique_ptr<ExternalProtocolDialogDelegate> delegate(
39 new ExternalProtocolDialogDelegate(url, 39 new ExternalProtocolDialogDelegate(url, render_process_host_id,
40 render_process_host_id,
41 routing_id)); 40 routing_id));
42 if (delegate->program_name().empty()) { 41 if (delegate->program_name().empty()) {
43 // ShellExecute won't do anything. Don't bother warning the user. 42 // ShellExecute won't do anything. Don't bother warning the user.
44 return; 43 return;
45 } 44 }
46 45
47 // Windowing system takes ownership. 46 // Windowing system takes ownership.
48 new ExternalProtocolDialog(std::move(delegate), render_process_host_id, 47 new ExternalProtocolDialog(std::move(delegate), render_process_host_id,
49 routing_id); 48 routing_id);
50 } 49 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 } 116 }
118 117
119 ui::ModalType ExternalProtocolDialog::GetModalType() const { 118 ui::ModalType ExternalProtocolDialog::GetModalType() const {
120 return ui::MODAL_TYPE_CHILD; 119 return ui::MODAL_TYPE_CHILD;
121 } 120 }
122 121
123 /////////////////////////////////////////////////////////////////////////////// 122 ///////////////////////////////////////////////////////////////////////////////
124 // ExternalProtocolDialog, private: 123 // ExternalProtocolDialog, private:
125 124
126 ExternalProtocolDialog::ExternalProtocolDialog( 125 ExternalProtocolDialog::ExternalProtocolDialog(
127 scoped_ptr<const ProtocolDialogDelegate> delegate, 126 std::unique_ptr<const ProtocolDialogDelegate> delegate,
128 int render_process_host_id, 127 int render_process_host_id,
129 int routing_id) 128 int routing_id)
130 : delegate_(std::move(delegate)), 129 : delegate_(std::move(delegate)),
131 render_process_host_id_(render_process_host_id), 130 render_process_host_id_(render_process_host_id),
132 routing_id_(routing_id), 131 routing_id_(routing_id),
133 creation_time_(base::TimeTicks::Now()) { 132 creation_time_(base::TimeTicks::Now()) {
134 views::MessageBoxView::InitParams params(delegate_->GetMessageText()); 133 views::MessageBoxView::InitParams params(delegate_->GetMessageText());
135 params.message_width = kMessageWidth; 134 params.message_width = kMessageWidth;
136 message_box_view_ = new views::MessageBoxView(params); 135 message_box_view_ = new views::MessageBoxView(params);
137 message_box_view_->SetCheckBoxLabel(delegate_->GetCheckboxText()); 136 message_box_view_->SetCheckBoxLabel(delegate_->GetCheckboxText());
138 137
139 WebContents* web_contents = tab_util::GetWebContentsByID( 138 WebContents* web_contents = tab_util::GetWebContentsByID(
140 render_process_host_id_, routing_id_); 139 render_process_host_id_, routing_id_);
141 // Only launch the dialog if there is a web contents associated with the 140 // Only launch the dialog if there is a web contents associated with the
142 // request. 141 // request.
143 if (web_contents) 142 if (web_contents)
144 constrained_window::ShowWebModalDialogViews(this, web_contents); 143 constrained_window::ShowWebModalDialogViews(this, web_contents);
145 } 144 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/external_protocol_dialog.h ('k') | chrome/browser/ui/views/find_bar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698