OLD | NEW |
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 "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/external_protocol/external_protocol_handler.h" | 10 #include "chrome/browser/external_protocol/external_protocol_handler.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 const int kMessageWidth = 400; | 25 const int kMessageWidth = 400; |
26 | 26 |
27 } // namespace | 27 } // namespace |
28 | 28 |
29 /////////////////////////////////////////////////////////////////////////////// | 29 /////////////////////////////////////////////////////////////////////////////// |
30 // ExternalProtocolHandler | 30 // ExternalProtocolHandler |
31 | 31 |
32 // static | 32 // static |
33 void ExternalProtocolHandler::RunExternalProtocolDialog( | 33 void ExternalProtocolHandler::RunExternalProtocolDialog( |
34 const GURL& url, int render_process_host_id, int routing_id) { | 34 const GURL& url, int render_process_host_id, int routing_id, |
| 35 ui::PageTransition page_transition) { |
35 scoped_ptr<ExternalProtocolDialogDelegate> delegate( | 36 scoped_ptr<ExternalProtocolDialogDelegate> delegate( |
36 new ExternalProtocolDialogDelegate(url, | 37 new ExternalProtocolDialogDelegate(url, |
37 render_process_host_id, | 38 render_process_host_id, |
38 routing_id)); | 39 routing_id)); |
39 if (delegate->program_name().empty()) { | 40 if (delegate->program_name().empty()) { |
40 // ShellExecute won't do anything. Don't bother warning the user. | 41 // ShellExecute won't do anything. Don't bother warning the user. |
41 return; | 42 return; |
42 } | 43 } |
43 | 44 |
44 // Windowing system takes ownership. | 45 // Windowing system takes ownership. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 const views::Widget* ExternalProtocolDialog::GetWidget() const { | 113 const views::Widget* ExternalProtocolDialog::GetWidget() const { |
113 return message_box_view_->GetWidget(); | 114 return message_box_view_->GetWidget(); |
114 } | 115 } |
115 | 116 |
116 /////////////////////////////////////////////////////////////////////////////// | 117 /////////////////////////////////////////////////////////////////////////////// |
117 // ExternalProtocolDialog, private: | 118 // ExternalProtocolDialog, private: |
118 | 119 |
119 ExternalProtocolDialog::ExternalProtocolDialog( | 120 ExternalProtocolDialog::ExternalProtocolDialog( |
120 scoped_ptr<const ProtocolDialogDelegate> delegate, | 121 scoped_ptr<const ProtocolDialogDelegate> delegate, |
121 int render_process_host_id, | 122 int render_process_host_id, |
122 int routing_id) | 123 int routing_id, |
| 124 ui::PageTransition page_transition) |
123 : delegate_(delegate.Pass()), | 125 : delegate_(delegate.Pass()), |
124 render_process_host_id_(render_process_host_id), | 126 render_process_host_id_(render_process_host_id), |
125 routing_id_(routing_id), | 127 routing_id_(routing_id), |
126 creation_time_(base::TimeTicks::Now()) { | 128 creation_time_(base::TimeTicks::Now()) { |
127 views::MessageBoxView::InitParams params(delegate_->GetMessageText()); | 129 views::MessageBoxView::InitParams params(delegate_->GetMessageText()); |
128 params.message_width = kMessageWidth; | 130 params.message_width = kMessageWidth; |
129 message_box_view_ = new views::MessageBoxView(params); | 131 message_box_view_ = new views::MessageBoxView(params); |
130 message_box_view_->SetCheckBoxLabel(delegate_->GetCheckboxText()); | 132 message_box_view_->SetCheckBoxLabel(delegate_->GetCheckboxText()); |
131 | 133 |
132 // Dialog is top level if we don't have a web_contents associated with us. | 134 // Dialog is top level if we don't have a web_contents associated with us. |
133 WebContents* web_contents = tab_util::GetWebContentsByID( | 135 WebContents* web_contents = tab_util::GetWebContentsByID( |
134 render_process_host_id_, routing_id_); | 136 render_process_host_id_, routing_id_); |
135 gfx::NativeWindow parent_window = NULL; | 137 gfx::NativeWindow parent_window = NULL; |
136 if (web_contents) | 138 if (web_contents) |
137 parent_window = web_contents->GetTopLevelNativeWindow(); | 139 parent_window = web_contents->GetTopLevelNativeWindow(); |
138 constrained_window::CreateBrowserModalDialogViews(this, | 140 constrained_window::CreateBrowserModalDialogViews(this, |
139 parent_window)->Show(); | 141 parent_window)->Show(); |
140 } | 142 } |
OLD | NEW |