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

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

Issue 2632653002: MacViews: Enable views based External Protocol dialog behind secondary-ui-md flag. (Closed)
Patch Set: Fix chromeos Created 3 years, 11 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_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "chrome/browser/external_protocol/external_protocol_handler.h" 11 #include "chrome/browser/external_protocol/external_protocol_handler.h"
12 #include "chrome/browser/tab_contents/tab_util.h" 12 #include "chrome/browser/tab_contents/tab_util.h"
13 #include "chrome/browser/ui/external_protocol_dialog_delegate.h" 13 #include "chrome/browser/ui/external_protocol_dialog_delegate.h"
14 #include "chrome/grit/generated_resources.h" 14 #include "chrome/grit/generated_resources.h"
15 #include "components/constrained_window/constrained_window_views.h" 15 #include "components/constrained_window/constrained_window_views.h"
16 #include "content/public/browser/web_contents.h" 16 #include "content/public/browser/web_contents.h"
17 #include "ui/base/l10n/l10n_util.h" 17 #include "ui/base/l10n/l10n_util.h"
18 #include "ui/gfx/text_elider.h" 18 #include "ui/gfx/text_elider.h"
19 #include "ui/views/controls/message_box_view.h" 19 #include "ui/views/controls/message_box_view.h"
20 #include "ui/views/widget/widget.h" 20 #include "ui/views/widget/widget.h"
21 21
22 using content::WebContents; 22 using content::WebContents;
23 23
24 namespace { 24 namespace {
25 25
26 const int kMessageWidth = 400; 26 const int kMessageWidth = 400;
27 27
28 } // namespace 28 } // namespace
29 29
30 /////////////////////////////////////////////////////////////////////////////// 30 namespace chrome {
31 // ExternalProtocolHandler
32 31
33 // static 32 void RunExternalProtocolDialogViews(const GURL& url,
tapted 2017/01/17 21:17:13 consider wrapping this entire method in #if !defi
34 void ExternalProtocolHandler::RunExternalProtocolDialog( 33 int render_process_host_id,
35 const GURL& url, int render_process_host_id, int routing_id, 34 int routing_id,
36 ui::PageTransition page_transition, bool has_user_gesture) { 35 ui::PageTransition page_transition,
36 bool has_user_gesture) {
37 std::unique_ptr<ExternalProtocolDialogDelegate> delegate( 37 std::unique_ptr<ExternalProtocolDialogDelegate> delegate(
38 new ExternalProtocolDialogDelegate(url, render_process_host_id, 38 new ExternalProtocolDialogDelegate(url, render_process_host_id,
39 routing_id)); 39 routing_id));
40 if (delegate->program_name().empty()) { 40 if (delegate->program_name().empty()) {
tapted 2017/01/17 21:17:13 does this mean the same thing on Mac? (i.e. is thi
karandeepb 2017/01/24 03:23:32 Mac checks this here https://cs.chromium.org/chrom
41 // ShellExecute won't do anything. Don't bother warning the user. 41 // ShellExecute won't do anything. Don't bother warning the user.
42 return; 42 return;
43 } 43 }
44 44
45 // Windowing system takes ownership. 45 // Windowing system takes ownership.
46 new ExternalProtocolDialog(std::move(delegate), render_process_host_id, 46 new ExternalProtocolDialog(std::move(delegate), render_process_host_id,
47 routing_id); 47 routing_id);
48 } 48 }
49 49
50 } // namespace chrome
51
50 /////////////////////////////////////////////////////////////////////////////// 52 ///////////////////////////////////////////////////////////////////////////////
51 // ExternalProtocolDialog 53 // ExternalProtocolDialog
52 54
53 ExternalProtocolDialog::~ExternalProtocolDialog() { 55 ExternalProtocolDialog::~ExternalProtocolDialog() {
54 } 56 }
55 57
56 ////////////////////////////////////////////////////////////////////////////// 58 //////////////////////////////////////////////////////////////////////////////
57 // ExternalProtocolDialog, views::DialogDelegate implementation: 59 // ExternalProtocolDialog, views::DialogDelegate implementation:
58 60
59 int ExternalProtocolDialog::GetDefaultDialogButton() const { 61 int ExternalProtocolDialog::GetDefaultDialogButton() const {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 message_box_view_ = new views::MessageBoxView(params); 144 message_box_view_ = new views::MessageBoxView(params);
143 message_box_view_->SetCheckBoxLabel(delegate_->GetCheckboxText()); 145 message_box_view_->SetCheckBoxLabel(delegate_->GetCheckboxText());
144 146
145 WebContents* web_contents = tab_util::GetWebContentsByID( 147 WebContents* web_contents = tab_util::GetWebContentsByID(
146 render_process_host_id_, routing_id_); 148 render_process_host_id_, routing_id_);
147 // Only launch the dialog if there is a web contents associated with the 149 // Only launch the dialog if there is a web contents associated with the
148 // request. 150 // request.
149 if (web_contents) 151 if (web_contents)
150 constrained_window::ShowWebModalDialogViews(this, web_contents); 152 constrained_window::ShowWebModalDialogViews(this, web_contents);
151 } 153 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698