Chromium Code Reviews| 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 "chrome/browser/chromeos/arc/intent_helper/arc_external_protocol_dialog .h" | 7 #include "chrome/browser/chromeos/arc/intent_helper/arc_external_protocol_dialog .h" |
| 8 #include "chrome/browser/external_protocol/external_protocol_handler.h" | 8 #include "chrome/browser/external_protocol/external_protocol_handler.h" |
| 9 #include "chrome/browser/tab_contents/tab_util.h" | 9 #include "chrome/browser/tab_contents/tab_util.h" |
| 10 #include "chrome/grit/chromium_strings.h" | 10 #include "chrome/grit/chromium_strings.h" |
| 11 #include "chrome/grit/generated_resources.h" | 11 #include "chrome/grit/generated_resources.h" |
| 12 #include "components/strings/grit/components_strings.h" | 12 #include "components/strings/grit/components_strings.h" |
| 13 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
| 15 #include "ui/gfx/text_elider.h" | 15 #include "ui/gfx/text_elider.h" |
| 16 #include "ui/views/controls/message_box_view.h" | 16 #include "ui/views/controls/message_box_view.h" |
| 17 #include "ui/views/widget/widget.h" | 17 #include "ui/views/widget/widget.h" |
| 18 #include "url/gurl.h" | 18 #include "url/gurl.h" |
| 19 | 19 |
| 20 using content::WebContents; | 20 using content::WebContents; |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 const int kMessageWidth = 400; | 24 const int kMessageWidth = 400; |
| 25 | 25 |
| 26 } // namespace | 26 } // namespace |
| 27 | 27 |
| 28 /////////////////////////////////////////////////////////////////////////////// | 28 namespace chrome { |
| 29 // ExternalProtocolHandler | |
| 30 | 29 |
| 31 // static | 30 void RunExternalProtocolDialogViews(const GURL& url, |
|
karandeepb
2017/01/16 11:13:10
I am assuming it's fine to name the chromeos versi
tapted
2017/01/17 21:17:13
seems reasonable.. but I think we can avoid this c
karandeepb
2017/01/24 03:23:32
Done.
| |
| 32 void ExternalProtocolHandler::RunExternalProtocolDialog( | 31 int render_process_host_id, |
| 33 const GURL& url, | 32 int routing_id, |
| 34 int render_process_host_id, | 33 ui::PageTransition page_transition, |
| 35 int routing_id, | 34 bool has_user_gesture) { |
| 36 ui::PageTransition page_transition, | |
| 37 bool has_user_gesture) { | |
| 38 // First, check if ARC version of the dialog is available and run ARC version | 35 // First, check if ARC version of the dialog is available and run ARC version |
| 39 // when possible. | 36 // when possible. |
| 40 if (arc::RunArcExternalProtocolDialog(url, render_process_host_id, routing_id, | 37 if (arc::RunArcExternalProtocolDialog(url, render_process_host_id, routing_id, |
| 41 page_transition, has_user_gesture)) { | 38 page_transition, has_user_gesture)) { |
| 42 return; | 39 return; |
| 43 } | 40 } |
| 44 WebContents* web_contents = tab_util::GetWebContentsByID( | 41 WebContents* web_contents = tab_util::GetWebContentsByID( |
| 45 render_process_host_id, routing_id); | 42 render_process_host_id, routing_id); |
| 46 new ExternalProtocolDialog(web_contents, url); | 43 new ExternalProtocolDialog(web_contents, url); |
| 47 } | 44 } |
| 48 | 45 |
| 46 } // namespace chrome | |
| 47 | |
| 49 /////////////////////////////////////////////////////////////////////////////// | 48 /////////////////////////////////////////////////////////////////////////////// |
| 50 // ExternalProtocolDialog | 49 // ExternalProtocolDialog |
| 51 | 50 |
| 52 ExternalProtocolDialog::~ExternalProtocolDialog() { | 51 ExternalProtocolDialog::~ExternalProtocolDialog() { |
| 53 } | 52 } |
| 54 | 53 |
| 55 ////////////////////////////////////////////////////////////////////////////// | 54 ////////////////////////////////////////////////////////////////////////////// |
| 56 // ExternalProtocolDialog, views::DialogDelegate implementation: | 55 // ExternalProtocolDialog, views::DialogDelegate implementation: |
| 57 | 56 |
| 58 int ExternalProtocolDialog::GetDialogButtons() const { | 57 int ExternalProtocolDialog::GetDialogButtons() const { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 105 | 104 |
| 106 gfx::NativeWindow parent_window; | 105 gfx::NativeWindow parent_window; |
| 107 if (web_contents) { | 106 if (web_contents) { |
| 108 parent_window = web_contents->GetTopLevelNativeWindow(); | 107 parent_window = web_contents->GetTopLevelNativeWindow(); |
| 109 } else { | 108 } else { |
| 110 // Dialog is top level if we don't have a web_contents associated with us. | 109 // Dialog is top level if we don't have a web_contents associated with us. |
| 111 parent_window = NULL; | 110 parent_window = NULL; |
| 112 } | 111 } |
| 113 views::DialogDelegate::CreateDialogWidget(this, NULL, parent_window)->Show(); | 112 views::DialogDelegate::CreateDialogWidget(this, NULL, parent_window)->Show(); |
| 114 } | 113 } |
| OLD | NEW |