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/chromeos/external_protocol_dialog.h" | 5 #include "chrome/browser/chromeos/external_protocol_dialog.h" |
6 | 6 |
7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.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/chromeos/arc/arc_external_protocol_dialog.h" |
10 #include "chrome/browser/external_protocol/external_protocol_handler.h" | 11 #include "chrome/browser/external_protocol/external_protocol_handler.h" |
11 #include "chrome/browser/tab_contents/tab_util.h" | 12 #include "chrome/browser/tab_contents/tab_util.h" |
12 #include "chrome/grit/chromium_strings.h" | 13 #include "chrome/grit/chromium_strings.h" |
13 #include "chrome/grit/generated_resources.h" | 14 #include "chrome/grit/generated_resources.h" |
14 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
15 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
16 #include "ui/gfx/text_elider.h" | 17 #include "ui/gfx/text_elider.h" |
17 #include "ui/views/controls/message_box_view.h" | 18 #include "ui/views/controls/message_box_view.h" |
18 #include "ui/views/widget/widget.h" | 19 #include "ui/views/widget/widget.h" |
19 #include "url/gurl.h" | 20 #include "url/gurl.h" |
20 | 21 |
21 using content::WebContents; | 22 using content::WebContents; |
22 | 23 |
23 namespace { | 24 namespace { |
24 | 25 |
25 const int kMessageWidth = 400; | 26 const int kMessageWidth = 400; |
26 | 27 |
27 } // namespace | 28 } // namespace |
28 | 29 |
29 /////////////////////////////////////////////////////////////////////////////// | 30 /////////////////////////////////////////////////////////////////////////////// |
30 // ExternalProtocolHandler | 31 // ExternalProtocolHandler |
31 | 32 |
32 // static | 33 // static |
33 void ExternalProtocolHandler::RunExternalProtocolDialog( | 34 void ExternalProtocolHandler::RunExternalProtocolDialog( |
34 const GURL& url, | 35 const GURL& url, |
35 int render_process_host_id, | 36 int render_process_host_id, |
36 int routing_id, | 37 int routing_id, |
37 ui::PageTransition page_transition, | 38 ui::PageTransition page_transition, |
38 bool has_user_gesture) { | 39 bool has_user_gesture) { |
| 40 // First, check if ARC version of the dialog is available and run ARC version |
| 41 // when possible. |
| 42 if (arc::RunArcExternalProtocolDialog(url, render_process_host_id, routing_id, |
| 43 page_transition, has_user_gesture)) { |
| 44 return; |
| 45 } |
39 WebContents* web_contents = tab_util::GetWebContentsByID( | 46 WebContents* web_contents = tab_util::GetWebContentsByID( |
40 render_process_host_id, routing_id); | 47 render_process_host_id, routing_id); |
41 new ExternalProtocolDialog(web_contents, url); | 48 new ExternalProtocolDialog(web_contents, url); |
42 } | 49 } |
43 | 50 |
44 /////////////////////////////////////////////////////////////////////////////// | 51 /////////////////////////////////////////////////////////////////////////////// |
45 // ExternalProtocolDialog | 52 // ExternalProtocolDialog |
46 | 53 |
47 ExternalProtocolDialog::~ExternalProtocolDialog() { | 54 ExternalProtocolDialog::~ExternalProtocolDialog() { |
48 } | 55 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 118 |
112 gfx::NativeWindow parent_window; | 119 gfx::NativeWindow parent_window; |
113 if (web_contents) { | 120 if (web_contents) { |
114 parent_window = web_contents->GetTopLevelNativeWindow(); | 121 parent_window = web_contents->GetTopLevelNativeWindow(); |
115 } else { | 122 } else { |
116 // Dialog is top level if we don't have a web_contents associated with us. | 123 // Dialog is top level if we don't have a web_contents associated with us. |
117 parent_window = NULL; | 124 parent_window = NULL; |
118 } | 125 } |
119 views::DialogDelegate::CreateDialogWidget(this, NULL, parent_window)->Show(); | 126 views::DialogDelegate::CreateDialogWidget(this, NULL, parent_window)->Show(); |
120 } | 127 } |
OLD | NEW |